data_interfaces.doxy 51 KB

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