data_interfaces.doxy 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807
  1. /*
  2. * This file is part of the StarPU Handbook.
  3. * Copyright (C) 2009--2011 Universit@'e de Bordeaux 1
  4. * Copyright (C) 2010, 2011, 2012, 2013 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 Data_Interfaces Data Interfaces
  9. \struct starpu_data_interface_ops
  10. \brief Per-interface data transfer methods.
  11. \ingroup Data_Interfaces
  12. \var starpu_data_interface_ops::register_data_handle
  13. Register an existing interface into a data handle.
  14. \var starpu_data_interface_ops::allocate_data_on_node
  15. Allocate data for the interface on a given node.
  16. \var starpu_data_interface_ops::free_data_on_node
  17. Free data of the interface on a given node.
  18. \var starpu_data_interface_ops::copy_methods
  19. ram/cuda/opencl synchronous and asynchronous transfer methods.
  20. \var starpu_data_interface_ops::handle_to_pointer
  21. Return the current pointer (if any) for the handle on the given node.
  22. \var starpu_data_interface_ops::get_size
  23. Return an estimation of the size of data, for performance models.
  24. \var starpu_data_interface_ops::footprint
  25. Return a 32bit footprint which characterizes the data size.
  26. \var starpu_data_interface_ops::compare
  27. Compare the data size of two interfaces.
  28. \var starpu_data_interface_ops::display
  29. Dump the sizes of a handle to a file.
  30. \var starpu_data_interface_ops::interfaceid
  31. An identifier that is unique to each interface.
  32. \var starpu_data_interface_ops::interface_size
  33. The size of the interface data descriptor.
  34. \var starpu_data_interface_ops::is_multiformat
  35. todo
  36. \var starpu_data_interface_ops::get_mf_ops
  37. todo
  38. \var starpu_data_interface_ops::pack_data
  39. Pack the data handle into a contiguous buffer at the address ptr and
  40. set the size of the newly created buffer in count. If ptr is NULL, the
  41. function should not copy the data in the buffer but just set count to
  42. the size of the buffer which would have been allocated. The special
  43. value -1 indicates the size is yet unknown.
  44. \var starpu_data_interface_ops::unpack_data
  45. Unpack the data handle from the contiguous buffer at the address ptr
  46. of size count
  47. \struct starpu_data_copy_methods
  48. \brief Defines the per-interface methods. If the any_to_any method is
  49. provided, it will be used by default if no more specific method is
  50. provided. It can still be useful to provide more specific method in
  51. case of e.g. available particular CUDA or OpenCL support.
  52. \ingroup Data_Interfaces
  53. \var starpu_data_copy_methods::ram_to_ram
  54. Define how to copy data from the src_interface interface on the
  55. src_node CPU node to the dst_interface interface on the dst_node CPU
  56. node. Return 0 on success.
  57. \var starpu_data_copy_methods::ram_to_cuda
  58. Define how to copy data from the src_interface interface on the
  59. src_node CPU node to the dst_interface interface on the dst_node CUDA
  60. node. Return 0 on success.
  61. \var starpu_data_copy_methods::ram_to_opencl
  62. Define how to copy data from the src_interface interface on the
  63. src_node CPU node to the dst_interface interface on the dst_node
  64. OpenCL node. Return 0 on success.
  65. \var starpu_data_copy_methods::cuda_to_ram
  66. Define how to copy data from the src_interface interface on the
  67. src_node CUDA node to the dst_interface interface on the dst_node
  68. CPU node. Return 0 on success.
  69. \var starpu_data_copy_methods::cuda_to_cuda
  70. Define how to copy data from the src_interface interface on the
  71. src_node CUDA node to the dst_interface interface on the dst_node CUDA
  72. node. Return 0 on success.
  73. \var starpu_data_copy_methods::cuda_to_opencl
  74. Define how to copy data from the src_interface interface on the
  75. src_node CUDA node to the dst_interface interface on the dst_node
  76. OpenCL node. Return 0 on success.
  77. \var starpu_data_copy_methods::opencl_to_ram
  78. Define how to copy data from the src_interface interface on the
  79. src_node OpenCL node to the dst_interface interface on the dst_node
  80. CPU node. Return 0 on success.
  81. \var starpu_data_copy_methods::opencl_to_cuda
  82. Define how to copy data from the src_interface interface on the
  83. src_node OpenCL node to the dst_interface interface on the dst_node
  84. CUDA node. Return 0 on success.
  85. \var starpu_data_copy_methods::opencl_to_opencl
  86. Define how to copy data from the src_interface interface on the
  87. src_node OpenCL node to the dst_interface interface on the dst_node
  88. OpenCL node. Return 0 on success.
  89. \var starpu_data_copy_methods::ram_to_cuda_async
  90. Define how to copy data from the src_interface interface on the
  91. src_node CPU node to the dst_interface interface on the dst_node CUDA
  92. node, using the given stream. Must return 0 if the transfer was
  93. actually completed completely synchronously, or -EAGAIN if at least
  94. some transfers are still ongoing and should be awaited for by the core.
  95. \var starpu_data_copy_methods::cuda_to_ram_async
  96. Define how to copy data from the src_interface interface on the
  97. src_node CUDA node to the dst_interface interface on the dst_node CPU
  98. node, using the given stream. Must return 0 if the transfer was
  99. actually completed completely synchronously, or -EAGAIN if at least
  100. some transfers are still ongoing and should be awaited for by the core.
  101. \var starpu_data_copy_methods::cuda_to_cuda_async
  102. Define how to copy data from the src_interface interface on the
  103. src_node CUDA node to the dst_interface interface on the dst_node CUDA
  104. node, using the given stream. Must return 0 if the transfer was
  105. actually completed completely synchronously, or -EAGAIN if at least
  106. some transfers are still ongoing and should be awaited for by the core.
  107. \var starpu_data_copy_methods::ram_to_opencl_async
  108. Define how to copy data from the src_interface interface on the
  109. src_node CPU node to the dst_interface interface on the dst_node
  110. OpenCL node, by recording in event, a pointer to a cl_event, the event
  111. of the last submitted transfer. Must return 0 if the transfer was
  112. actually completed completely synchronously, or -EAGAIN if at least
  113. some transfers are still ongoing and should be awaited for by the
  114. core.
  115. \var starpu_data_copy_methods::opencl_to_ram_async
  116. Define how to copy data from the src_interface interface on the
  117. src_node OpenCL node to the dst_interface interface on the dst_node
  118. CPU node, by recording in event, a pointer to a cl_event, the event of
  119. the last submitted transfer. Must return 0 if the transfer was
  120. actually completed completely synchronously, or -EAGAIN if at least
  121. some transfers are still ongoing and should be awaited for by the
  122. core.
  123. \var starpu_data_copy_methods::opencl_to_opencl_async
  124. Define how to copy data from the src_interface interface on the
  125. src_node OpenCL node to the dst_interface interface on the dst_node
  126. OpenCL node, by recording in event, a pointer to a cl_event, the event
  127. of the last submitted transfer. Must return 0 if the transfer was
  128. actually completed completely synchronously, or -EAGAIN if at least
  129. some transfers are still ongoing and should be awaited for by the
  130. core.
  131. \var starpu_data_copy_methods::any_to_any
  132. Define how to copy data from the src_interface interface on the
  133. src_node node to the dst_interface interface on the dst_node node.
  134. This is meant to be implemented through the starpu_interface_copy()
  135. helper, to which async_data should be passed as such, and will be used
  136. to manage asynchronicity. This must return -EAGAIN if any of the
  137. starpu_interface_copy() calls has returned -EAGAIN (i.e. at least some
  138. transfer is still ongoing), and return 0 otherwise.
  139. @name Registering Data
  140. \ingroup Data_Interfaces
  141. There are several ways to register a memory region so that it can be
  142. managed by StarPU. The functions below allow the registration of
  143. vectors, 2D matrices, 3D matrices as well as BCSR and CSR sparse
  144. matrices.
  145. \fn void starpu_void_data_register(starpu_data_handle_t *handle)
  146. \ingroup Data_Interfaces
  147. \brief Register a void interface. There is no data really associated
  148. to that interface, but it may be used as a synchronization mechanism.
  149. It also permits to express an abstract piece of data that is managed
  150. by the application internally: this makes it possible to forbid the
  151. concurrent execution of different tasks accessing the same <c>void</c> data
  152. in read-write concurrently.
  153. \fn void starpu_variable_data_register(starpu_data_handle_t *handle, unsigned home_node, uintptr_t ptr, size_t size)
  154. \ingroup Data_Interfaces
  155. \brief Register the \p size byte element pointed to by \p ptr, which is
  156. typically a scalar, and initialize \p handle to represent this data item.
  157. Here an example of how to use the function.
  158. \code{.c}
  159. float var;
  160. starpu_data_handle_t var_handle;
  161. starpu_variable_data_register(&var_handle, 0, (uintptr_t)&var, sizeof(var));
  162. \endcode
  163. \fn void starpu_vector_data_register(starpu_data_handle_t *handle, unsigned home_node, uintptr_t ptr, uint32_t nx, size_t elemsize)
  164. \ingroup Data_Interfaces
  165. \brief Register the \p nx elemsize-byte elements pointed to by \p ptr and initialize \p handle to represent it.
  166. Here an example of how to use the function.
  167. \code{.c}
  168. float vector[NX];
  169. starpu_data_handle_t vector_handle;
  170. starpu_vector_data_register(&vector_handle, 0, (uintptr_t)vector, NX, sizeof(vector[0]));
  171. \endcode
  172. \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)
  173. \ingroup Data_Interfaces
  174. \brief Register the \p nx x \p ny 2D matrix of \p elemsize-byte elements pointed
  175. by \p ptr and initialize \p handle to represent it. \p ld specifies the number
  176. of elements between rows. a value greater than \p nx adds padding, which
  177. can be useful for alignment purposes.
  178. Here an example of how to use the function.
  179. \code{.c}
  180. float *matrix;
  181. starpu_data_handle_t matrix_handle;
  182. matrix = (float*)malloc(width * height * sizeof(float));
  183. starpu_matrix_data_register(&matrix_handle, 0, (uintptr_t)matrix, width, width, height, sizeof(float));
  184. \endcode
  185. \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)
  186. \ingroup Data_Interfaces
  187. \brief Register the \p nx x \p ny x \p nz 3D matrix of \p elemsize byte elements
  188. pointed by \p ptr and initialize \p handle to represent it. Again, \p ldy and
  189. \p ldz specify the number of elements between rows and between z planes.
  190. Here an example of how to use the function.
  191. \code{.c}
  192. float *block;
  193. starpu_data_handle_t block_handle;
  194. block = (float*)malloc(nx*ny*nz*sizeof(float));
  195. starpu_block_data_register(&block_handle, 0, (uintptr_t)block, nx, nx*ny, nx, ny, nz, sizeof(float));
  196. \endcode
  197. \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)
  198. \ingroup Data_Interfaces
  199. \brief This variant of starpu_data_register() uses the BCSR (Blocked
  200. Compressed Sparse Row Representation) sparse matrix interface.
  201. Register the sparse matrix made of \p nnz non-zero blocks of elements of
  202. size \p elemsize stored in \p nzval and initializes \p handle to represent it.
  203. Blocks have size \p r * \p c. \p nrow is the number of rows (in terms of
  204. blocks), \p colind[i] is the block-column index for block i in \p nzval,
  205. \p rowptr[i] is the block-index (in \p nzval) of the first block of row i.
  206. \p firstentry is the index of the first entry of the given arrays
  207. (usually 0 or 1).
  208. \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)
  209. \ingroup Data_Interfaces
  210. \brief This variant of starpu_data_register() uses the CSR (Compressed
  211. Sparse Row Representation) sparse matrix interface. TODO
  212. \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);
  213. \ingroup Data_Interfaces
  214. \brief Register the \p nx x \p ny 2D matrix given in the COO format, using the
  215. \p columns, \p rows, \p values arrays, which must have \p n_values elements of
  216. size \p elemsize. Initialize \p handleptr.
  217. \fn void *starpu_data_get_interface_on_node(starpu_data_handle_t handle, unsigned memory_node)
  218. \ingroup Data_Interfaces
  219. \brief Return the interface associated with \p handle on \p memory_node.
  220. @name Accessing Data Interfaces
  221. \ingroup Data_Interfaces
  222. Each data interface is provided with a set of field access functions.
  223. The ones using a void * parameter aimed to be used in codelet
  224. implementations (see for example the code in \ref
  225. Vector_Scaling_Using_StarPU_API).
  226. \fn void *starpu_data_handle_to_pointer(starpu_data_handle_t handle, unsigned node)
  227. \ingroup Data_Interfaces
  228. \brief Return the pointer associated with \p handle on node \p node or <c>NULL</c>
  229. if handle’s interface does not support this operation or data for this
  230. \p handle is not allocated on that \p node.
  231. \fn void *starpu_data_get_local_ptr(starpu_data_handle_t handle)
  232. \ingroup Data_Interfaces
  233. \brief Return the local pointer associated with \p handle or <c>NULL</c> if
  234. \p handle’s interface does not have data allocated locally
  235. \fn enum starpu_data_interface_id starpu_data_get_interface_id(starpu_data_handle_t handle)
  236. \ingroup Data_Interfaces
  237. \brief Return the unique identifier of the interface associated with
  238. the given \p handle.
  239. \fn size_t starpu_data_get_size(starpu_data_handle_t handle)
  240. \ingroup Data_Interfaces
  241. \brief Return the size of the data associated with \p handle.
  242. \fn int starpu_data_pack(starpu_data_handle_t handle, void **ptr, starpu_ssize_t *count)
  243. \ingroup Data_Interfaces
  244. \brief Execute the packing operation of the interface of the data
  245. registered at \p handle (see starpu_data_interface_ops). This
  246. packing operation must allocate a buffer large enough at \p ptr and copy
  247. into the newly allocated buffer the data associated to \p handle. \p count
  248. will be set to the size of the allocated buffer. If \p ptr is NULL, the
  249. function should not copy the data in the buffer but just set \p count to
  250. the size of the buffer which would have been allocated. The special
  251. value -1 indicates the size is yet unknown.
  252. \fn int starpu_data_unpack(starpu_data_handle_t handle, void *ptr, size_t count)
  253. \ingroup Data_Interfaces
  254. \brief Unpack in handle the data located at \p ptr of size \p count as
  255. described by the interface of the data. The interface registered at
  256. \p handle must define a unpacking operation (see
  257. starpu_data_interface_ops). The memory at the address \p ptr is freed
  258. after calling the data unpacking operation.
  259. @name Accessing Variable Data Interfaces
  260. \ingroup Data_Interfaces
  261. \fn size_t starpu_variable_get_elemsize(starpu_data_handle_t handle)
  262. \ingroup Data_Interfaces
  263. \brief Return the size of the variable designated by \p handle.
  264. \fn uintptr_t starpu_variable_get_local_ptr(starpu_data_handle_t handle)
  265. \ingroup Data_Interfaces
  266. \brief Return a pointer to the variable designated by \p handle.
  267. \def STARPU_VARIABLE_GET_PTR(interface)
  268. \ingroup Data_Interfaces
  269. \brief Return a pointer to the variable designated by \p interface.
  270. \def STARPU_VARIABLE_GET_ELEMSIZE(interface)
  271. \ingroup Data_Interfaces
  272. \brief Return the size of the variable designated by \p interface.
  273. \def STARPU_VARIABLE_GET_DEV_HANDLE(interface)
  274. \ingroup Data_Interfaces
  275. \brief Return a device handle for the variable designated by
  276. \p interface, to be used on OpenCL. The offset documented below has to be
  277. used in addition to this.
  278. \def STARPU_VARIABLE_GET_OFFSET()
  279. \ingroup Data_Interfaces
  280. \brief Return the offset in the variable designated by \p interface, to
  281. be used with the device handle.
  282. @name Accessing Vector Data Interfaces
  283. \ingroup Data_Interfaces
  284. \fn uint32_t starpu_vector_get_nx(starpu_data_handle_t handle)
  285. \ingroup Data_Interfaces
  286. \brief Return the number of elements registered into the array designated by \p handle.
  287. \fn size_t starpu_vector_get_elemsize(starpu_data_handle_t handle)
  288. \ingroup Data_Interfaces
  289. \brief Return the size of each element of the array designated by \p handle.
  290. \fn uintptr_t starpu_vector_get_local_ptr(starpu_data_handle_t handle)
  291. \ingroup Data_Interfaces
  292. \brief Return the local pointer associated with \p handle.
  293. \def STARPU_VECTOR_GET_PTR(void *interface)
  294. \ingroup Data_Interfaces
  295. \brief Return a pointer to the array designated by \p interface, valid on
  296. CPUs and CUDA only. For OpenCL, the device handle and offset need to
  297. be used instead.
  298. \def STARPU_VECTOR_GET_DEV_HANDLE(void *interface)
  299. \ingroup Data_Interfaces
  300. \brief Return a device handle for the array designated by \p interface,
  301. to be used on OpenCL. the offset documented below has to be used in
  302. addition to this.
  303. \def STARPU_VECTOR_GET_OFFSET(void *interface)
  304. \ingroup Data_Interfaces
  305. \brief Return the offset in the array designated by \p interface, to be
  306. used with the device handle.
  307. \def STARPU_VECTOR_GET_NX(void *interface)
  308. \ingroup Data_Interfaces
  309. \brief Return the number of elements registered into the array
  310. designated by \p interface.
  311. \def STARPU_VECTOR_GET_ELEMSIZE(void *interface)
  312. \ingroup Data_Interfaces
  313. \brief Return the size of each element of the array designated by
  314. \p interface.
  315. @name Accessing Matrix Data Interfaces
  316. \ingroup Data_Interfaces
  317. \fn uint32_t starpu_matrix_get_nx(starpu_data_handle_t handle)
  318. \ingroup Data_Interfaces
  319. \brief Return the number of elements on the x-axis of the matrix
  320. designated by \p handle.
  321. \fn uint32_t starpu_matrix_get_ny(starpu_data_handle_t handle)
  322. \ingroup Data_Interfaces
  323. \brief Return the number of elements on the y-axis of the matrix
  324. designated by \p handle.
  325. \fn uint32_t starpu_matrix_get_local_ld(starpu_data_handle_t handle)
  326. \ingroup Data_Interfaces
  327. \brief Return the number of elements between each row of the matrix
  328. designated by \p handle. Maybe be equal to nx when there is no padding.
  329. \fn uintptr_t starpu_matrix_get_local_ptr(starpu_data_handle_t handle)
  330. \ingroup Data_Interfaces
  331. \brief Return the local pointer associated with \p handle.
  332. \fn size_t starpu_matrix_get_elemsize(starpu_data_handle_t handle)
  333. \ingroup Data_Interfaces
  334. \brief Return the size of the elements registered into the matrix
  335. designated by \p handle.
  336. \def STARPU_MATRIX_GET_PTR(void *interface)
  337. \ingroup Data_Interfaces
  338. \brief Return a pointer to the matrix designated by \p interface, valid
  339. on CPUs and CUDA devices only. For OpenCL devices, the device handle
  340. and offset need to be used instead.
  341. \def STARPU_MATRIX_GET_DEV_HANDLE(void *interface)
  342. \ingroup Data_Interfaces
  343. \brief Return a device handle for the matrix designated by \p interface,
  344. to be used on OpenCL. The offset documented below has to be used in
  345. addition to this.
  346. \def STARPU_MATRIX_GET_OFFSET(void *interface)
  347. \ingroup Data_Interfaces
  348. \brief Return the offset in the matrix designated by \p interface, to be
  349. used with the device handle.
  350. \def STARPU_MATRIX_GET_NX(void *interface)
  351. \ingroup Data_Interfaces
  352. \brief Return the number of elements on the x-axis of the matrix
  353. designated by \p interface.
  354. \def STARPU_MATRIX_GET_NY(void *interface)
  355. \ingroup Data_Interfaces
  356. \brief Return the number of elements on the y-axis of the matrix
  357. designated by \p interface.
  358. \def STARPU_MATRIX_GET_LD(void *interface)
  359. \ingroup Data_Interfaces
  360. \brief Return the number of elements between each row of the matrix
  361. designated by \p interface. May be equal to nx when there is no padding.
  362. \def STARPU_MATRIX_GET_ELEMSIZE(void *interface)
  363. \ingroup Data_Interfaces
  364. \brief Return the size of the elements registered into the matrix
  365. designated by \p interface.
  366. @name Accessing Block Data Interfaces
  367. \ingroup Data_Interfaces
  368. \fn uint32_t starpu_block_get_nx(starpu_data_handle_t handle)
  369. \ingroup Data_Interfaces
  370. \brief Return the number of elements on the x-axis of the block
  371. designated by \p handle.
  372. \fn uint32_t starpu_block_get_ny(starpu_data_handle_t handle)
  373. \ingroup Data_Interfaces
  374. \brief Return the number of elements on the y-axis of the block
  375. designated by \p handle.
  376. \fn uint32_t starpu_block_get_nz(starpu_data_handle_t handle)
  377. \ingroup Data_Interfaces
  378. \brief Return the number of elements on the z-axis of the block
  379. designated by \p handle.
  380. \fn uint32_t starpu_block_get_local_ldy(starpu_data_handle_t handle)
  381. \ingroup Data_Interfaces
  382. \brief Return the number of elements between each row of the block
  383. designated by \p handle, in the format of the current memory node.
  384. \fn uint32_t starpu_block_get_local_ldz(starpu_data_handle_t handle)
  385. \ingroup Data_Interfaces
  386. \brief Return the number of elements between each z plane of the block
  387. designated by \p handle, in the format of the current memory node.
  388. \fn uintptr_t starpu_block_get_local_ptr(starpu_data_handle_t handle)
  389. \ingroup Data_Interfaces
  390. \brief Return the local pointer associated with \p handle.
  391. \fn size_t starpu_block_get_elemsize(starpu_data_handle_t handle)
  392. \ingroup Data_Interfaces
  393. \brief Return the size of the elements of the block designated by
  394. \p handle.
  395. \def STARPU_BLOCK_GET_PTR(void *interface)
  396. \ingroup Data_Interfaces
  397. \brief Return a pointer to the block designated by \p interface.
  398. \def STARPU_BLOCK_GET_DEV_HANDLE(void *interface)
  399. \ingroup Data_Interfaces
  400. \brief Return a device handle for the block designated by \p interface,
  401. to be used on OpenCL. The offset document below has to be used in
  402. addition to this.
  403. \def STARPU_BLOCK_GET_OFFSET(void *interface)
  404. \ingroup Data_Interfaces
  405. \brief Return the offset in the block designated by \p interface, to be
  406. used with the device handle.
  407. \def STARPU_BLOCK_GET_NX(void *interface)
  408. \ingroup Data_Interfaces
  409. \brief Return the number of elements on the x-axis of the block
  410. designated by \p interface.
  411. \def STARPU_BLOCK_GET_NY(void *interface)
  412. \ingroup Data_Interfaces
  413. \brief Return the number of elements on the y-axis of the block
  414. designated by \p interface.
  415. \def STARPU_BLOCK_GET_NZ(void *interface)
  416. \ingroup Data_Interfaces
  417. \brief Return the number of elements on the z-axis of the block
  418. designated by \p interface.
  419. \def STARPU_BLOCK_GET_LDY(void *interface)
  420. \ingroup Data_Interfaces
  421. \brief Return the number of elements between each row of the block
  422. designated by \p interface. May be equal to nx when there is no padding.
  423. \def STARPU_BLOCK_GET_LDZ(void *interface)
  424. \ingroup Data_Interfaces
  425. \brief Return the number of elements between each z plane of the block
  426. designated by \p interface. May be equal to nx*ny when there is no
  427. padding.
  428. \def STARPU_BLOCK_GET_ELEMSIZE(void *interface)
  429. \ingroup Data_Interfaces
  430. \brief Return the size of the elements of the block designated by
  431. \p interface.
  432. @name Accessing BCSR Data Interfaces
  433. \ingroup Data_Interfaces
  434. \fn uint32_t starpu_bcsr_get_nnz(starpu_data_handle_t handle)
  435. \ingroup Data_Interfaces
  436. \brief Return the number of non-zero elements in the matrix designated
  437. by \p handle.
  438. \fn uint32_t starpu_bcsr_get_nrow(starpu_data_handle_t handle)
  439. \ingroup Data_Interfaces
  440. \brief Return the number of rows (in terms of blocks of size r*c) in
  441. the matrix designated by \p handle.
  442. \fn uint32_t starpu_bcsr_get_firstentry(starpu_data_handle_t handle)
  443. \ingroup Data_Interfaces
  444. \brief Return the index at which all arrays (the column indexes, the
  445. row pointers...) of the matrix desginated by \p handle.
  446. \fn uintptr_t starpu_bcsr_get_local_nzval(starpu_data_handle_t handle)
  447. \ingroup Data_Interfaces
  448. \brief Return a pointer to the non-zero values of the matrix
  449. designated by \p handle.
  450. \fn uint32_t * starpu_bcsr_get_local_colind(starpu_data_handle_t handle)
  451. \ingroup Data_Interfaces
  452. \brief Return a pointer to the column index, which holds the positions
  453. of the non-zero entries in the matrix designated by \p handle.
  454. \fn uint32_t * starpu_bcsr_get_local_rowptr(starpu_data_handle_t handle)
  455. \ingroup Data_Interfaces
  456. \brief Return the row pointer array of the matrix designated by
  457. \p handle.
  458. \fn uint32_t starpu_bcsr_get_r(starpu_data_handle_t handle)
  459. \ingroup Data_Interfaces
  460. \brief Return the number of rows in a block.
  461. \fn uint32_t starpu_bcsr_get_c(starpu_data_handle_t handle)
  462. \ingroup Data_Interfaces
  463. \brief Return the numberof columns in a block.
  464. \fn size_t starpu_bcsr_get_elemsize(starpu_data_handle_t handle)
  465. \ingroup Data_Interfaces
  466. \brief Return the size of the elements in the matrix designated by
  467. \p handle.
  468. \def STARPU_BCSR_GET_NNZ(void *interface)
  469. \ingroup Data_Interfaces
  470. \brief Return the number of non-zero values in the matrix designated
  471. by \p interface.
  472. \def STARPU_BCSR_GET_NZVAL(void *interface)
  473. \ingroup Data_Interfaces
  474. \brief Return a pointer to the non-zero values of the matrix
  475. designated by \p interface.
  476. \def STARPU_BCSR_GET_NZVAL_DEV_HANDLE(void *interface)
  477. \ingroup Data_Interfaces
  478. \brief Return a device handle for the array of non-zero values in the
  479. matrix designated by \p interface. The offset documented below has to be
  480. used in addition to this.
  481. \def STARPU_BCSR_GET_COLIND(void *interface)
  482. \ingroup Data_Interfaces
  483. \brief Return a pointer to the column index of the matrix designated
  484. by \p interface.
  485. \def STARPU_BCSR_GET_COLIND_DEV_HANDLE(void *interface)
  486. \ingroup Data_Interfaces
  487. \brief Return a device handle for the column index of the matrix
  488. designated by \p interface. The offset documented below has to be used in
  489. addition to this.
  490. \def STARPU_BCSR_GET_ROWPTR(void *interface)
  491. \ingroup Data_Interfaces
  492. \brief Return a pointer to the row pointer array of the matrix
  493. designated by \p interface.
  494. \def STARPU_CSR_GET_ROWPTR_DEV_HANDLE(void *interface)
  495. \ingroup Data_Interfaces
  496. \brief Return a device handle for the row pointer array of the matrix
  497. designated by \p interface. The offset documented below has to be used in
  498. addition to this.
  499. \def STARPU_BCSR_GET_OFFSET(void *interface)
  500. \ingroup Data_Interfaces
  501. \brief Return the offset in the arrays (coling, rowptr, nzval) of the
  502. matrix designated by \p interface, to be used with the device handles.
  503. @name Accessing CSR Data Interfaces
  504. \ingroup Data_Interfaces
  505. \fn uint32_t starpu_csr_get_nnz(starpu_data_handle_t handle)
  506. \ingroup Data_Interfaces
  507. \brief Return the number of non-zero values in the matrix designated
  508. by \p handle.
  509. \fn uint32_t starpu_csr_get_nrow(starpu_data_handle_t handle)
  510. \ingroup Data_Interfaces
  511. \brief Return the size of the row pointer array of the matrix
  512. designated by \p handle.
  513. \fn uint32_t starpu_csr_get_firstentry(starpu_data_handle_t handle)
  514. \ingroup Data_Interfaces
  515. \brief Return the index at which all arrays (the column indexes, the
  516. row pointers...) of the matrix designated by \p handle.
  517. \fn uintptr_t starpu_csr_get_local_nzval(starpu_data_handle_t handle)
  518. \ingroup Data_Interfaces
  519. \brief Return a local pointer to the non-zero values of the matrix
  520. designated by \p handle.
  521. \fn uint32_t * starpu_csr_get_local_colind(starpu_data_handle_t handle)
  522. \ingroup Data_Interfaces
  523. \brief Return a local pointer to the column index of the matrix
  524. designated by \p handle.
  525. \fn uint32_t * starpu_csr_get_local_rowptr(starpu_data_handle_t handle)
  526. \ingroup Data_Interfaces
  527. \brief Return a local pointer to the row pointer array of the matrix
  528. designated by \p handle.
  529. \fn size_t starpu_csr_get_elemsize(starpu_data_handle_t handle)
  530. \ingroup Data_Interfaces
  531. \brief Return the size of the elements registered into the matrix
  532. designated by \p handle.
  533. \def STARPU_CSR_GET_NNZ(void *interface)
  534. \ingroup Data_Interfaces
  535. \brief Return the number of non-zero values in the matrix designated
  536. by \p interface.
  537. \def STARPU_CSR_GET_NROW(void *interface)
  538. \ingroup Data_Interfaces
  539. \brief Return the size of the row pointer array of the matrix
  540. designated by \p interface.
  541. \def STARPU_CSR_GET_NZVAL(void *interface)
  542. \ingroup Data_Interfaces
  543. \brief Return a pointer to the non-zero values of the matrix
  544. designated by \p interface.
  545. \def STARPU_CSR_GET_NZVAL_DEV_HANDLE(void *interface)
  546. \ingroup Data_Interfaces
  547. \brief Return a device handle for the array of non-zero values in the
  548. matrix designated by \p interface. The offset documented below has to be
  549. used in addition to this.
  550. \def STARPU_CSR_GET_COLIND(void *interface)
  551. \ingroup Data_Interfaces
  552. \brief Return a pointer to the column index of the matrix designated
  553. by \p interface.
  554. \def STARPU_CSR_GET_COLIND_DEV_HANDLE(void *interface)
  555. \ingroup Data_Interfaces
  556. \brief Return a device handle for the column index of the matrix
  557. designated by \p interface. The offset documented below has to be used in
  558. addition to this.
  559. \def STARPU_CSR_GET_ROWPTR(void *interface)
  560. \ingroup Data_Interfaces
  561. \brief Return a pointer to the row pointer array of the matrix
  562. designated by \p interface.
  563. \def STARPU_CSR_GET_ROWPTR_DEV_HANDLE(void *interface)
  564. \ingroup Data_Interfaces
  565. \brief Return a device handle for the row pointer array of the matrix
  566. designated by \p interface. The offset documented below has to be used in
  567. addition to this.
  568. \def STARPU_CSR_GET_OFFSET(void *interface)
  569. \ingroup Data_Interfaces
  570. \brief Return the offset in the arrays (colind, rowptr, nzval) of the
  571. matrix designated by \p interface, to be used with the device handles.
  572. \def STARPU_CSR_GET_FIRSTENTRY(void *interface)
  573. \ingroup Data_Interfaces
  574. \brief Return the index at which all arrays (the column indexes, the
  575. row pointers...) of the \p interface start.
  576. \def STARPU_CSR_GET_ELEMSIZE(void *interface)
  577. \ingroup Data_Interfaces
  578. \brief Return the size of the elements registered into the matrix
  579. designated by \p interface.
  580. @name Accessing COO Data Interfaces
  581. \ingroup Data_Interfaces
  582. \def STARPU_COO_GET_COLUMNS(void *interface)
  583. \ingroup Data_Interfaces
  584. \brief Return a pointer to the column array of the matrix designated
  585. by \p interface.
  586. \def STARPU_COO_GET_COLUMNS_DEV_HANDLE(void *interface)
  587. \ingroup Data_Interfaces
  588. \brief Return a device handle for the column array of the matrix
  589. designated by \p interface, to be used on OpenCL. The offset documented
  590. below has to be used in addition to this.
  591. \def STARPU_COO_GET_ROWS(interface)
  592. \ingroup Data_Interfaces
  593. \brief Return a pointer to the rows array of the matrix designated by
  594. \p interface.
  595. \def STARPU_COO_GET_ROWS_DEV_HANDLE(void *interface)
  596. \ingroup Data_Interfaces
  597. \brief Return a device handle for the row array of the matrix
  598. designated by \p interface, to be used on OpenCL. The offset documented
  599. below has to be used in addition to this.
  600. \def STARPU_COO_GET_VALUES(interface)
  601. \ingroup Data_Interfaces
  602. \brief Return a pointer to the values array of the matrix designated
  603. by \p interface.
  604. \def STARPU_COO_GET_VALUES_DEV_HANDLE(void *interface)
  605. \ingroup Data_Interfaces
  606. \brief Return a device handle for the value array of the matrix
  607. designated by \p interface, to be used on OpenCL. The offset documented
  608. below has to be used in addition to this.
  609. \def STARPU_COO_GET_OFFSET(void *itnerface)
  610. \ingroup Data_Interfaces
  611. \brief Return the offset in the arrays of the COO matrix designated by
  612. \p interface.
  613. \def STARPU_COO_GET_NX(interface)
  614. \ingroup Data_Interfaces
  615. \brief Return the number of elements on the x-axis of the matrix
  616. designated by \p interface.
  617. \def STARPU_COO_GET_NY(interface)
  618. \ingroup Data_Interfaces
  619. \brief Return the number of elements on the y-axis of the matrix
  620. designated by \p interface.
  621. \def STARPU_COO_GET_NVALUES(interface)
  622. \ingroup Data_Interfaces
  623. \brief Return the number of values registered in the matrix designated
  624. by \p interface.
  625. \def STARPU_COO_GET_ELEMSIZE(interface)
  626. \ingroup Data_Interfaces
  627. \brief Return the size of the elements registered into the matrix
  628. designated by \p interface.
  629. @name Defining Interface
  630. \ingroup Data_Interfaces
  631. Applications can provide their own interface as shown in \ref
  632. Defining_a_New_Data_Interface.
  633. \fn uintptr_t starpu_malloc_on_node(unsigned dst_node, size_t size)
  634. \ingroup Data_Interfaces
  635. \brief Allocate \p size bytes on node \p dst_node. This returns 0 if
  636. allocation failed, the allocation method should then return <c>-ENOMEM</c> as
  637. allocated size.
  638. \fn void starpu_free_on_node(unsigned dst_node, uintptr_t addr, size_t size)
  639. \ingroup Data_Interfaces
  640. \brief Free \p addr of \p size bytes on node \p dst_node.
  641. \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)
  642. \ingroup Data_Interfaces
  643. \brief Copy \p size bytes from byte offset \p src_offset of \p src on \p src_node
  644. to byte offset \p dst_offset of \p dst on \p dst_node. This is to be used in
  645. the any_to_any() copy method, which is provided with the async_data to
  646. be passed to starpu_interface_copy(). this returns <c>-EAGAIN</c> if the
  647. transfer is still ongoing, or 0 if the transfer is already completed.
  648. \fn uint32_t starpu_hash_crc32c_be_n(const void *input, size_t n, uint32_t inputcrc)
  649. \ingroup Data_Interfaces
  650. \brief Compute the CRC of a byte buffer seeded by the \p inputcrc
  651. <em>current state</em>. The return value should be considered as the new
  652. <em>current state</em> for future CRC computation. This is used for computing
  653. data size footprint.
  654. \fn uint32_t starpu_hash_crc32c_be(uint32_t input, uint32_t inputcrc)
  655. \ingroup Data_Interfaces
  656. \brief Compute the CRC of a 32bit number seeded by the \p inputcrc
  657. <em>current state</em>. The return value should be considered as the new
  658. <em>current state</em> for future CRC computation. This is used for computing
  659. data size footprint.
  660. \fn uint32_t starpu_hash_crc32c_string(const char *str, uint32_t inputcrc)
  661. \ingroup Data_Interfaces
  662. \brief Compute the CRC of a string seeded by the \p inputcrc <em>current
  663. state</em>. The return value should be considered as the new <em>current
  664. state</em> for future CRC computation. This is used for computing data
  665. size footprint.
  666. \fn int starpu_data_interface_get_next_id(void)
  667. \ingroup Data_Interfaces
  668. \brief Return the next available id for a newly created data interface
  669. (\ref Defining_a_New_Data_Interface).
  670. */