data_interfaces.doxy 54 KB

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