data_interfaces.doxy 54 KB

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