data_interfaces.doxy 53 KB

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