data_interfaces.doxy 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060
  1. /*
  2. * This file is part of the StarPU Handbook.
  3. * Copyright (C) 2009--2011 Universit@'e de Bordeaux
  4. * Copyright (C) 2010, 2011, 2012, 2013, 2014 Centre National de la Recherche Scientifique
  5. * Copyright (C) 2011, 2012 Institut National de Recherche en Informatique et Automatique
  6. * See the file version.doxy for copying conditions.
  7. */
  8. /*! \defgroup API_Data_Interfaces Data Interfaces
  9. \struct starpu_data_interface_ops
  10. Per-interface data transfer methods.
  11. \ingroup API_Data_Interfaces
  12. \var void (*starpu_data_interface_ops::register_data_handle)(starpu_data_handle_t handle, unsigned home_node, void *data_interface)
  13. Register an existing interface into a data handle.
  14. \var starpu_ssize_t (*starpu_data_interface_ops::allocate_data_on_node)(void *data_interface, unsigned node)
  15. Allocate data for the interface on a given node.
  16. \var void (*starpu_data_interface_ops::free_data_on_node)(void *data_interface, unsigned node)
  17. Free data of the interface on a given node.
  18. \var const struct starpu_data_copy_methods *starpu_data_interface_ops::copy_methods
  19. ram/cuda/opencl synchronous and asynchronous transfer methods.
  20. \var void *(*starpu_data_interface_ops::handle_to_pointer)(starpu_data_handle_t handle, unsigned node)
  21. Return the current pointer (if any) for the handle on the given node.
  22. \var size_t (*starpu_data_interface_ops::get_size)(starpu_data_handle_t handle)
  23. Return an estimation of the size of data, for performance models.
  24. \var uint32_t (*starpu_data_interface_ops::footprint)(starpu_data_handle_t handle)
  25. Return a 32bit footprint which characterizes the data size.
  26. \var int (*starpu_data_interface_ops::compare)(void *data_interface_a, void *data_interface_b)
  27. Compare the data size of two interfaces.
  28. \var void (*starpu_data_interface_ops::display)(starpu_data_handle_t handle, FILE *f)
  29. Dump the sizes of a handle to a file.
  30. \var starpu_ssize_t (*starpu_data_interface_ops::describe)(void *data_interface, char *buf, size_t size)
  31. Describe the data into a string.
  32. \var enum starpu_data_interface_id starpu_data_interface_ops::interfaceid
  33. An identifier that is unique to each interface.
  34. \var size_t starpu_data_interface_ops::interface_size
  35. The size of the interface data descriptor.
  36. \var int starpu_data_interface_ops::is_multiformat
  37. todo
  38. \var struct starpu_multiformat_data_interface_ops* (*starpu_data_interface_ops::get_mf_ops)(void *data_interface)
  39. todo
  40. \var int (*starpu_data_interface_ops::pack_data)(starpu_data_handle_t handle, unsigned node, void **ptr, starpu_ssize_t *count)
  41. Pack the data handle into a contiguous buffer at the address allocated with
  42. starpu_malloc_flags(ptr, size, 0) (and thus returned in ptr) and
  43. set the size of the newly created buffer in count. If ptr is NULL, the
  44. function should not copy the data in the buffer but just set count to
  45. the size of the buffer which would have been allocated. The special
  46. value -1 indicates the size is yet unknown.
  47. \var int (*starpu_data_interface_ops::unpack_data) (starpu_data_handle_t handle, unsigned node, void *ptr, size_t count)
  48. Unpack the data handle from the contiguous buffer at the address ptr
  49. of size count
  50. \struct starpu_data_copy_methods
  51. Defines the per-interface methods. If the any_to_any method is
  52. provided, it will be used by default if no more specific method is
  53. provided. It can still be useful to provide more specific method in
  54. case of e.g. available particular CUDA or OpenCL support.
  55. \ingroup API_Data_Interfaces
  56. \var int (*starpu_data_copy_methods::can_copy)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node, unsigned handling_node)
  57. If defined, allows the interface to declare whether it supports transferring
  58. from \p src_interface on node \p src_node to \p dst_interface on node \p
  59. dst_node, run from node \p handling_node. If not defined, it is assumed that the
  60. interface supports all transfers.
  61. \var int (*starpu_data_copy_methods::ram_to_ram)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node)
  62. Define how to copy data from the \p src_interface interface on the \p
  63. src_node CPU node to the \p dst_interface interface on the \p dst_node
  64. CPU node. Return 0 on success.
  65. \var int (*starpu_data_copy_methods::ram_to_cuda)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node)
  66. Define how to copy data from the \p src_interface interface on the
  67. \p src_node CPU node to the \p dst_interface interface on the \p dst_node CUDA
  68. node. Return 0 on success.
  69. \var int (*starpu_data_copy_methods::ram_to_opencl)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node)
  70. Define how to copy data from the \p src_interface interface on the
  71. \p src_node CPU node to the \p dst_interface interface on the \p dst_node
  72. OpenCL node. Return 0 on success.
  73. \var int (*starpu_data_copy_methods::ram_to_mic)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node)
  74. Define how to copy data from the \p src_interface interface on the
  75. \p src_node CPU node to the \p dst_interface interface on the \p dst_node MIC
  76. node. Return 0 on success.
  77. \var int (*starpu_data_copy_methods::cuda_to_ram)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node)
  78. Define how to copy data from the \p src_interface interface on the
  79. \p src_node CUDA node to the \p dst_interface interface on the \p dst_node
  80. CPU node. Return 0 on success.
  81. \var int (*starpu_data_copy_methods::cuda_to_cuda)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node)
  82. Define how to copy data from the \p src_interface interface on the
  83. \p src_node CUDA node to the \p dst_interface interface on the \p dst_node CUDA
  84. node. Return 0 on success.
  85. \var int (*starpu_data_copy_methods::cuda_to_opencl)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node)
  86. Define how to copy data from the \p src_interface interface on the
  87. \p src_node CUDA node to the \p dst_interface interface on the \p dst_node
  88. OpenCL node. Return 0 on success.
  89. \var int (*starpu_data_copy_methods::opencl_to_ram)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node)
  90. Define how to copy data from the \p src_interface interface on the
  91. \p src_node OpenCL node to the \p dst_interface interface on the \p dst_node
  92. CPU node. Return 0 on success.
  93. \var int (*starpu_data_copy_methods::opencl_to_cuda)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node)
  94. Define how to copy data from the \p src_interface interface on the
  95. \p src_node OpenCL node to the \p dst_interface interface on the \p dst_node
  96. CUDA node. Return 0 on success.
  97. \var int (*starpu_data_copy_methods::opencl_to_opencl)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node)
  98. Define how to copy data from the \p src_interface interface on the
  99. \p src_node OpenCL node to the \p dst_interface interface on the \p dst_node
  100. OpenCL node. Return 0 on success.
  101. \var int (*starpu_data_copy_methods::mic_to_ram)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node)
  102. Define how to copy data from the \p src_interface interface on the
  103. \p src_node MIC node to the \p dst_interface interface on the \p dst_node CPU
  104. node. Return 0 on success.
  105. \var int (*starpu_data_copy_methods::scc_src_to_sink)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node)
  106. Define how to copy data from the \p src_interface interface on the
  107. \p src_node node to the \p dst_interface interface on the \p dst_node node.
  108. Must return 0 if the transfer was actually completed completely
  109. synchronously, or -EAGAIN if at least some transfers are still ongoing
  110. and should be awaited for by the core.
  111. \var int (*starpu_data_copy_methods::scc_sink_to_src)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node)
  112. Define how to copy data from the \p src_interface interface on the
  113. \p src_node node to the \p dst_interface interface on the \p dst_node node.
  114. Must return 0 if the transfer was actually completed completely
  115. synchronously, or -EAGAIN if at least some transfers are still ongoing
  116. and should be awaited for by the core.
  117. \var int (*starpu_data_copy_methods::scc_sink_to_sink)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node)
  118. Define how to copy data from the \p src_interface interface on the
  119. \p src_node node to the \p dst_interface interface on the \p dst_node node.
  120. Must return 0 if the transfer was actually completed completely
  121. synchronously, or -EAGAIN if at least some transfers are still ongoing
  122. and should be awaited for by the core.
  123. \var int (*starpu_data_copy_methods::ram_to_cuda_async)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node, cudaStream_t stream)
  124. Define how to copy data from the \p src_interface interface on the
  125. \p src_node CPU node to the \p dst_interface interface on the \p dst_node CUDA
  126. node, using the given stream. Must return 0 if the transfer was
  127. actually completed completely synchronously, or -EAGAIN if at least
  128. some transfers are still ongoing and should be awaited for by the core.
  129. \var int (*starpu_data_copy_methods::cuda_to_ram_async)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node, cudaStream_t stream)
  130. Define how to copy data from the \p src_interface interface on the
  131. \p src_node CUDA node to the \p dst_interface interface on the \p dst_node CPU
  132. node, using the given stream. Must return 0 if the transfer was
  133. actually completed completely synchronously, or -EAGAIN if at least
  134. some transfers are still ongoing and should be awaited for by the core.
  135. \var int (*starpu_data_copy_methods::cuda_to_cuda_async)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node, cudaStream_t stream)
  136. Define how to copy data from the \p src_interface interface on the
  137. \p src_node CUDA node to the \p dst_interface interface on the \p dst_node CUDA
  138. node, using the given stream. Must return 0 if the transfer was
  139. actually completed completely synchronously, or -EAGAIN if at least
  140. some transfers are still ongoing and should be awaited for by the core.
  141. \var int (*starpu_data_copy_methods::ram_to_opencl_async)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node, cl_event *event)
  142. Define how to copy data from the \p src_interface interface on the
  143. \p src_node CPU node to the \p dst_interface interface on the \p dst_node
  144. OpenCL node, by recording in event, a pointer to a cl_event, the event
  145. of the last submitted transfer. Must return 0 if the transfer was
  146. actually completed completely synchronously, or -EAGAIN if at least
  147. some transfers are still ongoing and should be awaited for by the
  148. core.
  149. \var int (*starpu_data_copy_methods::opencl_to_ram_async)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node, cl_event *event)
  150. Define how to copy data from the \p src_interface interface on the
  151. \p src_node OpenCL node to the \p dst_interface interface on the \p dst_node
  152. CPU node, by recording in event, a pointer to a cl_event, the event of
  153. the last submitted transfer. Must return 0 if the transfer was
  154. actually completed completely synchronously, or -EAGAIN if at least
  155. some transfers are still ongoing and should be awaited for by the
  156. core.
  157. \var int (*starpu_data_copy_methods::opencl_to_opencl_async)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node, cl_event *event)
  158. Define how to copy data from the \p src_interface interface on the
  159. \p src_node OpenCL node to the \p dst_interface interface on the \p dst_node
  160. OpenCL node, by recording in event, a pointer to a cl_event, the event
  161. of the last submitted transfer. Must return 0 if the transfer was
  162. actually completed completely synchronously, or -EAGAIN if at least
  163. some transfers are still ongoing and should be awaited for by the
  164. core.
  165. \var int (*starpu_data_copy_methods::ram_to_mic_async)(void *src_intreface, unsigned src_node, void *dst_interface, unsigned dst_node)
  166. Define how to copy data from the \p src_interface interface on the
  167. \p src_node CPU node to the \p dst_interface interface on the \p dst_node
  168. MIC node. Must return 0 if the transfer was actually completed
  169. completely synchronously, or -EAGAIN if at least some transfers are
  170. still ongoing and should be awaited for by the core.
  171. \var int (*starpu_data_copy_methods::mic_to_ram_async)(void *src_intreface, unsigned src_node, void *dst_interface, unsigned dst_node)
  172. Define how to copy data from the \p src_interface interface on the
  173. \p src_node MIC node to the \p dst_interface interface on the \p dst_node
  174. CPU node. Must return 0 if the transfer was actually completed
  175. completely synchronously, or -EAGAIN if at least some transfers are
  176. still ongoing and should be awaited for by the core.
  177. \var int (*starpu_data_copy_methods::any_to_any)(void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node, void *async_data)
  178. Define how to copy data from the \p src_interface interface on the
  179. \p src_node node to the \p dst_interface interface on the \p dst_node node.
  180. This is meant to be implemented through the starpu_interface_copy()
  181. helper, to which async_data should be passed as such, and will be used
  182. to manage asynchronicity. This must return -EAGAIN if any of the
  183. starpu_interface_copy() calls has returned -EAGAIN (i.e. at least some
  184. transfer is still ongoing), and return 0 otherwise.
  185. \enum starpu_data_interface_id
  186. \ingroup API_Data_Interfaces
  187. Identifier for all predefined StarPU data interfaces
  188. \var starpu_data_interface_id::STARPU_UNKNOWN_INTERFACE_ID
  189. Unknown interface
  190. \var starpu_data_interface_id::STARPU_MATRIX_INTERFACE_ID
  191. Identifier for the matrix data interface
  192. \var starpu_data_interface_id::STARPU_BLOCK_INTERFACE_ID
  193. Identifier for block data interface
  194. \var starpu_data_interface_id::STARPU_VECTOR_INTERFACE_ID
  195. Identifier for the vector data interface
  196. \var starpu_data_interface_id::STARPU_CSR_INTERFACE_ID
  197. Identifier for the csr data interface
  198. \var starpu_data_interface_id::STARPU_BCSR_INTERFACE_ID
  199. Identifier for the bcsr data interface
  200. \var starpu_data_interface_id::STARPU_VARIABLE_INTERFACE_ID
  201. Identifier for the variable data interface
  202. \var starpu_data_interface_id::STARPU_VOID_INTERFACE_ID
  203. Identifier for the void data interface
  204. \var starpu_data_interface_id::STARPU_MULTIFORMAT_INTERFACE_ID
  205. Identifier for the multiformat data interface
  206. \var starpu_data_interface_id::STARPU_COO_INTERFACE_ID
  207. Identifier for the coo data interface
  208. \var starpu_data_interface_id::STARPU_MAX_INTERFACE_ID
  209. Maximum number of data interfaces
  210. @name Registering Data
  211. \ingroup API_Data_Interfaces
  212. There are several ways to register a memory region so that it can be
  213. managed by StarPU. The functions below allow the registration of
  214. vectors, 2D matrices, 3D matrices as well as BCSR and CSR sparse
  215. matrices.
  216. \fn void starpu_void_data_register(starpu_data_handle_t *handle)
  217. \ingroup API_Data_Interfaces
  218. Register a void interface. There is no data really associated
  219. to that interface, but it may be used as a synchronization mechanism.
  220. It also permits to express an abstract piece of data that is managed
  221. by the application internally: this makes it possible to forbid the
  222. concurrent execution of different tasks accessing the same <c>void</c> data
  223. in read-write concurrently.
  224. \fn void starpu_variable_data_register(starpu_data_handle_t *handle, unsigned home_node, uintptr_t ptr, size_t size)
  225. \ingroup API_Data_Interfaces
  226. Register the \p size byte element pointed to by \p ptr, which is
  227. typically a scalar, and initialize \p handle to represent this data item.
  228. Here an example of how to use the function.
  229. \code{.c}
  230. float var;
  231. starpu_data_handle_t var_handle;
  232. starpu_variable_data_register(&var_handle, STARPU_MAIN_RAM, (uintptr_t)&var, sizeof(var));
  233. \endcode
  234. \fn void starpu_variable_ptr_register(starpu_data_handle_t handle, unsigned node, uintptr_t ptr, uintptr_t dev_handle, size_t offset)
  235. \ingroup API_Data_Interfaces
  236. Register into the \p handle that to store data on node \p node it should use the
  237. buffer located at \p ptr, or device handle \p dev_handle and offset \p offset
  238. (for OpenCL, notably)
  239. \fn void starpu_vector_data_register(starpu_data_handle_t *handle, unsigned home_node, uintptr_t ptr, uint32_t nx, size_t elemsize)
  240. \ingroup API_Data_Interfaces
  241. Register the \p nx elemsize-byte elements pointed to by \p ptr and initialize \p handle to represent it.
  242. Here an example of how to use the function.
  243. \code{.c}
  244. float vector[NX];
  245. starpu_data_handle_t vector_handle;
  246. starpu_vector_data_register(&vector_handle, STARPU_MAIN_RAM, (uintptr_t)vector, NX, sizeof(vector[0]));
  247. \endcode
  248. \fn void starpu_vector_ptr_register(starpu_data_handle_t handle, unsigned node, uintptr_t ptr, uintptr_t dev_handle, size_t offset)
  249. \ingroup API_Data_Interfaces
  250. Register into the \p handle that to store data on node \p node it should use the
  251. buffer located at \p ptr, or device handle \p dev_handle and offset \p offset
  252. (for OpenCL, notably)
  253. \fn 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)
  254. \ingroup API_Data_Interfaces
  255. Register the \p nx x \p ny 2D matrix of \p elemsize-byte elements pointed
  256. by \p ptr and initialize \p handle to represent it. \p ld specifies the number
  257. of elements between rows. a value greater than \p nx adds padding, which
  258. can be useful for alignment purposes.
  259. Here an example of how to use the function.
  260. \code{.c}
  261. float *matrix;
  262. starpu_data_handle_t matrix_handle;
  263. matrix = (float*)malloc(width * height * sizeof(float));
  264. starpu_matrix_data_register(&matrix_handle, STARPU_MAIN_RAM, (uintptr_t)matrix, width, width, height, sizeof(float));
  265. \endcode
  266. \fn 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)
  267. \ingroup API_Data_Interfaces
  268. Register into the \p handle that to store data on node \p node it should use the
  269. buffer located at \p ptr, or device handle \p dev_handle and offset \p offset
  270. (for OpenCL, notably), with \p ld elements between rows.
  271. \fn 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)
  272. \ingroup API_Data_Interfaces
  273. Register the \p nx x \p ny x \p nz 3D matrix of \p elemsize byte elements
  274. pointed by \p ptr and initialize \p handle to represent it. Again, \p ldy and
  275. \p ldz specify the number of elements between rows and between z planes.
  276. Here an example of how to use the function.
  277. \code{.c}
  278. float *block;
  279. starpu_data_handle_t block_handle;
  280. block = (float*)malloc(nx*ny*nz*sizeof(float));
  281. starpu_block_data_register(&block_handle, STARPU_MAIN_RAM, (uintptr_t)block, nx, nx*ny, nx, ny, nz, sizeof(float));
  282. \endcode
  283. \fn 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)
  284. \ingroup API_Data_Interfaces
  285. Register into the \p handle that to store data on node \p node it should use the
  286. buffer located at \p ptr, or device handle \p dev_handle and offset \p offset
  287. (for OpenCL, notably), with \p ldy elements between rows and \p ldz elements between z planes.
  288. \fn 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)
  289. \ingroup API_Data_Interfaces
  290. This variant of starpu_data_register() uses the BCSR (Blocked
  291. Compressed Sparse Row Representation) sparse matrix interface.
  292. Register the sparse matrix made of \p nnz non-zero blocks of elements of
  293. size \p elemsize stored in \p nzval and initializes \p handle to represent it.
  294. Blocks have size \p r * \p c. \p nrow is the number of rows (in terms of
  295. blocks), \p colind[i] is the block-column index for block i in \p nzval,
  296. \p rowptr[i] is the block-index (in \p nzval) of the first block of row i.
  297. \p firstentry is the index of the first entry of the given arrays
  298. (usually 0 or 1).
  299. \fn 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)
  300. \ingroup API_Data_Interfaces
  301. This variant of starpu_data_register() uses the CSR (Compressed
  302. Sparse Row Representation) sparse matrix interface. TODO
  303. \fn 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);
  304. \ingroup API_Data_Interfaces
  305. Register the \p nx x \p ny 2D matrix given in the COO format, using the
  306. \p columns, \p rows, \p values arrays, which must have \p n_values elements of
  307. size \p elemsize. Initialize \p handleptr.
  308. \fn void *starpu_data_get_interface_on_node(starpu_data_handle_t handle, unsigned memory_node)
  309. \ingroup API_Data_Interfaces
  310. Return the interface associated with \p handle on \p memory_node.
  311. @name Accessing Data Interfaces
  312. \ingroup API_Data_Interfaces
  313. Each data interface is provided with a set of field access functions.
  314. The ones using a void * parameter aimed to be used in codelet
  315. implementations (see for example the code in \ref
  316. VectorScalingUsingStarPUAPI).
  317. \fn void *starpu_data_handle_to_pointer(starpu_data_handle_t handle, unsigned node)
  318. \ingroup API_Data_Interfaces
  319. Return the pointer associated with \p handle on node \p node or <c>NULL</c>
  320. if handle’s interface does not support this operation or data for this
  321. \p handle is not allocated on that \p node.
  322. \fn void *starpu_data_get_local_ptr(starpu_data_handle_t handle)
  323. \ingroup API_Data_Interfaces
  324. Return the local pointer associated with \p handle or <c>NULL</c> if
  325. \p handle’s interface does not have data allocated locally
  326. \fn enum starpu_data_interface_id starpu_data_get_interface_id(starpu_data_handle_t handle)
  327. \ingroup API_Data_Interfaces
  328. Return the unique identifier of the interface associated with
  329. the given \p handle.
  330. \fn size_t starpu_data_get_size(starpu_data_handle_t handle)
  331. \ingroup API_Data_Interfaces
  332. Return the size of the data associated with \p handle.
  333. \fn int starpu_data_pack(starpu_data_handle_t handle, void **ptr, starpu_ssize_t *count)
  334. \ingroup API_Data_Interfaces
  335. Execute the packing operation of the interface of the data
  336. registered at \p handle (see starpu_data_interface_ops). This
  337. packing operation must allocate a buffer large enough at \p ptr and copy
  338. into the newly allocated buffer the data associated to \p handle. \p count
  339. will be set to the size of the allocated buffer. If \p ptr is NULL, the
  340. function should not copy the data in the buffer but just set \p count to
  341. the size of the buffer which would have been allocated. The special
  342. value -1 indicates the size is yet unknown.
  343. \fn int starpu_data_unpack(starpu_data_handle_t handle, void *ptr, size_t count)
  344. \ingroup API_Data_Interfaces
  345. Unpack in handle the data located at \p ptr of size \p count as
  346. described by the interface of the data. The interface registered at
  347. \p handle must define a unpacking operation (see
  348. starpu_data_interface_ops). The memory at the address \p ptr is freed
  349. after calling the data unpacking operation.
  350. @name Accessing Variable Data Interfaces
  351. \ingroup API_Data_Interfaces
  352. \struct starpu_variable_interface
  353. Variable interface for a single data (not a vector, a matrix, a list, ...)
  354. \ingroup API_Data_Interfaces
  355. \var enum starpu_data_interface_id starpu_variable_interface::id
  356. Identifier of the interface
  357. \var uintptr_t starpu_variable_interface::ptr
  358. local pointer of the variable
  359. \var uintptr_t starpu_variable_interface::dev_handle
  360. device handle of the variable.
  361. \var size_t starpu_variable_interface::offset
  362. offset in the variable
  363. \var size_t starpu_variable_interface::elemsize
  364. size of the variable
  365. \fn size_t starpu_variable_get_elemsize(starpu_data_handle_t handle)
  366. \ingroup API_Data_Interfaces
  367. Return the size of the variable designated by \p handle.
  368. \fn uintptr_t starpu_variable_get_local_ptr(starpu_data_handle_t handle)
  369. \ingroup API_Data_Interfaces
  370. Return a pointer to the variable designated by \p handle.
  371. \def STARPU_VARIABLE_GET_PTR(interface)
  372. \ingroup API_Data_Interfaces
  373. Return a pointer to the variable designated by \p interface.
  374. \def STARPU_VARIABLE_GET_ELEMSIZE(interface)
  375. \ingroup API_Data_Interfaces
  376. Return the size of the variable designated by \p interface.
  377. \def STARPU_VARIABLE_GET_DEV_HANDLE(interface)
  378. \ingroup API_Data_Interfaces
  379. Return a device handle for the variable designated by
  380. \p interface, to be used on OpenCL. The offset documented below has to be
  381. used in addition to this.
  382. \def STARPU_VARIABLE_GET_OFFSET(interface)
  383. \ingroup API_Data_Interfaces
  384. Return the offset in the variable designated by \p interface, to
  385. be used with the device handle.
  386. @name Accessing Vector Data Interfaces
  387. \ingroup API_Data_Interfaces
  388. \struct starpu_vector_interface
  389. Vector interface
  390. \ingroup API_Data_Interfaces
  391. \var enum starpu_data_interface_id starpu_vector_interface::id
  392. Identifier of the interface
  393. \var uintptr_t starpu_vector_interface::ptr
  394. local pointer of the vector
  395. \var uintptr_t starpu_vector_interface::dev_handle
  396. device handle of the vector.
  397. \var size_t starpu_vector_interface::offset
  398. offset in the vector
  399. \var uint32_t starpu_vector_interface::nx
  400. number of elements on the x-axis of the vector
  401. \var size_t starpu_vector_interface::elemsize
  402. size of the elements of the vector
  403. \var uint32_t starpu_vector_interface::slice_base
  404. vector slice base, used by the StarPU OpenMP runtime support
  405. \fn uint32_t starpu_vector_get_nx(starpu_data_handle_t handle)
  406. \ingroup API_Data_Interfaces
  407. Return the number of elements registered into the array designated by \p handle.
  408. \fn size_t starpu_vector_get_elemsize(starpu_data_handle_t handle)
  409. \ingroup API_Data_Interfaces
  410. Return the size of each element of the array designated by \p handle.
  411. \fn uintptr_t starpu_vector_get_local_ptr(starpu_data_handle_t handle)
  412. \ingroup API_Data_Interfaces
  413. Return the local pointer associated with \p handle.
  414. \def STARPU_VECTOR_GET_PTR(interface)
  415. \ingroup API_Data_Interfaces
  416. Return a pointer to the array designated by \p interface, valid on
  417. CPUs and CUDA only. For OpenCL, the device handle and offset need to
  418. be used instead.
  419. \def STARPU_VECTOR_GET_DEV_HANDLE(interface)
  420. \ingroup API_Data_Interfaces
  421. Return a device handle for the array designated by \p interface,
  422. to be used on OpenCL. the offset documented below has to be used in
  423. addition to this.
  424. \def STARPU_VECTOR_GET_OFFSET(interface)
  425. \ingroup API_Data_Interfaces
  426. Return the offset in the array designated by \p interface, to be
  427. used with the device handle.
  428. \def STARPU_VECTOR_GET_NX(interface)
  429. \ingroup API_Data_Interfaces
  430. Return the number of elements registered into the array
  431. designated by \p interface.
  432. \def STARPU_VECTOR_GET_ELEMSIZE(interface)
  433. \ingroup API_Data_Interfaces
  434. Return the size of each element of the array designated by
  435. \p interface.
  436. \def STARPU_VECTOR_GET_SLICE_BASE(interface)
  437. \ingroup API_Data_Interfaces
  438. Return the OpenMP slice base annotation of each element of the array designated by
  439. \p interface.
  440. \sa starpu_omp_vector_annotate
  441. @name Accessing Matrix Data Interfaces
  442. \ingroup API_Data_Interfaces
  443. \struct starpu_matrix_interface
  444. Matrix interface for dense matrices
  445. \ingroup API_Data_Interfaces
  446. \var enum starpu_data_interface_id starpu_matrix_interface::id
  447. Identifier of the interface
  448. \var uintptr_t starpu_matrix_interface::ptr
  449. local pointer of the matrix
  450. \var uintptr_t starpu_matrix_interface::dev_handle
  451. device handle of the matrix.
  452. \var size_t starpu_matrix_interface::offset
  453. offset in the matrix
  454. \var uint32_t starpu_matrix_interface::nx
  455. number of elements on the x-axis of the matrix
  456. \var uint32_t starpu_matrix_interface::ny
  457. number of elements on the y-axis of the matrix
  458. \var uint32_t starpu_matrix_interface::ld
  459. number of elements between each row of the matrix. Maybe be equal to
  460. starpu_matrix_interface::nx when there is no padding.
  461. \var size_t starpu_matrix_interface::elemsize
  462. size of the elements of the matrix
  463. \fn uint32_t starpu_matrix_get_nx(starpu_data_handle_t handle)
  464. \ingroup API_Data_Interfaces
  465. Return the number of elements on the x-axis of the matrix
  466. designated by \p handle.
  467. \fn uint32_t starpu_matrix_get_ny(starpu_data_handle_t handle)
  468. \ingroup API_Data_Interfaces
  469. Return the number of elements on the y-axis of the matrix
  470. designated by \p handle.
  471. \fn uint32_t starpu_matrix_get_local_ld(starpu_data_handle_t handle)
  472. \ingroup API_Data_Interfaces
  473. Return the number of elements between each row of the matrix
  474. designated by \p handle. Maybe be equal to nx when there is no padding.
  475. \fn uintptr_t starpu_matrix_get_local_ptr(starpu_data_handle_t handle)
  476. \ingroup API_Data_Interfaces
  477. Return the local pointer associated with \p handle.
  478. \fn size_t starpu_matrix_get_elemsize(starpu_data_handle_t handle)
  479. \ingroup API_Data_Interfaces
  480. Return the size of the elements registered into the matrix
  481. designated by \p handle.
  482. \def STARPU_MATRIX_GET_PTR(interface)
  483. \ingroup API_Data_Interfaces
  484. Return a pointer to the matrix designated by \p interface, valid
  485. on CPUs and CUDA devices only. For OpenCL devices, the device handle
  486. and offset need to be used instead.
  487. \def STARPU_MATRIX_GET_DEV_HANDLE(interface)
  488. \ingroup API_Data_Interfaces
  489. Return a device handle for the matrix designated by \p interface,
  490. to be used on OpenCL. The offset documented below has to be used in
  491. addition to this.
  492. \def STARPU_MATRIX_GET_OFFSET(interface)
  493. \ingroup API_Data_Interfaces
  494. Return the offset in the matrix designated by \p interface, to be
  495. used with the device handle.
  496. \def STARPU_MATRIX_GET_NX(interface)
  497. \ingroup API_Data_Interfaces
  498. Return the number of elements on the x-axis of the matrix
  499. designated by \p interface.
  500. \def STARPU_MATRIX_GET_NY(interface)
  501. \ingroup API_Data_Interfaces
  502. Return the number of elements on the y-axis of the matrix
  503. designated by \p interface.
  504. \def STARPU_MATRIX_GET_LD(interface)
  505. \ingroup API_Data_Interfaces
  506. Return the number of elements between each row of the matrix
  507. designated by \p interface. May be equal to nx when there is no padding.
  508. \def STARPU_MATRIX_GET_ELEMSIZE(interface)
  509. \ingroup API_Data_Interfaces
  510. Return the size of the elements registered into the matrix
  511. designated by \p interface.
  512. @name Accessing Block Data Interfaces
  513. \ingroup API_Data_Interfaces
  514. \struct starpu_block_interface
  515. Block interface for 3D dense blocks
  516. \ingroup API_Data_Interfaces
  517. \var enum starpu_data_interface_id starpu_block_interface::id
  518. identifier of the interface
  519. \var uintptr_t starpu_block_interface::ptr
  520. local pointer of the block
  521. \var uintptr_t starpu_block_interface::dev_handle
  522. device handle of the block.
  523. \var size_t starpu_block_interface::offset
  524. offset in the block.
  525. \var uint32_t starpu_block_interface::nx
  526. number of elements on the x-axis of the block.
  527. \var uint32_t starpu_block_interface::ny
  528. number of elements on the y-axis of the block.
  529. \var uint32_t starpu_block_interface::nz
  530. number of elements on the z-axis of the block.
  531. \var uint32_t starpu_block_interface::ldy
  532. number of elements between two lines
  533. \var uint32_t starpu_block_interface::ldz
  534. number of elements between two planes
  535. \var size_t starpu_block_interface::elemsize
  536. size of the elements of the block.
  537. \fn uint32_t starpu_block_get_nx(starpu_data_handle_t handle)
  538. \ingroup API_Data_Interfaces
  539. Return the number of elements on the x-axis of the block
  540. designated by \p handle.
  541. \fn uint32_t starpu_block_get_ny(starpu_data_handle_t handle)
  542. \ingroup API_Data_Interfaces
  543. Return the number of elements on the y-axis of the block
  544. designated by \p handle.
  545. \fn uint32_t starpu_block_get_nz(starpu_data_handle_t handle)
  546. \ingroup API_Data_Interfaces
  547. Return the number of elements on the z-axis of the block
  548. designated by \p handle.
  549. \fn uint32_t starpu_block_get_local_ldy(starpu_data_handle_t handle)
  550. \ingroup API_Data_Interfaces
  551. Return the number of elements between each row of the block
  552. designated by \p handle, in the format of the current memory node.
  553. \fn uint32_t starpu_block_get_local_ldz(starpu_data_handle_t handle)
  554. \ingroup API_Data_Interfaces
  555. Return the number of elements between each z plane of the block
  556. designated by \p handle, in the format of the current memory node.
  557. \fn uintptr_t starpu_block_get_local_ptr(starpu_data_handle_t handle)
  558. \ingroup API_Data_Interfaces
  559. Return the local pointer associated with \p handle.
  560. \fn size_t starpu_block_get_elemsize(starpu_data_handle_t handle)
  561. \ingroup API_Data_Interfaces
  562. Return the size of the elements of the block designated by
  563. \p handle.
  564. \def STARPU_BLOCK_GET_PTR(interface)
  565. \ingroup API_Data_Interfaces
  566. Return a pointer to the block designated by \p interface.
  567. \def STARPU_BLOCK_GET_DEV_HANDLE(interface)
  568. \ingroup API_Data_Interfaces
  569. Return a device handle for the block designated by \p interface,
  570. to be used on OpenCL. The offset document below has to be used in
  571. addition to this.
  572. \def STARPU_BLOCK_GET_OFFSET(interface)
  573. \ingroup API_Data_Interfaces
  574. Return the offset in the block designated by \p interface, to be
  575. used with the device handle.
  576. \def STARPU_BLOCK_GET_NX(interface)
  577. \ingroup API_Data_Interfaces
  578. Return the number of elements on the x-axis of the block
  579. designated by \p interface.
  580. \def STARPU_BLOCK_GET_NY(interface)
  581. \ingroup API_Data_Interfaces
  582. Return the number of elements on the y-axis of the block
  583. designated by \p interface.
  584. \def STARPU_BLOCK_GET_NZ(interface)
  585. \ingroup API_Data_Interfaces
  586. Return the number of elements on the z-axis of the block
  587. designated by \p interface.
  588. \def STARPU_BLOCK_GET_LDY(interface)
  589. \ingroup API_Data_Interfaces
  590. Return the number of elements between each row of the block
  591. designated by \p interface. May be equal to nx when there is no padding.
  592. \def STARPU_BLOCK_GET_LDZ(interface)
  593. \ingroup API_Data_Interfaces
  594. Return the number of elements between each z plane of the block
  595. designated by \p interface. May be equal to nx*ny when there is no
  596. padding.
  597. \def STARPU_BLOCK_GET_ELEMSIZE(interface)
  598. \ingroup API_Data_Interfaces
  599. Return the size of the elements of the block designated by
  600. \p interface.
  601. @name Accessing BCSR Data Interfaces
  602. \ingroup API_Data_Interfaces
  603. \struct starpu_bcsr_interface
  604. BCSR interface for sparse matrices (blocked compressed sparse
  605. row representation)
  606. \ingroup API_Data_Interfaces
  607. \var enum starpu_data_interface_id starpu_bcsr_interface::id
  608. Identifier of the interface
  609. \var uint32_t starpu_bcsr_interface::nnz
  610. number of non-zero BLOCKS
  611. \var uint32_t starpu_bcsr_interface::nrow
  612. number of rows (in terms of BLOCKS)
  613. \var uintptr_t starpu_bcsr_interface::nzval
  614. non-zero values
  615. \var uint32_t *starpu_bcsr_interface::colind
  616. position of non-zero entried on the row
  617. \var uint32_t *starpu_bcsr_interface::rowptr
  618. index (in nzval) of the first entry of the row
  619. \var starpu_bcsr_interface::firstentry
  620. k for k-based indexing (0 or 1 usually). Also useful when partitionning the matrix.
  621. \var uint32_t starpu_bcsr_interface::r
  622. size of the blocks
  623. \var uint32_t starpu_bcsr_interface::c
  624. size of the blocks
  625. \var size_t starpu_bcsr_interface::elemsize;
  626. size of the elements of the matrix
  627. \fn uint32_t starpu_bcsr_get_nnz(starpu_data_handle_t handle)
  628. \ingroup API_Data_Interfaces
  629. Return the number of non-zero elements in the matrix designated
  630. by \p handle.
  631. \fn uint32_t starpu_bcsr_get_nrow(starpu_data_handle_t handle)
  632. \ingroup API_Data_Interfaces
  633. Return the number of rows (in terms of blocks of size r*c) in
  634. the matrix designated by \p handle.
  635. \fn uint32_t starpu_bcsr_get_firstentry(starpu_data_handle_t handle)
  636. \ingroup API_Data_Interfaces
  637. Return the index at which all arrays (the column indexes, the
  638. row pointers...) of the matrix desginated by \p handle.
  639. \fn uintptr_t starpu_bcsr_get_local_nzval(starpu_data_handle_t handle)
  640. \ingroup API_Data_Interfaces
  641. Return a pointer to the non-zero values of the matrix
  642. designated by \p handle.
  643. \fn uint32_t *starpu_bcsr_get_local_colind(starpu_data_handle_t handle)
  644. \ingroup API_Data_Interfaces
  645. Return a pointer to the column index, which holds the positions
  646. of the non-zero entries in the matrix designated by \p handle.
  647. \fn uint32_t *starpu_bcsr_get_local_rowptr(starpu_data_handle_t handle)
  648. \ingroup API_Data_Interfaces
  649. Return the row pointer array of the matrix designated by
  650. \p handle.
  651. \fn uint32_t starpu_bcsr_get_r(starpu_data_handle_t handle)
  652. \ingroup API_Data_Interfaces
  653. Return the number of rows in a block.
  654. \fn uint32_t starpu_bcsr_get_c(starpu_data_handle_t handle)
  655. \ingroup API_Data_Interfaces
  656. Return the numberof columns in a block.
  657. \fn size_t starpu_bcsr_get_elemsize(starpu_data_handle_t handle)
  658. \ingroup API_Data_Interfaces
  659. Return the size of the elements in the matrix designated by
  660. \p handle.
  661. \def STARPU_BCSR_GET_NNZ(interface)
  662. \ingroup API_Data_Interfaces
  663. Return the number of non-zero values in the matrix designated
  664. by \p interface.
  665. \def STARPU_BCSR_GET_NZVAL(interface)
  666. \ingroup API_Data_Interfaces
  667. Return a pointer to the non-zero values of the matrix
  668. designated by \p interface.
  669. \def STARPU_BCSR_GET_NZVAL_DEV_HANDLE(interface)
  670. \ingroup API_Data_Interfaces
  671. Return a device handle for the array of non-zero values in the
  672. matrix designated by \p interface. The offset documented below has to be
  673. used in addition to this.
  674. \def STARPU_BCSR_GET_COLIND(interface)
  675. \ingroup API_Data_Interfaces
  676. Return a pointer to the column index of the matrix designated
  677. by \p interface.
  678. \def STARPU_BCSR_GET_COLIND_DEV_HANDLE(interface)
  679. \ingroup API_Data_Interfaces
  680. Return a device handle for the column index of the matrix
  681. designated by \p interface. The offset documented below has to be used in
  682. addition to this.
  683. \def STARPU_BCSR_GET_ROWPTR(interface)
  684. \ingroup API_Data_Interfaces
  685. Return a pointer to the row pointer array of the matrix
  686. designated by \p interface.
  687. \def STARPU_BCSR_GET_ROWPTR_DEV_HANDLE(interface)
  688. \ingroup API_Data_Interfaces
  689. Return a device handle for the row pointer array of the matrix
  690. designated by \p interface. The offset documented below has to be used in
  691. addition to this.
  692. \def STARPU_BCSR_GET_OFFSET
  693. \ingroup API_Data_Interfaces
  694. Return the offset in the arrays (coling, rowptr, nzval) of the
  695. matrix designated by \p interface, to be used with the device handles.
  696. @name Accessing CSR Data Interfaces
  697. \ingroup API_Data_Interfaces
  698. \struct starpu_csr_interface
  699. CSR interface for sparse matrices (compressed sparse row representation)
  700. \ingroup API_Data_Interfaces
  701. \var enum starpu_data_interface_id starpu_csr_interface::id
  702. Identifier of the interface
  703. \var uint32_t starpu_csr_interface::nnz
  704. number of non-zero entries
  705. \var uint32_t starpu_csr_interface::nrow
  706. number of rows
  707. \var uintptr_t starpu_csr_interface::nzval
  708. non-zero values
  709. \var uint32_t *starpu_csr_interface::colind
  710. position of non-zero entries on the row
  711. \var uint32_t *starpu_csr_interface::rowptr
  712. index (in nzval) of the first entry of the row
  713. \var uint32_t starpu_csr_interface::firstentry
  714. k for k-based indexing (0 or 1 usually). also useful when partitionning the matrix.
  715. \var size_t starpu_csr_interface::elemsize
  716. size of the elements of the matrix
  717. \fn uint32_t starpu_csr_get_nnz(starpu_data_handle_t handle)
  718. \ingroup API_Data_Interfaces
  719. Return the number of non-zero values in the matrix designated
  720. by \p handle.
  721. \fn uint32_t starpu_csr_get_nrow(starpu_data_handle_t handle)
  722. \ingroup API_Data_Interfaces
  723. Return the size of the row pointer array of the matrix
  724. designated by \p handle.
  725. \fn uint32_t starpu_csr_get_firstentry(starpu_data_handle_t handle)
  726. \ingroup API_Data_Interfaces
  727. Return the index at which all arrays (the column indexes, the
  728. row pointers...) of the matrix designated by \p handle.
  729. \fn uintptr_t starpu_csr_get_local_nzval(starpu_data_handle_t handle)
  730. \ingroup API_Data_Interfaces
  731. Return a local pointer to the non-zero values of the matrix
  732. designated by \p handle.
  733. \fn uint32_t *starpu_csr_get_local_colind(starpu_data_handle_t handle)
  734. \ingroup API_Data_Interfaces
  735. Return a local pointer to the column index of the matrix
  736. designated by \p handle.
  737. \fn uint32_t *starpu_csr_get_local_rowptr(starpu_data_handle_t handle)
  738. \ingroup API_Data_Interfaces
  739. Return a local pointer to the row pointer array of the matrix
  740. designated by \p handle.
  741. \fn size_t starpu_csr_get_elemsize(starpu_data_handle_t handle)
  742. \ingroup API_Data_Interfaces
  743. Return the size of the elements registered into the matrix
  744. designated by \p handle.
  745. \def STARPU_CSR_GET_NNZ(interface)
  746. \ingroup API_Data_Interfaces
  747. Return the number of non-zero values in the matrix designated
  748. by \p interface.
  749. \def STARPU_CSR_GET_NROW(interface)
  750. \ingroup API_Data_Interfaces
  751. Return the size of the row pointer array of the matrix
  752. designated by \p interface.
  753. \def STARPU_CSR_GET_NZVAL(interface)
  754. \ingroup API_Data_Interfaces
  755. Return a pointer to the non-zero values of the matrix
  756. designated by \p interface.
  757. \def STARPU_CSR_GET_NZVAL_DEV_HANDLE(interface)
  758. \ingroup API_Data_Interfaces
  759. Return a device handle for the array of non-zero values in the
  760. matrix designated by \p interface. The offset documented below has to be
  761. used in addition to this.
  762. \def STARPU_CSR_GET_COLIND(interface)
  763. \ingroup API_Data_Interfaces
  764. Return a pointer to the column index of the matrix designated
  765. by \p interface.
  766. \def STARPU_CSR_GET_COLIND_DEV_HANDLE(interface)
  767. \ingroup API_Data_Interfaces
  768. Return a device handle for the column index of the matrix
  769. designated by \p interface. The offset documented below has to be used in
  770. addition to this.
  771. \def STARPU_CSR_GET_ROWPTR(interface)
  772. \ingroup API_Data_Interfaces
  773. Return a pointer to the row pointer array of the matrix
  774. designated by \p interface.
  775. \def STARPU_CSR_GET_ROWPTR_DEV_HANDLE(interface)
  776. \ingroup API_Data_Interfaces
  777. Return a device handle for the row pointer array of the matrix
  778. designated by \p interface. The offset documented below has to be used in
  779. addition to this.
  780. \def STARPU_CSR_GET_OFFSET
  781. \ingroup API_Data_Interfaces
  782. Return the offset in the arrays (colind, rowptr, nzval) of the
  783. matrix designated by \p interface, to be used with the device handles.
  784. \def STARPU_CSR_GET_FIRSTENTRY(interface)
  785. \ingroup API_Data_Interfaces
  786. Return the index at which all arrays (the column indexes, the
  787. row pointers...) of the \p interface start.
  788. \def STARPU_CSR_GET_ELEMSIZE(interface)
  789. \ingroup API_Data_Interfaces
  790. Return the size of the elements registered into the matrix
  791. designated by \p interface.
  792. @name Accessing COO Data Interfaces
  793. \ingroup API_Data_Interfaces
  794. \struct starpu_coo_interface
  795. COO Matrices
  796. \ingroup API_Data_Interfaces
  797. \var enum starpu_data_interface_id starpu_coo_interface::id
  798. identifier of the interface
  799. \var uint32_t *starpu_coo_interface::columns
  800. column array of the matrix
  801. \var uint32_t *starpu_coo_interface::rows
  802. row array of the matrix
  803. \var uintptr_t starpu_coo_interface::values
  804. values of the matrix
  805. \var uint32_t starpu_coo_interface::nx
  806. number of elements on the x-axis of the matrix
  807. \var uint32_t starpu_coo_interface::ny
  808. number of elements on the y-axis of the matrix
  809. \var uint32_t starpu_coo_interface::n_values
  810. number of values registered in the matrix
  811. \var size_t starpu_coo_interface::elemsize
  812. size of the elements of the matrix
  813. \def STARPU_COO_GET_COLUMNS(interface)
  814. \ingroup API_Data_Interfaces
  815. Return a pointer to the column array of the matrix designated
  816. by \p interface.
  817. \def STARPU_COO_GET_COLUMNS_DEV_HANDLE(interface)
  818. \ingroup API_Data_Interfaces
  819. Return a device handle for the column array of the matrix
  820. designated by \p interface, to be used on OpenCL. The offset documented
  821. below has to be used in addition to this.
  822. \def STARPU_COO_GET_ROWS(interface)
  823. \ingroup API_Data_Interfaces
  824. Return a pointer to the rows array of the matrix designated by
  825. \p interface.
  826. \def STARPU_COO_GET_ROWS_DEV_HANDLE(interface)
  827. \ingroup API_Data_Interfaces
  828. Return a device handle for the row array of the matrix
  829. designated by \p interface, to be used on OpenCL. The offset documented
  830. below has to be used in addition to this.
  831. \def STARPU_COO_GET_VALUES(interface)
  832. \ingroup API_Data_Interfaces
  833. Return a pointer to the values array of the matrix designated
  834. by \p interface.
  835. \def STARPU_COO_GET_VALUES_DEV_HANDLE(interface)
  836. \ingroup API_Data_Interfaces
  837. Return a device handle for the value array of the matrix
  838. designated by \p interface, to be used on OpenCL. The offset documented
  839. below has to be used in addition to this.
  840. \def STARPU_COO_GET_OFFSET
  841. \ingroup API_Data_Interfaces
  842. Return the offset in the arrays of the COO matrix designated by
  843. \p interface.
  844. \def STARPU_COO_GET_NX(interface)
  845. \ingroup API_Data_Interfaces
  846. Return the number of elements on the x-axis of the matrix
  847. designated by \p interface.
  848. \def STARPU_COO_GET_NY(interface)
  849. \ingroup API_Data_Interfaces
  850. Return the number of elements on the y-axis of the matrix
  851. designated by \p interface.
  852. \def STARPU_COO_GET_NVALUES(interface)
  853. \ingroup API_Data_Interfaces
  854. Return the number of values registered in the matrix designated
  855. by \p interface.
  856. \def STARPU_COO_GET_ELEMSIZE(interface)
  857. \ingroup API_Data_Interfaces
  858. Return the size of the elements registered into the matrix
  859. designated by \p interface.
  860. @name Defining Interface
  861. \ingroup API_Data_Interfaces
  862. Applications can provide their own interface as shown in \ref
  863. DefiningANewDataInterface.
  864. \fn uintptr_t starpu_malloc_on_node(unsigned dst_node, size_t size)
  865. \ingroup API_Data_Interfaces
  866. Allocate \p size bytes on node \p dst_node. This returns 0 if
  867. allocation failed, the allocation method should then return <c>-ENOMEM</c> as
  868. allocated size. Deallocation must be done with starpu_free_on_node.
  869. \fn void starpu_free_on_node(unsigned dst_node, uintptr_t addr, size_t size)
  870. \ingroup API_Data_Interfaces
  871. Free \p addr of \p size bytes on node \p dst_node which was previously allocated
  872. with starpu_malloc_on_node.
  873. \fn 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)
  874. \ingroup API_Data_Interfaces
  875. Copy \p size bytes from byte offset \p src_offset of \p src on \p src_node
  876. to byte offset \p dst_offset of \p dst on \p dst_node. This is to be used in
  877. the any_to_any() copy method, which is provided with the async_data to
  878. be passed to starpu_interface_copy(). this returns <c>-EAGAIN</c> if the
  879. transfer is still ongoing, or 0 if the transfer is already completed.
  880. \fn uint32_t starpu_hash_crc32c_be_n(const void *input, size_t n, uint32_t inputcrc)
  881. \ingroup API_Data_Interfaces
  882. Compute the CRC of a byte buffer seeded by the \p inputcrc
  883. <em>current state</em>. The return value should be considered as the new
  884. <em>current state</em> for future CRC computation. This is used for computing
  885. data size footprint.
  886. \fn uint32_t starpu_hash_crc32c_be(uint32_t input, uint32_t inputcrc)
  887. \ingroup API_Data_Interfaces
  888. Compute the CRC of a 32bit number seeded by the \p inputcrc
  889. <em>current state</em>. The return value should be considered as the new
  890. <em>current state</em> for future CRC computation. This is used for computing
  891. data size footprint.
  892. \fn uint32_t starpu_hash_crc32c_string(const char *str, uint32_t inputcrc)
  893. \ingroup API_Data_Interfaces
  894. Compute the CRC of a string seeded by the \p inputcrc <em>current
  895. state</em>. The return value should be considered as the new <em>current
  896. state</em> for future CRC computation. This is used for computing data
  897. size footprint.
  898. \fn int starpu_data_interface_get_next_id(void)
  899. \ingroup API_Data_Interfaces
  900. Return the next available id for a newly created data interface
  901. (\ref DefiningANewDataInterface).
  902. */