data_interfaces.doxy 37 KB

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