starpu_data_interfaces.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010-2014 Université de Bordeaux
  4. * Copyright (C) 2010-2014 Centre National de la Recherche Scientifique
  5. * Copyright (C) 2011-2012 Institut National de Recherche en Informatique et Automatique
  6. *
  7. * StarPU is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU Lesser General Public License as published by
  9. * the Free Software Foundation; either version 2.1 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * StarPU is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. *
  16. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  17. */
  18. #ifndef __STARPU_DATA_INTERFACES_H__
  19. #define __STARPU_DATA_INTERFACES_H__
  20. #include <starpu.h>
  21. #ifdef STARPU_USE_CUDA
  22. /* to use CUDA streams */
  23. # ifdef STARPU_DONT_INCLUDE_CUDA_HEADERS
  24. typedef void *cudaStream_t;
  25. # else
  26. # include <cuda_runtime.h>
  27. # endif
  28. #endif
  29. #ifdef __cplusplus
  30. extern "C"
  31. {
  32. #endif
  33. struct starpu_data_copy_methods
  34. {
  35. int (*can_copy)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node, unsigned handling_node);
  36. int (*ram_to_ram)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node);
  37. int (*ram_to_cuda)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node);
  38. int (*ram_to_opencl)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node);
  39. int (*ram_to_mic)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node);
  40. int (*cuda_to_ram)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node);
  41. int (*cuda_to_cuda)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node);
  42. int (*cuda_to_opencl)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node);
  43. int (*opencl_to_ram)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node);
  44. int (*opencl_to_cuda)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node);
  45. int (*opencl_to_opencl)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node);
  46. int (*mic_to_ram)(void *src_interface, unsigned srd_node, void *dst_interface, unsigned dst_node);
  47. int (*scc_src_to_sink)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node);
  48. int (*scc_sink_to_src)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node);
  49. int (*scc_sink_to_sink)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node);
  50. #ifdef STARPU_USE_CUDA
  51. int (*ram_to_cuda_async)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node, cudaStream_t stream);
  52. int (*cuda_to_ram_async)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node, cudaStream_t stream);
  53. int (*cuda_to_cuda_async)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node, cudaStream_t stream);
  54. #else
  55. #ifdef STARPU_SIMGRID
  56. int cuda_to_cuda_async;
  57. #endif
  58. #endif
  59. #if defined(STARPU_USE_OPENCL) && !defined(__CUDACC__)
  60. int (*ram_to_opencl_async)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node, cl_event *event);
  61. int (*opencl_to_ram_async)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node, cl_event *event);
  62. int (*opencl_to_opencl_async)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node, cl_event *event);
  63. #endif
  64. #ifdef STARPU_USE_MIC
  65. int (*ram_to_mic_async)(void *src_intreface, unsigned src_node, void *dst_interface, unsigned dst_node);
  66. int (*mic_to_ram_async)(void *src_interface, unsigned srd_node, void *dst_interface, unsigned dst_node);
  67. #endif
  68. int (*any_to_any)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node, void *async_data);
  69. };
  70. int starpu_interface_copy(uintptr_t src, size_t src_offset, unsigned src_node, uintptr_t dst, size_t dst_offset, unsigned dst_node, size_t size, void *async_data);
  71. uintptr_t starpu_malloc_on_node(unsigned dst_node, size_t size);
  72. void starpu_free_on_node(unsigned dst_node, uintptr_t addr, size_t size);
  73. enum starpu_data_interface_id
  74. {
  75. STARPU_UNKNOWN_INTERFACE_ID = -1,
  76. STARPU_MATRIX_INTERFACE_ID=0,
  77. STARPU_BLOCK_INTERFACE_ID=1,
  78. STARPU_VECTOR_INTERFACE_ID=2,
  79. STARPU_CSR_INTERFACE_ID=3,
  80. STARPU_BCSR_INTERFACE_ID=4,
  81. STARPU_VARIABLE_INTERFACE_ID=5,
  82. STARPU_VOID_INTERFACE_ID=6,
  83. STARPU_MULTIFORMAT_INTERFACE_ID=7,
  84. STARPU_COO_INTERFACE_ID=8,
  85. STARPU_MAX_INTERFACE_ID=9
  86. };
  87. struct starpu_data_interface_ops
  88. {
  89. void (*register_data_handle) (starpu_data_handle_t handle,
  90. unsigned home_node, void *data_interface);
  91. starpu_ssize_t (*allocate_data_on_node) (void *data_interface, unsigned node);
  92. void (*free_data_on_node) (void *data_interface, unsigned node);
  93. const struct starpu_data_copy_methods *copy_methods;
  94. void * (*handle_to_pointer) (starpu_data_handle_t handle, unsigned node);
  95. size_t (*get_size) (starpu_data_handle_t handle);
  96. uint32_t (*footprint) (starpu_data_handle_t handle);
  97. int (*compare) (void *data_interface_a, void *data_interface_b);
  98. void (*display) (starpu_data_handle_t handle, FILE *f);
  99. starpu_ssize_t (*describe) (void *data_interface, char *buf, size_t size);
  100. enum starpu_data_interface_id interfaceid;
  101. size_t interface_size;
  102. int is_multiformat;
  103. struct starpu_multiformat_data_interface_ops* (*get_mf_ops)(void *data_interface);
  104. int (*pack_data) (starpu_data_handle_t handle, unsigned node, void **ptr, starpu_ssize_t *count);
  105. int (*unpack_data) (starpu_data_handle_t handle, unsigned node, void *ptr, size_t count);
  106. };
  107. int starpu_data_interface_get_next_id(void);
  108. void starpu_data_register(starpu_data_handle_t *handleptr, unsigned home_node, void *data_interface, struct starpu_data_interface_ops *ops);
  109. void starpu_data_ptr_register(starpu_data_handle_t handle, unsigned node);
  110. void starpu_data_register_same(starpu_data_handle_t *handledst, starpu_data_handle_t handlesrc);
  111. void *starpu_data_handle_to_pointer(starpu_data_handle_t handle, unsigned node);
  112. void *starpu_data_get_local_ptr(starpu_data_handle_t handle);
  113. void *starpu_data_get_interface_on_node(starpu_data_handle_t handle, unsigned memory_node);
  114. extern struct starpu_data_interface_ops starpu_interface_matrix_ops;
  115. struct starpu_matrix_interface
  116. {
  117. enum starpu_data_interface_id id;
  118. uintptr_t ptr;
  119. uintptr_t dev_handle;
  120. size_t offset;
  121. uint32_t nx;
  122. uint32_t ny;
  123. uint32_t ld;
  124. size_t elemsize;
  125. };
  126. void starpu_matrix_data_register(starpu_data_handle_t *handle, unsigned home_node, uintptr_t ptr, uint32_t ld, uint32_t nx, uint32_t ny, size_t elemsize);
  127. void starpu_matrix_ptr_register(starpu_data_handle_t handle, unsigned node, uintptr_t ptr, uintptr_t dev_handle, size_t offset, uint32_t ld);
  128. uint32_t starpu_matrix_get_nx(starpu_data_handle_t handle);
  129. uint32_t starpu_matrix_get_ny(starpu_data_handle_t handle);
  130. uint32_t starpu_matrix_get_local_ld(starpu_data_handle_t handle);
  131. uintptr_t starpu_matrix_get_local_ptr(starpu_data_handle_t handle);
  132. size_t starpu_matrix_get_elemsize(starpu_data_handle_t handle);
  133. #define STARPU_MATRIX_GET_PTR(interface) (((struct starpu_matrix_interface *)(interface))->ptr)
  134. #define STARPU_MATRIX_GET_DEV_HANDLE(interface) (((struct starpu_matrix_interface *)(interface))->dev_handle)
  135. #define STARPU_MATRIX_GET_OFFSET(interface) (((struct starpu_matrix_interface *)(interface))->offset)
  136. #define STARPU_MATRIX_GET_NX(interface) (((struct starpu_matrix_interface *)(interface))->nx)
  137. #define STARPU_MATRIX_GET_NY(interface) (((struct starpu_matrix_interface *)(interface))->ny)
  138. #define STARPU_MATRIX_GET_LD(interface) (((struct starpu_matrix_interface *)(interface))->ld)
  139. #define STARPU_MATRIX_GET_ELEMSIZE(interface) (((struct starpu_matrix_interface *)(interface))->elemsize)
  140. extern struct starpu_data_interface_ops starpu_interface_coo_ops;
  141. struct starpu_coo_interface
  142. {
  143. enum starpu_data_interface_id id;
  144. uint32_t *columns;
  145. uint32_t *rows;
  146. uintptr_t values;
  147. uint32_t nx;
  148. uint32_t ny;
  149. uint32_t n_values;
  150. size_t elemsize;
  151. };
  152. void starpu_coo_data_register(starpu_data_handle_t *handleptr, unsigned home_node, uint32_t nx, uint32_t ny, uint32_t n_values, uint32_t *columns, uint32_t *rows, uintptr_t values, size_t elemsize);
  153. #define STARPU_COO_GET_COLUMNS(interface) \
  154. (((struct starpu_coo_interface *)(interface))->columns)
  155. #define STARPU_COO_GET_COLUMNS_DEV_HANDLE(interface) \
  156. (((struct starpu_coo_interface *)(interface))->columns)
  157. #define STARPU_COO_GET_ROWS(interface) \
  158. (((struct starpu_coo_interface *)(interface))->rows)
  159. #define STARPU_COO_GET_ROWS_DEV_HANDLE(interface) \
  160. (((struct starpu_coo_interface *)(interface))->rows)
  161. #define STARPU_COO_GET_VALUES(interface) \
  162. (((struct starpu_coo_interface *)(interface))->values)
  163. #define STARPU_COO_GET_VALUES_DEV_HANDLE(interface) \
  164. (((struct starpu_coo_interface *)(interface))->values)
  165. #define STARPU_COO_GET_OFFSET 0
  166. #define STARPU_COO_GET_NX(interface) \
  167. (((struct starpu_coo_interface *)(interface))->nx)
  168. #define STARPU_COO_GET_NY(interface) \
  169. (((struct starpu_coo_interface *)(interface))->ny)
  170. #define STARPU_COO_GET_NVALUES(interface) \
  171. (((struct starpu_coo_interface *)(interface))->n_values)
  172. #define STARPU_COO_GET_ELEMSIZE(interface) \
  173. (((struct starpu_coo_interface *)(interface))->elemsize)
  174. extern struct starpu_data_interface_ops starpu_interface_block_ops;
  175. /* TODO: rename to 3dmatrix? */
  176. struct starpu_block_interface
  177. {
  178. enum starpu_data_interface_id id;
  179. uintptr_t ptr;
  180. uintptr_t dev_handle;
  181. size_t offset;
  182. uint32_t nx;
  183. uint32_t ny;
  184. uint32_t nz;
  185. uint32_t ldy;
  186. uint32_t ldz;
  187. size_t elemsize;
  188. };
  189. void starpu_block_data_register(starpu_data_handle_t *handle, unsigned home_node, uintptr_t ptr, uint32_t ldy, uint32_t ldz, uint32_t nx, uint32_t ny, uint32_t nz, size_t elemsize);
  190. void starpu_block_ptr_register(starpu_data_handle_t handle, unsigned node, uintptr_t ptr, uintptr_t dev_handle, size_t offset, uint32_t ldy, uint32_t ldz);
  191. uint32_t starpu_block_get_nx(starpu_data_handle_t handle);
  192. uint32_t starpu_block_get_ny(starpu_data_handle_t handle);
  193. uint32_t starpu_block_get_nz(starpu_data_handle_t handle);
  194. uint32_t starpu_block_get_local_ldy(starpu_data_handle_t handle);
  195. uint32_t starpu_block_get_local_ldz(starpu_data_handle_t handle);
  196. uintptr_t starpu_block_get_local_ptr(starpu_data_handle_t handle);
  197. size_t starpu_block_get_elemsize(starpu_data_handle_t handle);
  198. #define STARPU_BLOCK_GET_PTR(interface) (((struct starpu_block_interface *)(interface))->ptr)
  199. #define STARPU_BLOCK_GET_DEV_HANDLE(interface) (((struct starpu_block_interface *)(interface))->dev_handle)
  200. #define STARPU_BLOCK_GET_OFFSET(interface) (((struct starpu_block_interface *)(interface))->offset)
  201. #define STARPU_BLOCK_GET_NX(interface) (((struct starpu_block_interface *)(interface))->nx)
  202. #define STARPU_BLOCK_GET_NY(interface) (((struct starpu_block_interface *)(interface))->ny)
  203. #define STARPU_BLOCK_GET_NZ(interface) (((struct starpu_block_interface *)(interface))->nz)
  204. #define STARPU_BLOCK_GET_LDY(interface) (((struct starpu_block_interface *)(interface))->ldy)
  205. #define STARPU_BLOCK_GET_LDZ(interface) (((struct starpu_block_interface *)(interface))->ldz)
  206. #define STARPU_BLOCK_GET_ELEMSIZE(interface) (((struct starpu_block_interface *)(interface))->elemsize)
  207. extern struct starpu_data_interface_ops starpu_interface_vector_ops;
  208. struct starpu_vector_interface
  209. {
  210. enum starpu_data_interface_id id;
  211. uintptr_t ptr;
  212. uintptr_t dev_handle;
  213. size_t offset;
  214. uint32_t nx;
  215. size_t elemsize;
  216. uint32_t slice_base;
  217. };
  218. void starpu_vector_data_register(starpu_data_handle_t *handle, unsigned home_node, uintptr_t ptr, uint32_t nx, size_t elemsize);
  219. void starpu_vector_ptr_register(starpu_data_handle_t handle, unsigned node, uintptr_t ptr, uintptr_t dev_handle, size_t offset);
  220. uint32_t starpu_vector_get_nx(starpu_data_handle_t handle);
  221. size_t starpu_vector_get_elemsize(starpu_data_handle_t handle);
  222. uintptr_t starpu_vector_get_local_ptr(starpu_data_handle_t handle);
  223. #define STARPU_VECTOR_GET_PTR(interface) (((struct starpu_vector_interface *)(interface))->ptr)
  224. #define STARPU_VECTOR_GET_DEV_HANDLE(interface) (((struct starpu_vector_interface *)(interface))->dev_handle)
  225. #define STARPU_VECTOR_GET_OFFSET(interface) (((struct starpu_vector_interface *)(interface))->offset)
  226. #define STARPU_VECTOR_GET_NX(interface) (((struct starpu_vector_interface *)(interface))->nx)
  227. #define STARPU_VECTOR_GET_ELEMSIZE(interface) (((struct starpu_vector_interface *)(interface))->elemsize)
  228. #define STARPU_VECTOR_GET_SLICE_BASE(interface) (((struct starpu_vector_interface *)(interface))->slice_base)
  229. extern struct starpu_data_interface_ops starpu_interface_variable_ops;
  230. struct starpu_variable_interface
  231. {
  232. enum starpu_data_interface_id id;
  233. uintptr_t ptr;
  234. uintptr_t dev_handle;
  235. size_t offset;
  236. size_t elemsize;
  237. };
  238. void starpu_variable_data_register(starpu_data_handle_t *handle, unsigned home_node, uintptr_t ptr, size_t size);
  239. void starpu_variable_ptr_register(starpu_data_handle_t handle, unsigned node, uintptr_t ptr, uintptr_t dev_handle, size_t offset);
  240. size_t starpu_variable_get_elemsize(starpu_data_handle_t handle);
  241. uintptr_t starpu_variable_get_local_ptr(starpu_data_handle_t handle);
  242. #define STARPU_VARIABLE_GET_PTR(interface) (((struct starpu_variable_interface *)(interface))->ptr)
  243. #define STARPU_VARIABLE_GET_OFFSET(interface) (((struct starpu_variable_interface *)(interface))->offset)
  244. #define STARPU_VARIABLE_GET_ELEMSIZE(interface) (((struct starpu_variable_interface *)(interface))->elemsize)
  245. #define STARPU_VARIABLE_GET_DEV_HANDLE(interface) \
  246. (((struct starpu_variable_interface *)(interface))->ptr)
  247. extern struct starpu_data_interface_ops starpu_interface_void_ops;
  248. void starpu_void_data_register(starpu_data_handle_t *handle);
  249. extern struct starpu_data_interface_ops starpu_interface_csr_ops;
  250. struct starpu_csr_interface
  251. {
  252. enum starpu_data_interface_id id;
  253. uint32_t nnz;
  254. uint32_t nrow;
  255. uintptr_t nzval;
  256. uint32_t *colind;
  257. uint32_t *rowptr;
  258. uint32_t firstentry;
  259. size_t elemsize;
  260. };
  261. void starpu_csr_data_register(starpu_data_handle_t *handle, unsigned home_node, uint32_t nnz, uint32_t nrow, uintptr_t nzval, uint32_t *colind, uint32_t *rowptr, uint32_t firstentry, size_t elemsize);
  262. uint32_t starpu_csr_get_nnz(starpu_data_handle_t handle);
  263. uint32_t starpu_csr_get_nrow(starpu_data_handle_t handle);
  264. uint32_t starpu_csr_get_firstentry(starpu_data_handle_t handle);
  265. uintptr_t starpu_csr_get_local_nzval(starpu_data_handle_t handle);
  266. uint32_t *starpu_csr_get_local_colind(starpu_data_handle_t handle);
  267. uint32_t *starpu_csr_get_local_rowptr(starpu_data_handle_t handle);
  268. size_t starpu_csr_get_elemsize(starpu_data_handle_t handle);
  269. #define STARPU_CSR_GET_NNZ(interface) (((struct starpu_csr_interface *)(interface))->nnz)
  270. #define STARPU_CSR_GET_NROW(interface) (((struct starpu_csr_interface *)(interface))->nrow)
  271. #define STARPU_CSR_GET_NZVAL(interface) (((struct starpu_csr_interface *)(interface))->nzval)
  272. #define STARPU_CSR_GET_NZVAL_DEV_HANDLE(interface) \
  273. (((struct starpu_csr_interface *)(interface))->nnz)
  274. #define STARPU_CSR_GET_COLIND(interface) (((struct starpu_csr_interface *)(interface))->colind)
  275. #define STARPU_CSR_GET_COLIND_DEV_HANDLE(interface) \
  276. (((struct starpu_csr_interface *)(interface))->colind)
  277. #define STARPU_CSR_GET_ROWPTR(interface) (((struct starpu_csr_interface *)(interface))->rowptr)
  278. #define STARPU_CSR_GET_ROWPTR_DEV_HANDLE(interface) \
  279. (((struct starpu_csr_interface *)(interface))->rowptr)
  280. #define STARPU_CSR_GET_OFFSET 0
  281. #define STARPU_CSR_GET_FIRSTENTRY(interface) (((struct starpu_csr_interface *)(interface))->firstentry)
  282. #define STARPU_CSR_GET_ELEMSIZE(interface) (((struct starpu_csr_interface *)(interface))->elemsize)
  283. extern struct starpu_data_interface_ops starpu_interface_bcsr_ops;
  284. struct starpu_bcsr_interface
  285. {
  286. enum starpu_data_interface_id id;
  287. uint32_t nnz;
  288. uint32_t nrow;
  289. uintptr_t nzval;
  290. uint32_t *colind;
  291. uint32_t *rowptr;
  292. uint32_t firstentry;
  293. uint32_t r;
  294. uint32_t c;
  295. size_t elemsize;
  296. };
  297. void starpu_bcsr_data_register(starpu_data_handle_t *handle, unsigned home_node, uint32_t nnz, uint32_t nrow, uintptr_t nzval, uint32_t *colind, uint32_t *rowptr, uint32_t firstentry, uint32_t r, uint32_t c, size_t elemsize);
  298. #define STARPU_BCSR_GET_NNZ(interface) (((struct starpu_bcsr_interface *)(interface))->nnz)
  299. #define STARPU_BCSR_GET_NZVAL(interface) (((struct starpu_bcsr_interface *)(interface))->nzval)
  300. #define STARPU_BCSR_GET_NZVAL_DEV_HANDLE(interface) \
  301. (((struct starpu_bcsr_interface *)(interface))->nnz)
  302. #define STARPU_BCSR_GET_COLIND(interface) (((struct starpu_bcsr_interface *)(interface))->colind)
  303. #define STARPU_BCSR_GET_COLIND_DEV_HANDLE(interface) \
  304. (((struct starpu_bcsr_interface *)(interface))->colind)
  305. #define STARPU_BCSR_GET_ROWPTR(interface) (((struct starpu_bcsr_interface *)(interface))->rowptr)
  306. #define STARPU_BCSR_GET_ROWPTR_DEV_HANDLE(interface) \
  307. (((struct starpu_bcsr_interface *)(interface))->rowptr)
  308. #define STARPU_BCSR_GET_OFFSET 0
  309. uint32_t starpu_bcsr_get_nnz(starpu_data_handle_t handle);
  310. uint32_t starpu_bcsr_get_nrow(starpu_data_handle_t handle);
  311. uint32_t starpu_bcsr_get_firstentry(starpu_data_handle_t handle);
  312. uintptr_t starpu_bcsr_get_local_nzval(starpu_data_handle_t handle);
  313. uint32_t *starpu_bcsr_get_local_colind(starpu_data_handle_t handle);
  314. uint32_t *starpu_bcsr_get_local_rowptr(starpu_data_handle_t handle);
  315. uint32_t starpu_bcsr_get_r(starpu_data_handle_t handle);
  316. uint32_t starpu_bcsr_get_c(starpu_data_handle_t handle);
  317. size_t starpu_bcsr_get_elemsize(starpu_data_handle_t handle);
  318. struct starpu_multiformat_data_interface_ops
  319. {
  320. size_t cpu_elemsize;
  321. size_t opencl_elemsize;
  322. struct starpu_codelet *cpu_to_opencl_cl;
  323. struct starpu_codelet *opencl_to_cpu_cl;
  324. size_t cuda_elemsize;
  325. struct starpu_codelet *cpu_to_cuda_cl;
  326. struct starpu_codelet *cuda_to_cpu_cl;
  327. size_t mic_elemsize;
  328. struct starpu_codelet *cpu_to_mic_cl;
  329. struct starpu_codelet *mic_to_cpu_cl;
  330. };
  331. struct starpu_multiformat_interface
  332. {
  333. enum starpu_data_interface_id id;
  334. void *cpu_ptr;
  335. void *cuda_ptr;
  336. void *opencl_ptr;
  337. void *mic_ptr;
  338. uint32_t nx;
  339. struct starpu_multiformat_data_interface_ops *ops;
  340. };
  341. void starpu_multiformat_data_register(starpu_data_handle_t *handle, unsigned home_node, void *ptr, uint32_t nobjects, struct starpu_multiformat_data_interface_ops *format_ops);
  342. #define STARPU_MULTIFORMAT_GET_CPU_PTR(interface) (((struct starpu_multiformat_interface *)(interface))->cpu_ptr)
  343. #define STARPU_MULTIFORMAT_GET_CUDA_PTR(interface) (((struct starpu_multiformat_interface *)(interface))->cuda_ptr)
  344. #define STARPU_MULTIFORMAT_GET_OPENCL_PTR(interface) (((struct starpu_multiformat_interface *)(interface))->opencl_ptr)
  345. #define STARPU_MULTIFORMAT_GET_MIC_PTR(interface) (((struct starpu_multiformat_interface *)(interface))->mic_ptr)
  346. #define STARPU_MULTIFORMAT_GET_NX(interface) (((struct starpu_multiformat_interface *)(interface))->nx)
  347. enum starpu_data_interface_id starpu_data_get_interface_id(starpu_data_handle_t handle);
  348. int starpu_data_pack(starpu_data_handle_t handle, void **ptr, starpu_ssize_t *count);
  349. int starpu_data_unpack(starpu_data_handle_t handle, void *ptr, size_t count);
  350. size_t starpu_data_get_size(starpu_data_handle_t handle);
  351. starpu_data_handle_t starpu_data_lookup(const void *ptr);
  352. #ifdef __cplusplus
  353. }
  354. #endif
  355. #endif /* __STARPU_DATA_INTERFACES_H__ */