data_interfaces.doxy 56 KB

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