data_interfaces.doxy 55 KB

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