data_interfaces.doxy 50 KB

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