data_interfaces.doxy 53 KB

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