data_interfaces.doxy 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946
  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 API_Data_Interfaces Data Interfaces
  9. \struct starpu_data_interface_ops
  10. Per-interface data transfer methods.
  11. \ingroup API_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. 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 API_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 API_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 API_Data_Interfaces
  147. 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 API_Data_Interfaces
  155. 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 API_Data_Interfaces
  165. 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 API_Data_Interfaces
  174. 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 API_Data_Interfaces
  187. 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 API_Data_Interfaces
  199. 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 API_Data_Interfaces
  210. 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 API_Data_Interfaces
  214. 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 API_Data_Interfaces
  219. Return the interface associated with \p handle on \p memory_node.
  220. @name Accessing Data Interfaces
  221. \ingroup API_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 API_Data_Interfaces
  228. 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 API_Data_Interfaces
  233. 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 API_Data_Interfaces
  237. 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 API_Data_Interfaces
  241. 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 API_Data_Interfaces
  244. 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 API_Data_Interfaces
  254. 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 API_Data_Interfaces
  261. \struct starpu_variable_interface
  262. Variable interface for a single data (not a vector, a matrix, a list, ...)
  263. \ingroup API_Data_Interfaces
  264. \var starpu_variable_interface::id
  265. Identifier of the interface
  266. \var starpu_variable_interface::ptr
  267. local pointer of the variable
  268. \var starpu_variable_interface::dev_handle
  269. device handle of the variable.
  270. \var starpu_variable_interface::offset
  271. offset in the variable
  272. \var starpu_variable_interface::elemsize
  273. size of the variable
  274. \fn size_t starpu_variable_get_elemsize(starpu_data_handle_t handle)
  275. \ingroup API_Data_Interfaces
  276. Return the size of the variable designated by \p handle.
  277. \fn uintptr_t starpu_variable_get_local_ptr(starpu_data_handle_t handle)
  278. \ingroup API_Data_Interfaces
  279. Return a pointer to the variable designated by \p handle.
  280. \def STARPU_VARIABLE_GET_PTR(interface)
  281. \ingroup API_Data_Interfaces
  282. Return a pointer to the variable designated by \p interface.
  283. \def STARPU_VARIABLE_GET_ELEMSIZE(interface)
  284. \ingroup API_Data_Interfaces
  285. Return the size of the variable designated by \p interface.
  286. \def STARPU_VARIABLE_GET_DEV_HANDLE(interface)
  287. \ingroup API_Data_Interfaces
  288. Return a device handle for the variable designated by
  289. \p interface, to be used on OpenCL. The offset documented below has to be
  290. used in addition to this.
  291. \def STARPU_VARIABLE_GET_OFFSET()
  292. \ingroup API_Data_Interfaces
  293. Return the offset in the variable designated by \p interface, to
  294. be used with the device handle.
  295. @name Accessing Vector Data Interfaces
  296. \ingroup API_Data_Interfaces
  297. \struct starpu_vector_interface
  298. Vector interface
  299. \ingroup API_Data_Interfaces
  300. \var starpu_vector_interface::id
  301. Identifier of the interface
  302. \var starpu_vector_interface::ptr
  303. local pointer of the vector
  304. \var starpu_vector_interface::dev_handle
  305. device handle of the vector.
  306. \var starpu_vector_interface::offset
  307. offset in the vector
  308. \var starpu_vector_interface::nx
  309. number of elements on the x-axis of the vector
  310. \var starpu_vector_interface::elemsize
  311. size of the elements of the vector
  312. \fn uint32_t starpu_vector_get_nx(starpu_data_handle_t handle)
  313. \ingroup API_Data_Interfaces
  314. Return the number of elements registered into the array designated by \p handle.
  315. \fn size_t starpu_vector_get_elemsize(starpu_data_handle_t handle)
  316. \ingroup API_Data_Interfaces
  317. Return the size of each element of the array designated by \p handle.
  318. \fn uintptr_t starpu_vector_get_local_ptr(starpu_data_handle_t handle)
  319. \ingroup API_Data_Interfaces
  320. Return the local pointer associated with \p handle.
  321. \def STARPU_VECTOR_GET_PTR(void *interface)
  322. \ingroup API_Data_Interfaces
  323. Return a pointer to the array designated by \p interface, valid on
  324. CPUs and CUDA only. For OpenCL, the device handle and offset need to
  325. be used instead.
  326. \def STARPU_VECTOR_GET_DEV_HANDLE(void *interface)
  327. \ingroup API_Data_Interfaces
  328. Return a device handle for the array designated by \p interface,
  329. to be used on OpenCL. the offset documented below has to be used in
  330. addition to this.
  331. \def STARPU_VECTOR_GET_OFFSET(void *interface)
  332. \ingroup API_Data_Interfaces
  333. Return the offset in the array designated by \p interface, to be
  334. used with the device handle.
  335. \def STARPU_VECTOR_GET_NX(void *interface)
  336. \ingroup API_Data_Interfaces
  337. Return the number of elements registered into the array
  338. designated by \p interface.
  339. \def STARPU_VECTOR_GET_ELEMSIZE(void *interface)
  340. \ingroup API_Data_Interfaces
  341. Return the size of each element of the array designated by
  342. \p interface.
  343. @name Accessing Matrix Data Interfaces
  344. \ingroup API_Data_Interfaces
  345. \struct starpu_matrix_interface
  346. Matrix interface for dense matrices
  347. \ingroup API_Data_Interfaces
  348. \var starpu_matrix_interface::id
  349. Identifier of the interface
  350. \var starpu_matrix_interface::ptr
  351. local pointer of the matrix
  352. \var starpu_matrix_interface::dev_handle
  353. device handle of the matrix.
  354. \var starpu_matrix_interface::offset
  355. offset in the matrix
  356. \var starpu_matrix_interface::nx
  357. number of elements on the x-axis of the matrix
  358. \var starpu_matrix_interface::ny
  359. number of elements on the y-axis of the matrix
  360. \var starpu_matrix_interface::ld
  361. number of elements between each row of the matrix. Maybe be equal to
  362. starpu_matrix_interface::nx when there is no padding.
  363. \var starpu_matrix_interface::elemsize
  364. size of the elements of the matrix
  365. \fn uint32_t starpu_matrix_get_nx(starpu_data_handle_t handle)
  366. \ingroup API_Data_Interfaces
  367. Return the number of elements on the x-axis of the matrix
  368. designated by \p handle.
  369. \fn uint32_t starpu_matrix_get_ny(starpu_data_handle_t handle)
  370. \ingroup API_Data_Interfaces
  371. Return the number of elements on the y-axis of the matrix
  372. designated by \p handle.
  373. \fn uint32_t starpu_matrix_get_local_ld(starpu_data_handle_t handle)
  374. \ingroup API_Data_Interfaces
  375. Return the number of elements between each row of the matrix
  376. designated by \p handle. Maybe be equal to nx when there is no padding.
  377. \fn uintptr_t starpu_matrix_get_local_ptr(starpu_data_handle_t handle)
  378. \ingroup API_Data_Interfaces
  379. Return the local pointer associated with \p handle.
  380. \fn size_t starpu_matrix_get_elemsize(starpu_data_handle_t handle)
  381. \ingroup API_Data_Interfaces
  382. Return the size of the elements registered into the matrix
  383. designated by \p handle.
  384. \def STARPU_MATRIX_GET_PTR(void *interface)
  385. \ingroup API_Data_Interfaces
  386. Return a pointer to the matrix designated by \p interface, valid
  387. on CPUs and CUDA devices only. For OpenCL devices, the device handle
  388. and offset need to be used instead.
  389. \def STARPU_MATRIX_GET_DEV_HANDLE(void *interface)
  390. \ingroup API_Data_Interfaces
  391. Return a device handle for the matrix designated by \p interface,
  392. to be used on OpenCL. The offset documented below has to be used in
  393. addition to this.
  394. \def STARPU_MATRIX_GET_OFFSET(void *interface)
  395. \ingroup API_Data_Interfaces
  396. Return the offset in the matrix designated by \p interface, to be
  397. used with the device handle.
  398. \def STARPU_MATRIX_GET_NX(void *interface)
  399. \ingroup API_Data_Interfaces
  400. Return the number of elements on the x-axis of the matrix
  401. designated by \p interface.
  402. \def STARPU_MATRIX_GET_NY(void *interface)
  403. \ingroup API_Data_Interfaces
  404. Return the number of elements on the y-axis of the matrix
  405. designated by \p interface.
  406. \def STARPU_MATRIX_GET_LD(void *interface)
  407. \ingroup API_Data_Interfaces
  408. Return the number of elements between each row of the matrix
  409. designated by \p interface. May be equal to nx when there is no padding.
  410. \def STARPU_MATRIX_GET_ELEMSIZE(void *interface)
  411. \ingroup API_Data_Interfaces
  412. Return the size of the elements registered into the matrix
  413. designated by \p interface.
  414. @name Accessing Block Data Interfaces
  415. \ingroup API_Data_Interfaces
  416. \struct starpu_block_interface
  417. Block interface for 3D dense blocks
  418. \ingroup API_Data_Interfaces
  419. \struct starpu_block_interface::id
  420. identifier of the interface
  421. \var starpu_block_interface::ptr
  422. local pointer of the block
  423. \var starpu_block_interface::dev_handle
  424. device handle of the block.
  425. \var starpu_block_interface::offset
  426. offset in the block.
  427. \var starpu_block_interface::nx
  428. number of elements on the x-axis of the block.
  429. \var starpu_block_interface::ny
  430. number of elements on the y-axis of the block.
  431. \var starpu_block_interface::nz
  432. number of elements on the z-axis of the block.
  433. \var starpu_block_interface::ldy
  434. number of elements between two lines
  435. \var starpu_block_interface::ldz
  436. number of elements between two planes
  437. \var starpu_block_interface::elemsize
  438. size of the elements of the block.
  439. \fn uint32_t starpu_block_get_nx(starpu_data_handle_t handle)
  440. \ingroup API_Data_Interfaces
  441. Return the number of elements on the x-axis of the block
  442. designated by \p handle.
  443. \fn uint32_t starpu_block_get_ny(starpu_data_handle_t handle)
  444. \ingroup API_Data_Interfaces
  445. Return the number of elements on the y-axis of the block
  446. designated by \p handle.
  447. \fn uint32_t starpu_block_get_nz(starpu_data_handle_t handle)
  448. \ingroup API_Data_Interfaces
  449. Return the number of elements on the z-axis of the block
  450. designated by \p handle.
  451. \fn uint32_t starpu_block_get_local_ldy(starpu_data_handle_t handle)
  452. \ingroup API_Data_Interfaces
  453. Return the number of elements between each row of the block
  454. designated by \p handle, in the format of the current memory node.
  455. \fn uint32_t starpu_block_get_local_ldz(starpu_data_handle_t handle)
  456. \ingroup API_Data_Interfaces
  457. Return the number of elements between each z plane of the block
  458. designated by \p handle, in the format of the current memory node.
  459. \fn uintptr_t starpu_block_get_local_ptr(starpu_data_handle_t handle)
  460. \ingroup API_Data_Interfaces
  461. Return the local pointer associated with \p handle.
  462. \fn size_t starpu_block_get_elemsize(starpu_data_handle_t handle)
  463. \ingroup API_Data_Interfaces
  464. Return the size of the elements of the block designated by
  465. \p handle.
  466. \def STARPU_BLOCK_GET_PTR(void *interface)
  467. \ingroup API_Data_Interfaces
  468. Return a pointer to the block designated by \p interface.
  469. \def STARPU_BLOCK_GET_DEV_HANDLE(void *interface)
  470. \ingroup API_Data_Interfaces
  471. Return a device handle for the block designated by \p interface,
  472. to be used on OpenCL. The offset document below has to be used in
  473. addition to this.
  474. \def STARPU_BLOCK_GET_OFFSET(void *interface)
  475. \ingroup API_Data_Interfaces
  476. Return the offset in the block designated by \p interface, to be
  477. used with the device handle.
  478. \def STARPU_BLOCK_GET_NX(void *interface)
  479. \ingroup API_Data_Interfaces
  480. Return the number of elements on the x-axis of the block
  481. designated by \p interface.
  482. \def STARPU_BLOCK_GET_NY(void *interface)
  483. \ingroup API_Data_Interfaces
  484. Return the number of elements on the y-axis of the block
  485. designated by \p interface.
  486. \def STARPU_BLOCK_GET_NZ(void *interface)
  487. \ingroup API_Data_Interfaces
  488. Return the number of elements on the z-axis of the block
  489. designated by \p interface.
  490. \def STARPU_BLOCK_GET_LDY(void *interface)
  491. \ingroup API_Data_Interfaces
  492. Return the number of elements between each row of the block
  493. designated by \p interface. May be equal to nx when there is no padding.
  494. \def STARPU_BLOCK_GET_LDZ(void *interface)
  495. \ingroup API_Data_Interfaces
  496. Return the number of elements between each z plane of the block
  497. designated by \p interface. May be equal to nx*ny when there is no
  498. padding.
  499. \def STARPU_BLOCK_GET_ELEMSIZE(void *interface)
  500. \ingroup API_Data_Interfaces
  501. Return the size of the elements of the block designated by
  502. \p interface.
  503. @name Accessing BCSR Data Interfaces
  504. \ingroup API_Data_Interfaces
  505. \struct starpu_bcsr_interface
  506. BCSR interface for sparse matrices (blocked compressed sparse
  507. row representation)
  508. \ingroup API_Data_Interfaces
  509. \var starpu_bcsr_interface::id
  510. Identifier of the interface
  511. \var starpu_bcsr_interface::nnz
  512. number of non-zero BLOCKS
  513. \var starpu_bcsr_interface::nrow
  514. number of rows (in terms of BLOCKS)
  515. \var starpu_bcsr_interface::nzval
  516. non-zero values
  517. \var starpu_bcsr_interface::colind
  518. position of non-zero entried on the row
  519. \var starpu_bcsr_interface::rowptr
  520. index (in nzval) of the first entry of the row
  521. \var starpu_bcsr_interface::firstentry
  522. k for k-based indexing (0 or 1 usually). Also useful when partitionning the matrix.
  523. \var starpu_bcsr_interface::r
  524. size of the blocks
  525. \var starpu_bcsr_interface::c
  526. size of the blocks
  527. \var starpu_bcsr_interface::elemsize;
  528. size of the elements of the matrix
  529. \fn uint32_t starpu_bcsr_get_nnz(starpu_data_handle_t handle)
  530. \ingroup API_Data_Interfaces
  531. Return the number of non-zero elements in the matrix designated
  532. by \p handle.
  533. \fn uint32_t starpu_bcsr_get_nrow(starpu_data_handle_t handle)
  534. \ingroup API_Data_Interfaces
  535. Return the number of rows (in terms of blocks of size r*c) in
  536. the matrix designated by \p handle.
  537. \fn uint32_t starpu_bcsr_get_firstentry(starpu_data_handle_t handle)
  538. \ingroup API_Data_Interfaces
  539. Return the index at which all arrays (the column indexes, the
  540. row pointers...) of the matrix desginated by \p handle.
  541. \fn uintptr_t starpu_bcsr_get_local_nzval(starpu_data_handle_t handle)
  542. \ingroup API_Data_Interfaces
  543. Return a pointer to the non-zero values of the matrix
  544. designated by \p handle.
  545. \fn uint32_t * starpu_bcsr_get_local_colind(starpu_data_handle_t handle)
  546. \ingroup API_Data_Interfaces
  547. Return a pointer to the column index, which holds the positions
  548. of the non-zero entries in the matrix designated by \p handle.
  549. \fn uint32_t * starpu_bcsr_get_local_rowptr(starpu_data_handle_t handle)
  550. \ingroup API_Data_Interfaces
  551. Return the row pointer array of the matrix designated by
  552. \p handle.
  553. \fn uint32_t starpu_bcsr_get_r(starpu_data_handle_t handle)
  554. \ingroup API_Data_Interfaces
  555. Return the number of rows in a block.
  556. \fn uint32_t starpu_bcsr_get_c(starpu_data_handle_t handle)
  557. \ingroup API_Data_Interfaces
  558. Return the numberof columns in a block.
  559. \fn size_t starpu_bcsr_get_elemsize(starpu_data_handle_t handle)
  560. \ingroup API_Data_Interfaces
  561. Return the size of the elements in the matrix designated by
  562. \p handle.
  563. \def STARPU_BCSR_GET_NNZ(void *interface)
  564. \ingroup API_Data_Interfaces
  565. Return the number of non-zero values in the matrix designated
  566. by \p interface.
  567. \def STARPU_BCSR_GET_NZVAL(void *interface)
  568. \ingroup API_Data_Interfaces
  569. Return a pointer to the non-zero values of the matrix
  570. designated by \p interface.
  571. \def STARPU_BCSR_GET_NZVAL_DEV_HANDLE(void *interface)
  572. \ingroup API_Data_Interfaces
  573. Return a device handle for the array of non-zero values in the
  574. matrix designated by \p interface. The offset documented below has to be
  575. used in addition to this.
  576. \def STARPU_BCSR_GET_COLIND(void *interface)
  577. \ingroup API_Data_Interfaces
  578. Return a pointer to the column index of the matrix designated
  579. by \p interface.
  580. \def STARPU_BCSR_GET_COLIND_DEV_HANDLE(void *interface)
  581. \ingroup API_Data_Interfaces
  582. Return a device handle for the column index of the matrix
  583. designated by \p interface. The offset documented below has to be used in
  584. addition to this.
  585. \def STARPU_BCSR_GET_ROWPTR(void *interface)
  586. \ingroup API_Data_Interfaces
  587. Return a pointer to the row pointer array of the matrix
  588. designated by \p interface.
  589. \def STARPU_CSR_GET_ROWPTR_DEV_HANDLE(void *interface)
  590. \ingroup API_Data_Interfaces
  591. Return a device handle for the row pointer array of the matrix
  592. designated by \p interface. The offset documented below has to be used in
  593. addition to this.
  594. \def STARPU_BCSR_GET_OFFSET(void *interface)
  595. \ingroup API_Data_Interfaces
  596. Return the offset in the arrays (coling, rowptr, nzval) of the
  597. matrix designated by \p interface, to be used with the device handles.
  598. @name Accessing CSR Data Interfaces
  599. \ingroup API_Data_Interfaces
  600. \struct starpu_csr_interface
  601. CSR interface for sparse matrices (compressed sparse row representation)
  602. \ingroup API_Data_Interfaces
  603. \var starpu_csr_interface::id
  604. Identifier of the interface
  605. \var starpu_csr_interface::nnz
  606. number of non-zero entries
  607. \var starpu_csr_interface::nrow
  608. number of rows
  609. \var starpu_csr_interface::nzval
  610. non-zero values
  611. \var starpu_csr_interface::colind
  612. position of non-zero entries on the row
  613. \var starpu_csr_interface::rowptr
  614. index (in nzval) of the first entry of the row
  615. \var starpu_csr_interface::firstentry
  616. k for k-based indexing (0 or 1 usually). also useful when partitionning the matrix.
  617. \var starpu_csr_interface::elemsize
  618. size of the elements of the matrix
  619. \fn uint32_t starpu_csr_get_nnz(starpu_data_handle_t handle)
  620. \ingroup API_Data_Interfaces
  621. Return the number of non-zero values in the matrix designated
  622. by \p handle.
  623. \fn uint32_t starpu_csr_get_nrow(starpu_data_handle_t handle)
  624. \ingroup API_Data_Interfaces
  625. Return the size of the row pointer array of the matrix
  626. designated by \p handle.
  627. \fn uint32_t starpu_csr_get_firstentry(starpu_data_handle_t handle)
  628. \ingroup API_Data_Interfaces
  629. Return the index at which all arrays (the column indexes, the
  630. row pointers...) of the matrix designated by \p handle.
  631. \fn uintptr_t starpu_csr_get_local_nzval(starpu_data_handle_t handle)
  632. \ingroup API_Data_Interfaces
  633. Return a local pointer to the non-zero values of the matrix
  634. designated by \p handle.
  635. \fn uint32_t * starpu_csr_get_local_colind(starpu_data_handle_t handle)
  636. \ingroup API_Data_Interfaces
  637. Return a local pointer to the column index of the matrix
  638. designated by \p handle.
  639. \fn uint32_t * starpu_csr_get_local_rowptr(starpu_data_handle_t handle)
  640. \ingroup API_Data_Interfaces
  641. Return a local pointer to the row pointer array of the matrix
  642. designated by \p handle.
  643. \fn size_t starpu_csr_get_elemsize(starpu_data_handle_t handle)
  644. \ingroup API_Data_Interfaces
  645. Return the size of the elements registered into the matrix
  646. designated by \p handle.
  647. \def STARPU_CSR_GET_NNZ(void *interface)
  648. \ingroup API_Data_Interfaces
  649. Return the number of non-zero values in the matrix designated
  650. by \p interface.
  651. \def STARPU_CSR_GET_NROW(void *interface)
  652. \ingroup API_Data_Interfaces
  653. Return the size of the row pointer array of the matrix
  654. designated by \p interface.
  655. \def STARPU_CSR_GET_NZVAL(void *interface)
  656. \ingroup API_Data_Interfaces
  657. Return a pointer to the non-zero values of the matrix
  658. designated by \p interface.
  659. \def STARPU_CSR_GET_NZVAL_DEV_HANDLE(void *interface)
  660. \ingroup API_Data_Interfaces
  661. Return a device handle for the array of non-zero values in the
  662. matrix designated by \p interface. The offset documented below has to be
  663. used in addition to this.
  664. \def STARPU_CSR_GET_COLIND(void *interface)
  665. \ingroup API_Data_Interfaces
  666. Return a pointer to the column index of the matrix designated
  667. by \p interface.
  668. \def STARPU_CSR_GET_COLIND_DEV_HANDLE(void *interface)
  669. \ingroup API_Data_Interfaces
  670. Return a device handle for the column index of the matrix
  671. designated by \p interface. The offset documented below has to be used in
  672. addition to this.
  673. \def STARPU_CSR_GET_ROWPTR(void *interface)
  674. \ingroup API_Data_Interfaces
  675. Return a pointer to the row pointer array of the matrix
  676. designated by \p interface.
  677. \def STARPU_CSR_GET_ROWPTR_DEV_HANDLE(void *interface)
  678. \ingroup API_Data_Interfaces
  679. Return a device handle for the row pointer array of the matrix
  680. designated by \p interface. The offset documented below has to be used in
  681. addition to this.
  682. \def STARPU_CSR_GET_OFFSET(void *interface)
  683. \ingroup API_Data_Interfaces
  684. Return the offset in the arrays (colind, rowptr, nzval) of the
  685. matrix designated by \p interface, to be used with the device handles.
  686. \def STARPU_CSR_GET_FIRSTENTRY(void *interface)
  687. \ingroup API_Data_Interfaces
  688. Return the index at which all arrays (the column indexes, the
  689. row pointers...) of the \p interface start.
  690. \def STARPU_CSR_GET_ELEMSIZE(void *interface)
  691. \ingroup API_Data_Interfaces
  692. Return the size of the elements registered into the matrix
  693. designated by \p interface.
  694. @name Accessing COO Data Interfaces
  695. \ingroup API_Data_Interfaces
  696. \struct starpu_coo_interface
  697. COO Matrices
  698. \ingroup API_Data_Interfaces
  699. \var starpu_coo_interface::id
  700. identifier of the interface
  701. \var starpu_coo_interface::columns
  702. column array of the matrix
  703. \var starpu_coo_interface::rows
  704. row array of the matrix
  705. \var starpu_coo_interface::values
  706. values of the matrix
  707. \var starpu_coo_interface::nx
  708. number of elements on the x-axis of the matrix
  709. \var starpu_coo_interface::ny
  710. number of elements on the y-axis of the matrix
  711. \var starpu_coo_interface::n_values
  712. number of values registered in the matrix
  713. \var starpu_coo_interface::elemsize
  714. size of the elements of the matrix
  715. \def STARPU_COO_GET_COLUMNS(void *interface)
  716. \ingroup API_Data_Interfaces
  717. Return a pointer to the column array of the matrix designated
  718. by \p interface.
  719. \def STARPU_COO_GET_COLUMNS_DEV_HANDLE(void *interface)
  720. \ingroup API_Data_Interfaces
  721. Return a device handle for the column array of the matrix
  722. designated by \p interface, to be used on OpenCL. The offset documented
  723. below has to be used in addition to this.
  724. \def STARPU_COO_GET_ROWS(interface)
  725. \ingroup API_Data_Interfaces
  726. Return a pointer to the rows array of the matrix designated by
  727. \p interface.
  728. \def STARPU_COO_GET_ROWS_DEV_HANDLE(void *interface)
  729. \ingroup API_Data_Interfaces
  730. Return a device handle for the row array of the matrix
  731. designated by \p interface, to be used on OpenCL. The offset documented
  732. below has to be used in addition to this.
  733. \def STARPU_COO_GET_VALUES(interface)
  734. \ingroup API_Data_Interfaces
  735. Return a pointer to the values array of the matrix designated
  736. by \p interface.
  737. \def STARPU_COO_GET_VALUES_DEV_HANDLE(void *interface)
  738. \ingroup API_Data_Interfaces
  739. Return a device handle for the value array of the matrix
  740. designated by \p interface, to be used on OpenCL. The offset documented
  741. below has to be used in addition to this.
  742. \def STARPU_COO_GET_OFFSET(void *interface)
  743. \ingroup API_Data_Interfaces
  744. Return the offset in the arrays of the COO matrix designated by
  745. \p interface.
  746. \def STARPU_COO_GET_NX(interface)
  747. \ingroup API_Data_Interfaces
  748. Return the number of elements on the x-axis of the matrix
  749. designated by \p interface.
  750. \def STARPU_COO_GET_NY(interface)
  751. \ingroup API_Data_Interfaces
  752. Return the number of elements on the y-axis of the matrix
  753. designated by \p interface.
  754. \def STARPU_COO_GET_NVALUES(interface)
  755. \ingroup API_Data_Interfaces
  756. Return the number of values registered in the matrix designated
  757. by \p interface.
  758. \def STARPU_COO_GET_ELEMSIZE(interface)
  759. \ingroup API_Data_Interfaces
  760. Return the size of the elements registered into the matrix
  761. designated by \p interface.
  762. @name Defining Interface
  763. \ingroup API_Data_Interfaces
  764. Applications can provide their own interface as shown in \ref
  765. Defining_a_New_Data_Interface.
  766. \fn uintptr_t starpu_malloc_on_node(unsigned dst_node, size_t size)
  767. \ingroup API_Data_Interfaces
  768. Allocate \p size bytes on node \p dst_node. This returns 0 if
  769. allocation failed, the allocation method should then return <c>-ENOMEM</c> as
  770. allocated size.
  771. \fn void starpu_free_on_node(unsigned dst_node, uintptr_t addr, size_t size)
  772. \ingroup API_Data_Interfaces
  773. Free \p addr of \p size bytes on node \p dst_node.
  774. \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)
  775. \ingroup API_Data_Interfaces
  776. Copy \p size bytes from byte offset \p src_offset of \p src on \p src_node
  777. to byte offset \p dst_offset of \p dst on \p dst_node. This is to be used in
  778. the any_to_any() copy method, which is provided with the async_data to
  779. be passed to starpu_interface_copy(). this returns <c>-EAGAIN</c> if the
  780. transfer is still ongoing, or 0 if the transfer is already completed.
  781. \fn uint32_t starpu_hash_crc32c_be_n(const void *input, size_t n, uint32_t inputcrc)
  782. \ingroup API_Data_Interfaces
  783. Compute the CRC of a byte buffer seeded by the \p inputcrc
  784. <em>current state</em>. The return value should be considered as the new
  785. <em>current state</em> for future CRC computation. This is used for computing
  786. data size footprint.
  787. \fn uint32_t starpu_hash_crc32c_be(uint32_t input, uint32_t inputcrc)
  788. \ingroup API_Data_Interfaces
  789. Compute the CRC of a 32bit number seeded by the \p inputcrc
  790. <em>current state</em>. The return value should be considered as the new
  791. <em>current state</em> for future CRC computation. This is used for computing
  792. data size footprint.
  793. \fn uint32_t starpu_hash_crc32c_string(const char *str, uint32_t inputcrc)
  794. \ingroup API_Data_Interfaces
  795. Compute the CRC of a string seeded by the \p inputcrc <em>current
  796. state</em>. The return value should be considered as the new <em>current
  797. state</em> for future CRC computation. This is used for computing data
  798. size footprint.
  799. \fn int starpu_data_interface_get_next_id(void)
  800. \ingroup API_Data_Interfaces
  801. Return the next available id for a newly created data interface
  802. (\ref Defining_a_New_Data_Interface).
  803. */