starpu_task.h 61 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2009-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  4. * Copyright (C) 2011 Télécom-SudParis
  5. * Copyright (C) 2016 Uppsala University
  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. #ifndef __STARPU_TASK_H__
  19. #define __STARPU_TASK_H__
  20. #include <starpu.h>
  21. #include <errno.h>
  22. #include <assert.h>
  23. #if defined STARPU_USE_CUDA && !defined STARPU_DONT_INCLUDE_CUDA_HEADERS
  24. # include <cuda.h>
  25. #endif
  26. #ifdef __cplusplus
  27. extern "C"
  28. {
  29. #endif
  30. /**
  31. @defgroup API_Codelet_And_Tasks Codelet And Tasks
  32. @brief This section describes the interface to manipulate codelets
  33. and tasks.
  34. @{
  35. */
  36. /**
  37. To be used when setting the field starpu_codelet::where to specify
  38. that the codelet has no computation part, and thus does not need to
  39. be scheduled, and data does not need to be actually loaded. This is
  40. thus essentially used for synchronization tasks.
  41. */
  42. #define STARPU_NOWHERE ((1ULL)<<0)
  43. /**
  44. Convert from enum starpu_worker_archtype to worker type mask for use in "where" fields
  45. */
  46. #define STARPU_WORKER_TO_MASK(worker_archtype) (1ULL << (worker_archtype + 1))
  47. /**
  48. To be used when setting the field starpu_codelet::where (or
  49. starpu_task::where) to specify the codelet (or the task) may be
  50. executed on a CPU processing unit.
  51. */
  52. #define STARPU_CPU STARPU_WORKER_TO_MASK(STARPU_CPU_WORKER)
  53. /**
  54. To be used when setting the field starpu_codelet::where (or
  55. starpu_task::where) to specify the codelet (or the task) may be
  56. executed on a CUDA processing unit.
  57. */
  58. #define STARPU_CUDA STARPU_WORKER_TO_MASK(STARPU_CUDA_WORKER)
  59. /**
  60. To be used when setting the field starpu_codelet::where (or
  61. starpu_task::where) to specify the codelet (or the task) may be
  62. executed on a OpenCL processing unit.
  63. */
  64. #define STARPU_OPENCL STARPU_WORKER_TO_MASK(STARPU_OPENCL_WORKER)
  65. /**
  66. To be used when setting the field starpu_codelet::where (or
  67. starpu_task::where) to specify the codelet (or the task) may be
  68. executed on a MPI Slave processing unit.
  69. */
  70. #define STARPU_MPI_MS STARPU_WORKER_TO_MASK(STARPU_MPI_MS_WORKER)
  71. /**
  72. Value to be set in starpu_codelet::flags to execute the codelet
  73. functions even in simgrid mode.
  74. */
  75. #define STARPU_CODELET_SIMGRID_EXECUTE (1<<0)
  76. /**
  77. Value to be set in starpu_codelet::flags to execute the codelet
  78. functions even in simgrid mode, and later inject the measured
  79. timing inside the simulation.
  80. */
  81. #define STARPU_CODELET_SIMGRID_EXECUTE_AND_INJECT (1<<1)
  82. /**
  83. Value to be set in starpu_codelet::flags to make starpu_task_submit()
  84. not submit automatic asynchronous partitioning/unpartitioning.
  85. */
  86. #define STARPU_CODELET_NOPLANS (1<<2)
  87. /**
  88. Value to be set in starpu_codelet::cuda_flags to allow asynchronous
  89. CUDA kernel execution.
  90. */
  91. #define STARPU_CUDA_ASYNC (1<<0)
  92. /**
  93. Value to be set in starpu_codelet::opencl_flags to allow
  94. asynchronous OpenCL kernel execution.
  95. */
  96. #define STARPU_OPENCL_ASYNC (1<<0)
  97. /**
  98. To be used when the RAM memory node is specified.
  99. */
  100. #define STARPU_MAIN_RAM 0
  101. /**
  102. Describe the type of parallel task. See \ref ParallelTasks for
  103. details.
  104. */
  105. enum starpu_codelet_type
  106. {
  107. STARPU_SEQ = 0, /**< (default) for classical sequential
  108. tasks.
  109. */
  110. STARPU_SPMD, /**< for a parallel task whose threads are
  111. handled by StarPU, the code has to use
  112. starpu_combined_worker_get_size() and
  113. starpu_combined_worker_get_rank() to
  114. distribute the work.
  115. */
  116. STARPU_FORKJOIN /**< for a parallel task whose threads are
  117. started by the codelet function, which has
  118. to use starpu_combined_worker_get_size() to
  119. determine how many threads should be
  120. started.
  121. */
  122. };
  123. enum starpu_task_status
  124. {
  125. STARPU_TASK_INIT, /**< The task has just been initialized. */
  126. #define STARPU_TASK_INIT 0
  127. #define STARPU_TASK_INVALID STARPU_TASK_INIT /**< old name for STARPU_TASK_INIT */
  128. STARPU_TASK_BLOCKED, /**< The task has just been
  129. submitted, and its dependencies has not been checked yet. */
  130. STARPU_TASK_READY, /**< The task is ready for execution. */
  131. STARPU_TASK_RUNNING, /**< The task is running on some worker. */
  132. STARPU_TASK_FINISHED, /**< The task is finished executing. */
  133. STARPU_TASK_BLOCKED_ON_TAG, /**< The task is waiting for a tag. */
  134. STARPU_TASK_BLOCKED_ON_TASK, /**< The task is waiting for a task. */
  135. STARPU_TASK_BLOCKED_ON_DATA, /**< The task is waiting for some data. */
  136. STARPU_TASK_STOPPED /**< The task is stopped. */
  137. };
  138. /**
  139. CPU implementation of a codelet.
  140. */
  141. typedef void (*starpu_cpu_func_t)(void **, void*);
  142. /**
  143. CUDA implementation of a codelet.
  144. */
  145. typedef void (*starpu_cuda_func_t)(void **, void*);
  146. /**
  147. OpenCL implementation of a codelet.
  148. */
  149. typedef void (*starpu_opencl_func_t)(void **, void*);
  150. /**
  151. MPI Master Slave kernel for a codelet
  152. */
  153. typedef void (*starpu_mpi_ms_kernel_t)(void **, void*);
  154. /**
  155. MPI Master Slave implementation of a codelet.
  156. */
  157. typedef starpu_mpi_ms_kernel_t (*starpu_mpi_ms_func_t)(void);
  158. /**
  159. @deprecated
  160. Setting the field starpu_codelet::cpu_func with this macro
  161. indicates the codelet will have several implementations. The use of
  162. this macro is deprecated. One should always only define the field
  163. starpu_codelet::cpu_funcs.
  164. */
  165. #define STARPU_MULTIPLE_CPU_IMPLEMENTATIONS ((starpu_cpu_func_t) -1)
  166. /**
  167. @deprecated
  168. Setting the field starpu_codelet::cuda_func with this macro
  169. indicates the codelet will have several implementations. The use of
  170. this macro is deprecated. One should always only define the field
  171. starpu_codelet::cuda_funcs.
  172. */
  173. #define STARPU_MULTIPLE_CUDA_IMPLEMENTATIONS ((starpu_cuda_func_t) -1)
  174. /**
  175. @deprecated
  176. Setting the field starpu_codelet::opencl_func with this macro
  177. indicates the codelet will have several implementations. The use of
  178. this macro is deprecated. One should always only define the field
  179. starpu_codelet::opencl_funcs.
  180. */
  181. #define STARPU_MULTIPLE_OPENCL_IMPLEMENTATIONS ((starpu_opencl_func_t) -1)
  182. /**
  183. Value to set in starpu_codelet::nbuffers to specify that the
  184. codelet can accept a variable number of buffers, specified in
  185. starpu_task::nbuffers.
  186. */
  187. #define STARPU_VARIABLE_NBUFFERS (-1)
  188. /**
  189. Value to be set in the starpu_codelet::nodes field to request
  190. StarPU to put the data in local memory of the worker running the task (this
  191. is the default behavior).
  192. */
  193. #define STARPU_SPECIFIC_NODE_LOCAL (-1)
  194. /**
  195. Value to be set in the starpu_codelet::nodes field to request
  196. StarPU to put the data in CPU-accessible memory (and let StarPU
  197. choose the NUMA node).
  198. */
  199. #define STARPU_SPECIFIC_NODE_CPU (-2)
  200. /**
  201. Value to be set in the starpu_codelet::nodes field to request
  202. StarPU to put the data in some slow memory.
  203. */
  204. #define STARPU_SPECIFIC_NODE_SLOW (-3)
  205. /**
  206. Value to be set in the starpu_codelet::nodes field to request
  207. StarPU to put the data in some fast memory.
  208. */
  209. #define STARPU_SPECIFIC_NODE_FAST (-4)
  210. /**
  211. Value to be set in the starpu_codelet::nodes field to let StarPU decide
  212. whether to put the data in the local memory of the worker running the task,
  213. or in CPU-accessible memory (and let StarPU choose the NUMA node).
  214. */
  215. #define STARPU_SPECIFIC_NODE_LOCAL_OR_CPU (-5)
  216. struct starpu_task;
  217. /**
  218. The codelet structure describes a kernel that is possibly
  219. implemented on various targets. For compatibility, make sure to
  220. initialize the whole structure to zero, either by using explicit
  221. memset, or the function starpu_codelet_init(), or by letting the
  222. compiler implicitly do it in e.g. static storage case.
  223. */
  224. struct starpu_codelet
  225. {
  226. /**
  227. Optional field to indicate which types of processing units
  228. are able to execute the codelet. The different values
  229. ::STARPU_CPU, ::STARPU_CUDA, ::STARPU_OPENCL can be
  230. combined to specify on which types of processing units the
  231. codelet can be executed. ::STARPU_CPU|::STARPU_CUDA for
  232. instance indicates that the codelet is implemented for both
  233. CPU cores and CUDA devices while ::STARPU_OPENCL indicates
  234. that it is only available on OpenCL devices. If the field
  235. is unset, its value will be automatically set based on the
  236. availability of the XXX_funcs fields defined below. It can
  237. also be set to ::STARPU_NOWHERE to specify that no
  238. computation has to be actually done.
  239. */
  240. uint32_t where;
  241. /**
  242. Define a function which should return 1 if the worker
  243. designated by \p workerid can execute the \p nimpl -th
  244. implementation of \p task, 0 otherwise.
  245. */
  246. int (*can_execute)(unsigned workerid, struct starpu_task *task, unsigned nimpl);
  247. /**
  248. Optional field to specify the type of the codelet. The
  249. default is ::STARPU_SEQ, i.e. usual sequential
  250. implementation. Other values (::STARPU_SPMD or
  251. ::STARPU_FORKJOIN) declare that a parallel implementation is
  252. also available. See \ref ParallelTasks for details.
  253. */
  254. enum starpu_codelet_type type;
  255. /**
  256. Optional field. If a parallel implementation is available,
  257. this denotes the maximum combined worker size that StarPU
  258. will use to execute parallel tasks for this codelet.
  259. */
  260. int max_parallelism;
  261. /**
  262. @deprecated
  263. Optional field which has been made deprecated. One should
  264. use instead the field starpu_codelet::cpu_funcs.
  265. */
  266. starpu_cpu_func_t cpu_func STARPU_DEPRECATED;
  267. /**
  268. @deprecated
  269. Optional field which has been made deprecated. One should
  270. use instead the starpu_codelet::cuda_funcs field.
  271. */
  272. starpu_cuda_func_t cuda_func STARPU_DEPRECATED;
  273. /**
  274. @deprecated
  275. Optional field which has been made deprecated. One should
  276. use instead the starpu_codelet::opencl_funcs field.
  277. */
  278. starpu_opencl_func_t opencl_func STARPU_DEPRECATED;
  279. /**
  280. Optional array of function pointers to the CPU
  281. implementations of the codelet. The functions prototype
  282. must be:
  283. \code{.c}
  284. void cpu_func(void *buffers[], void *cl_arg)
  285. \endcode
  286. The first argument being the array of data managed by the
  287. data management library, and the second argument is a
  288. pointer to the argument passed from the field
  289. starpu_task::cl_arg. If the field starpu_codelet::where is
  290. set, then the field tarpu_codelet::cpu_funcs is ignored if
  291. ::STARPU_CPU does not appear in the field
  292. starpu_codelet::where, it must be non-<c>NULL</c> otherwise.
  293. */
  294. starpu_cpu_func_t cpu_funcs[STARPU_MAXIMPLEMENTATIONS];
  295. /**
  296. Optional array of function pointers to the CUDA
  297. implementations of the codelet. The functions must be
  298. host-functions written in the CUDA runtime API. Their
  299. prototype must be:
  300. \code{.c}
  301. void cuda_func(void *buffers[], void *cl_arg)
  302. \endcode
  303. If the field starpu_codelet::where is set, then the field
  304. starpu_codelet::cuda_funcs is ignored if ::STARPU_CUDA does
  305. not appear in the field starpu_codelet::where, it must be
  306. non-<c>NULL</c> otherwise.
  307. */
  308. starpu_cuda_func_t cuda_funcs[STARPU_MAXIMPLEMENTATIONS];
  309. /**
  310. Optional array of flags for CUDA execution. They specify
  311. some semantic details about CUDA kernel execution, such as
  312. asynchronous execution.
  313. */
  314. char cuda_flags[STARPU_MAXIMPLEMENTATIONS];
  315. /**
  316. Optional array of function pointers to the OpenCL
  317. implementations of the codelet. The functions prototype
  318. must be:
  319. \code{.c}
  320. void opencl_func(void *buffers[], void *cl_arg)
  321. \endcode
  322. If the field starpu_codelet::where field is set, then the
  323. field starpu_codelet::opencl_funcs is ignored if
  324. ::STARPU_OPENCL does not appear in the field
  325. starpu_codelet::where, it must be non-<c>NULL</c> otherwise.
  326. */
  327. starpu_opencl_func_t opencl_funcs[STARPU_MAXIMPLEMENTATIONS];
  328. /**
  329. Optional array of flags for OpenCL execution. They specify
  330. some semantic details about OpenCL kernel execution, such
  331. as asynchronous execution.
  332. */
  333. char opencl_flags[STARPU_MAXIMPLEMENTATIONS];
  334. /**
  335. Optional array of function pointers to a function which
  336. returns the MPI Master Slave implementation of the codelet.
  337. The functions prototype must be:
  338. \code{.c}
  339. starpu_mpi_ms_kernel_t mpi_ms_func(struct starpu_codelet *cl, unsigned nimpl)
  340. \endcode
  341. If the field starpu_codelet::where is set, then the field
  342. starpu_codelet::mpi_ms_funcs is ignored if ::STARPU_MPI_MS
  343. does not appear in the field starpu_codelet::where. It can
  344. be <c>NULL</c> if starpu_codelet::cpu_funcs_name is
  345. non-<c>NULL</c>, in which case StarPU will simply make a
  346. symbol lookup to get the implementation.
  347. */
  348. starpu_mpi_ms_func_t mpi_ms_funcs[STARPU_MAXIMPLEMENTATIONS];
  349. /**
  350. Optional array of strings which provide the name of the CPU
  351. functions referenced in the array
  352. starpu_codelet::cpu_funcs. This can be used when running on
  353. MPI MS devices for StarPU to simply look
  354. up the MPI MS function implementation through its name.
  355. */
  356. const char *cpu_funcs_name[STARPU_MAXIMPLEMENTATIONS];
  357. /**
  358. Specify the number of arguments taken by the codelet. These
  359. arguments are managed by the DSM and are accessed from the
  360. <c>void *buffers[]</c> array. The constant argument passed
  361. with the field starpu_task::cl_arg is not counted in this
  362. number. This value should not be above \ref
  363. STARPU_NMAXBUFS. It may be set to \ref
  364. STARPU_VARIABLE_NBUFFERS to specify that the number of
  365. buffers and their access modes will be set in
  366. starpu_task::nbuffers and starpu_task::modes or
  367. starpu_task::dyn_modes, which thus permits to define
  368. codelets with a varying number of data.
  369. */
  370. int nbuffers;
  371. /**
  372. Is an array of ::starpu_data_access_mode. It describes the
  373. required access modes to the data neeeded by the codelet
  374. (e.g. ::STARPU_RW). The number of entries in this array
  375. must be specified in the field starpu_codelet::nbuffers,
  376. and should not exceed \ref STARPU_NMAXBUFS. If
  377. unsufficient, this value can be set with the configure
  378. option \ref enable-maxbuffers "--enable-maxbuffers".
  379. */
  380. enum starpu_data_access_mode modes[STARPU_NMAXBUFS];
  381. /**
  382. Is an array of ::starpu_data_access_mode. It describes the
  383. required access modes to the data needed by the codelet
  384. (e.g. ::STARPU_RW). The number of entries in this array
  385. must be specified in the field starpu_codelet::nbuffers.
  386. This field should be used for codelets having a number of
  387. datas greater than \ref STARPU_NMAXBUFS (see \ref
  388. SettingManyDataHandlesForATask). When defining a codelet,
  389. one should either define this field or the field
  390. starpu_codelet::modes defined above.
  391. */
  392. enum starpu_data_access_mode *dyn_modes;
  393. /**
  394. Default value is 0. If this flag is set, StarPU will not
  395. systematically send all data to the memory node where the
  396. task will be executing, it will read the
  397. starpu_codelet::nodes or starpu_codelet::dyn_nodes array to
  398. determine, for each data, whether to send it on the memory
  399. node where the task will be executing (-1), or on a
  400. specific node (!= -1).
  401. */
  402. unsigned specific_nodes;
  403. /**
  404. Optional field. When starpu_codelet::specific_nodes is 1,
  405. this specifies the memory nodes where each data should be
  406. sent to for task execution. The number of entries in this
  407. array is starpu_codelet::nbuffers, and should not exceed
  408. \ref STARPU_NMAXBUFS.
  409. */
  410. int nodes[STARPU_NMAXBUFS];
  411. /**
  412. Optional field. When starpu_codelet::specific_nodes is 1,
  413. this specifies the memory nodes where each data should be
  414. sent to for task execution. The number of entries in this
  415. array is starpu_codelet::nbuffers. This field should be
  416. used for codelets having a number of datas greater than
  417. \ref STARPU_NMAXBUFS (see \ref
  418. SettingManyDataHandlesForATask). When defining a codelet,
  419. one should either define this field or the field
  420. starpu_codelet::nodes defined above.
  421. */
  422. int *dyn_nodes;
  423. /**
  424. Optional pointer to the task duration performance model
  425. associated to this codelet. This optional field is ignored
  426. when set to <c>NULL</c> or when its field
  427. starpu_perfmodel::symbol is not set.
  428. */
  429. struct starpu_perfmodel *model;
  430. /**
  431. Optional pointer to the task energy consumption performance
  432. model associated to this codelet (in J). This optional field is
  433. ignored when set to <c>NULL</c> or when its field
  434. starpu_perfmodel::symbol is not set. In the case of
  435. parallel codelets, this has to account for all processing
  436. units involved in the parallel execution.
  437. */
  438. struct starpu_perfmodel *energy_model;
  439. /**
  440. Optional array for statistics collected at runtime: this is
  441. filled by StarPU and should not be accessed directly, but
  442. for example by calling the function
  443. starpu_codelet_display_stats() (See
  444. starpu_codelet_display_stats() for details).
  445. */
  446. unsigned long per_worker_stats[STARPU_NMAXWORKERS];
  447. /**
  448. Optional name of the codelet. This can be useful for
  449. debugging purposes.
  450. */
  451. const char *name;
  452. /**
  453. Optional color of the codelet. This can be useful for
  454. debugging purposes. Value 0 acts like if this field wasn't specified.
  455. Color representation is hex triplet (for example: 0xff0000 is red,
  456. 0x0000ff is blue, 0xffa500 is orange, ...).
  457. */
  458. unsigned color;
  459. /**
  460. Optional field, the default value is <c>NULL</c>. This is a
  461. function pointer of prototype <c>void (*f)(void *)</c>
  462. which specifies a possible callback. If this pointer is
  463. non-<c>NULL</c>, the callback function is executed on the
  464. host after the execution of the task. If the task defines a
  465. callback, the codelet callback is not called, unless called
  466. within the task callback function.
  467. The callback is passed the value contained in the
  468. starpu_task::callback_arg field. No callback is executed if
  469. the field is set to <c>NULL</c>.
  470. */
  471. void (*callback_func)(void *);
  472. /**
  473. Various flags for the codelet.
  474. */
  475. int flags;
  476. struct starpu_perf_counter_sample *perf_counter_sample;
  477. struct starpu_perf_counter_sample_cl_values *perf_counter_values;
  478. /**
  479. Whether _starpu_codelet_check_deprecated_fields was already done or not.
  480. */
  481. int checked;
  482. };
  483. /**
  484. Describe a data handle along with an access mode.
  485. */
  486. struct starpu_data_descr
  487. {
  488. starpu_data_handle_t handle; /**< data */
  489. enum starpu_data_access_mode mode; /**< access mode */
  490. };
  491. /**
  492. Describe a task that can be offloaded on the various processing
  493. units managed by StarPU. It instantiates a codelet. It can either
  494. be allocated dynamically with the function starpu_task_create(), or
  495. declared statically. In the latter case, the programmer has to zero
  496. the structure starpu_task and to fill the different fields
  497. properly. The indicated default values correspond to the
  498. configuration of a task allocated with starpu_task_create().
  499. */
  500. struct starpu_task
  501. {
  502. /**
  503. Optional name of the task. This can be useful for debugging
  504. purposes.
  505. With starpu_task_insert() and alike this can be specified thanks to
  506. ::STARPU_NAME followed by the const char *.
  507. */
  508. const char *name;
  509. /**
  510. Optional file name where the task was submitted. This can be useful
  511. for debugging purposes.
  512. */
  513. const char *file;
  514. /**
  515. Optional line number where the task was submitted. This can be useful
  516. for debugging purposes.
  517. */
  518. int line;
  519. /**
  520. Pointer to the corresponding structure starpu_codelet. This
  521. describes where the kernel should be executed, and supplies
  522. the appropriate implementations. When set to <c>NULL</c>,
  523. no code is executed during the tasks, such empty tasks can
  524. be useful for synchronization purposes.
  525. */
  526. struct starpu_codelet *cl;
  527. /**
  528. When set, specify where the task is allowed to be executed.
  529. When unset, take the value of starpu_codelet::where.
  530. With starpu_task_insert() and alike this can be specified thanks to
  531. ::STARPU_EXECUTE_WHERE followed by an unsigned long long.
  532. */
  533. int32_t where;
  534. /**
  535. Specify the number of buffers. This is only used when
  536. starpu_codelet::nbuffers is \ref STARPU_VARIABLE_NBUFFERS.
  537. With starpu_task_insert() and alike this is automatically computed
  538. when using ::STARPU_DATA_ARRAY and alike.
  539. */
  540. int nbuffers;
  541. /* Keep dyn_handles, dyn_interfaces and dyn_modes before the
  542. * equivalent static arrays, so we can detect dyn_handles
  543. * being NULL while nbuffers being bigger that STARPU_NMAXBUFS
  544. * (otherwise the overflow would put a non-NULL) */
  545. /**
  546. Array of ::starpu_data_handle_t. Specify the handles to the
  547. different pieces of data accessed by the task. The number
  548. of entries in this array must be specified in the field
  549. starpu_codelet::nbuffers. This field should be used for
  550. tasks having a number of datas greater than \ref
  551. STARPU_NMAXBUFS (see \ref SettingManyDataHandlesForATask).
  552. When defining a task, one should either define this field
  553. or the field starpu_task::handles defined below.
  554. With starpu_task_insert() and alike this is automatically filled
  555. when using ::STARPU_DATA_ARRAY and alike.
  556. */
  557. starpu_data_handle_t *dyn_handles;
  558. /**
  559. Array of data pointers to the memory node where execution
  560. will happen, managed by the DSM. Is used when the field
  561. starpu_task::dyn_handles is defined.
  562. This is filled by StarPU.
  563. */
  564. void **dyn_interfaces;
  565. /**
  566. Used only when starpu_codelet::nbuffers is \ref
  567. STARPU_VARIABLE_NBUFFERS.
  568. Array of ::starpu_data_access_mode which describes the
  569. required access modes to the data needed by the codelet
  570. (e.g. ::STARPU_RW). The number of entries in this array
  571. must be specified in the field starpu_codelet::nbuffers.
  572. This field should be used for codelets having a number of
  573. datas greater than \ref STARPU_NMAXBUFS (see \ref
  574. SettingManyDataHandlesForATask).
  575. When defining a codelet, one should either define this
  576. field or the field starpu_task::modes defined below.
  577. With starpu_task_insert() and alike this is automatically filled
  578. when using ::STARPU_DATA_MODE_ARRAY and alike.
  579. */
  580. enum starpu_data_access_mode *dyn_modes;
  581. /**
  582. Array of ::starpu_data_handle_t. Specify the handles to the
  583. different pieces of data accessed by the task. The number
  584. of entries in this array must be specified in the field
  585. starpu_codelet::nbuffers, and should not exceed
  586. \ref STARPU_NMAXBUFS. If unsufficient, this value can be
  587. set with the configure option \ref enable-maxbuffers
  588. "--enable-maxbuffers".
  589. With starpu_task_insert() and alike this is automatically filled
  590. when using ::STARPU_R and alike.
  591. */
  592. starpu_data_handle_t handles[STARPU_NMAXBUFS];
  593. /**
  594. Array of Data pointers to the memory node where execution
  595. will happen, managed by the DSM.
  596. This is filled by StarPU.
  597. */
  598. void *interfaces[STARPU_NMAXBUFS];
  599. /**
  600. Used only when starpu_codelet::nbuffers is \ref
  601. STARPU_VARIABLE_NBUFFERS.
  602. Array of ::starpu_data_access_mode which describes the
  603. required access modes to the data neeeded by the codelet
  604. (e.g. ::STARPU_RW). The number of entries in this array
  605. must be specified in the field starpu_task::nbuffers, and
  606. should not exceed \ref STARPU_NMAXBUFS. If unsufficient,
  607. this value can be set with the configure option
  608. \ref enable-maxbuffers "--enable-maxbuffers".
  609. With starpu_task_insert() and alike this is automatically filled
  610. when using ::STARPU_DATA_MODE_ARRAY and alike.
  611. */
  612. enum starpu_data_access_mode modes[STARPU_NMAXBUFS];
  613. /**
  614. Optional pointer to an array of characters which allows to
  615. define the sequential consistency for each handle for the
  616. current task.
  617. With starpu_task_insert() and alike this can be specified thanks to
  618. ::STARPU_HANDLES_SEQUENTIAL_CONSISTENCY followed by an unsigned char *
  619. */
  620. unsigned char *handles_sequential_consistency;
  621. /**
  622. Optional pointer which is passed to the codelet through the
  623. second argument of the codelet implementation (e.g.
  624. starpu_codelet::cpu_func or starpu_codelet::cuda_func). The
  625. default value is <c>NULL</c>. starpu_codelet_pack_args()
  626. and starpu_codelet_unpack_args() are helpers that can can
  627. be used to respectively pack and unpack data into and from
  628. it, but the application can manage it any way, the only
  629. requirement is that the size of the data must be set in
  630. starpu_task::cl_arg_size .
  631. With starpu_task_insert() and alike this can be specified thanks to
  632. ::STARPU_CL_ARGS followed by a void* and a size_t.
  633. */
  634. void *cl_arg;
  635. /**
  636. Optional field. For some specific drivers, the pointer
  637. starpu_task::cl_arg cannot not be directly given to the
  638. driver function. A buffer of size starpu_task::cl_arg_size
  639. needs to be allocated on the driver. This buffer is then
  640. filled with the starpu_task::cl_arg_size bytes starting at
  641. address starpu_task::cl_arg. In this case, the argument
  642. given to the codelet is therefore not the
  643. starpu_task::cl_arg pointer, but the address of the buffer
  644. in local store (LS) instead. This field is ignored for CPU,
  645. CUDA and OpenCL codelets, where the starpu_task::cl_arg
  646. pointer is given as such.
  647. With starpu_task_insert() and alike this can be specified thanks to
  648. ::STARPU_CL_ARGS followed by a void* and a size_t.
  649. */
  650. size_t cl_arg_size;
  651. /**
  652. Optional pointer which points to the return value of submitted task.
  653. The default value is <c>NULL</c>. starpu_codelet_pack_arg()
  654. and starpu_codelet_unpack_arg() can be used to respectively
  655. pack and unpack the return value into and form it. starpu_task::cl_ret
  656. can be used for MPI support. The only requirement is that
  657. the size of the return value must be set in starpu_task::cl_ret_size .
  658. */
  659. void *cl_ret;
  660. /**
  661. Optional field. The buffer of starpu_codelet_pack_arg()
  662. and starpu_codelet_unpack_arg() can be allocated with
  663. the starpu_task::cl_ret_size bytes starting at address starpu_task::cl_ret.
  664. starpu_task::cl_ret_size can be used for MPI supoort.
  665. */
  666. size_t cl_ret_size;
  667. /**
  668. Optional field, the default value is <c>NULL</c>. This is a
  669. function pointer of prototype <c>void (*f)(void *)</c> which
  670. specifies a possible callback. If this pointer is non-<c>NULL</c>,
  671. the callback function is executed on the host after the execution of
  672. the task. Contrary to starpu_task::callback_func, it is called
  673. before releasing tasks which depend on this task, so those cannot be
  674. already executing. The callback is passed
  675. the value contained in the starpu_task::epilogue_callback_arg field.
  676. No callback is executed if the field is set to <c>NULL</c>.
  677. With starpu_task_insert() and alike this can be specified thanks to
  678. ::STARPU_EPILOGUE_CALLBACK followed by the function pointer.
  679. */
  680. void (*epilogue_callback_func)(void *);
  681. /**
  682. Optional field, the default value is <c>NULL</c>. This is
  683. the pointer passed to the epilogue callback function. This field is
  684. ignored if the field starpu_task::epilogue_callback_func is set to
  685. <c>NULL</c>.
  686. */
  687. void *epilogue_callback_arg;
  688. /**
  689. Optional field, the default value is <c>NULL</c>. This is a
  690. function pointer of prototype <c>void (*f)(void *)</c>
  691. which specifies a possible callback. If this pointer is
  692. non-<c>NULL</c>, the callback function is executed on the
  693. host after the execution of the task. Contrary to
  694. starpu_task::epilogue_callback, it is called after releasing
  695. tasks which depend on this task, so those
  696. might already be executing. The callback is passed the
  697. value contained in the starpu_task::callback_arg field. No
  698. callback is executed if the field is set to <c>NULL</c>.
  699. With starpu_task_insert() and alike this can be specified thanks to
  700. ::STARPU_CALLBACK followed by the function pointer, or thanks to
  701. ::STARPU_CALLBACK_WITH_ARG (or
  702. ::STARPU_CALLBACK_WITH_ARG_NFREE) followed by the function
  703. pointer and the argument.
  704. */
  705. void (*callback_func)(void *);
  706. /**
  707. Optional field, the default value is <c>NULL</c>. This is
  708. the pointer passed to the callback function. This field is
  709. ignored if the field starpu_task::callback_func is set to
  710. <c>NULL</c>.
  711. With starpu_task_insert() and alike this can be specified thanks to
  712. ::STARPU_CALLBACK_ARG followed by the argument pointer, or thanks to
  713. ::STARPU_CALLBACK_WITH_ARG or
  714. ::STARPU_CALLBACK_WITH_ARG_NFREE followed by the function
  715. pointer and the argument.
  716. */
  717. void *callback_arg;
  718. /**
  719. Optional field, the default value is <c>NULL</c>. This is a
  720. function pointer of prototype <c>void (*f)(void *)</c>
  721. which specifies a possible callback. If this pointer is
  722. non-<c>NULL</c>, the callback function is executed on the
  723. host when the task becomes ready for execution, before
  724. getting scheduled. The callback is passed the value
  725. contained in the starpu_task::prologue_callback_arg field.
  726. No callback is executed if the field is set to <c>NULL</c>.
  727. With starpu_task_insert() and alike this can be specified thanks to
  728. ::STARPU_PROLOGUE_CALLBACK followed by the function pointer.
  729. */
  730. void (*prologue_callback_func)(void *);
  731. /**
  732. Optional field, the default value is <c>NULL</c>. This is
  733. the pointer passed to the prologue callback function. This
  734. field is ignored if the field
  735. starpu_task::prologue_callback_func is set to <c>NULL</c>.
  736. With starpu_task_insert() and alike this can be specified thanks to
  737. ::STARPU_PROLOGUE_CALLBACK_ARG followed by the argument
  738. */
  739. void *prologue_callback_arg;
  740. /**
  741. Optional field, the default value is <c>NULL</c>. This is a
  742. function pointer of prototype <c>void (*f)(void*)</c>
  743. which specifies a possible callback. If this pointer is
  744. non-<c>NULL</c>, the callback function is executed on the host
  745. when the task is pop-ed from the scheduler, just before getting
  746. executed. The callback is passed the value contained in the
  747. starpu_task::prologue_callback_pop_arg field.
  748. No callback is executed if the field is set to <c>NULL</c>.
  749. With starpu_task_insert() and alike this can be specified thanks to
  750. ::STARPU_PROLOGUE_CALLBACK_POP followed by the function pointer.
  751. */
  752. void (*prologue_callback_pop_func)(void *);
  753. /**
  754. Optional field, the default value is <c>NULL</c>. This is
  755. the pointer passed to the prologue_callback_pop function. This
  756. field is ignored if the field
  757. starpu_task::prologue_callback_pop_func is set to <c>NULL</c>.
  758. With starpu_task_insert() and alike this can be specified thanks to
  759. ::STARPU_PROLOGUE_CALLBACK_POP_ARG followed by the argument.
  760. */
  761. void *prologue_callback_pop_arg;
  762. /**
  763. Optional field. Contain the tag associated to the task if
  764. the field starpu_task::use_tag is set, ignored
  765. otherwise.
  766. With starpu_task_insert() and alike this can be specified thanks to
  767. ::STARPU_TAG followed by a starpu_tag_t.
  768. */
  769. starpu_tag_t tag_id;
  770. /**
  771. Optional field. In case starpu_task::cl_arg was allocated
  772. by the application through <c>malloc()</c>, setting
  773. starpu_task::cl_arg_free to 1 makes StarPU automatically
  774. call <c>free(cl_arg)</c> when destroying the task. This
  775. saves the user from defining a callback just for that.
  776. With starpu_task_insert() and alike this is set to 1 when using
  777. ::STARPU_CL_ARGS.
  778. */
  779. unsigned cl_arg_free:1;
  780. /**
  781. Optional field. In case starpu_task::cl_ret was allocated
  782. by the application through <c>malloc()</c>, setting
  783. starpu_task::cl_ret_free to 1 makes StarPU automatically
  784. call <c>free(cl_ret)</c> when destroying the task.
  785. */
  786. unsigned cl_ret_free:1;
  787. /**
  788. Optional field. In case starpu_task::callback_arg was
  789. allocated by the application through <c>malloc()</c>,
  790. setting starpu_task::callback_arg_free to 1 makes StarPU
  791. automatically call <c>free(callback_arg)</c> when
  792. destroying the task.
  793. With starpu_task_insert() and alike, this is set to 1 when using
  794. ::STARPU_CALLBACK_ARG or ::STARPU_CALLBACK_WITH_ARG, or set
  795. to 0 when using ::STARPU_CALLBACK_ARG_NFREE
  796. */
  797. unsigned callback_arg_free:1;
  798. /**
  799. Optional field. In case starpu_task::epilogue_callback_arg was
  800. allocated by the application through <c>malloc()</c>,
  801. setting starpu_task::epilogue_callback_arg_free to 1 makes StarPU
  802. automatically call <c>free(epilogue_callback_arg)</c> when
  803. destroying the task.
  804. */
  805. unsigned epilogue_callback_arg_free:1;
  806. /**
  807. Optional field. In case starpu_task::prologue_callback_arg
  808. was allocated by the application through <c>malloc()</c>,
  809. setting starpu_task::prologue_callback_arg_free to 1 makes
  810. StarPU automatically call
  811. <c>free(prologue_callback_arg)</c> when destroying the task.
  812. With starpu_task_insert() and alike this is set to 1 when using
  813. ::STARPU_PROLOGUE_CALLBACK_ARG, or set to 0 when using
  814. ::STARPU_PROLOGUE_CALLBACK_ARG_NFREE
  815. */
  816. unsigned prologue_callback_arg_free:1;
  817. /**
  818. Optional field. In case starpu_task::prologue_callback_pop_arg
  819. was allocated by the application through <c>malloc()</c>,
  820. setting starpu_task::prologue_callback_pop_arg_free to 1 makes
  821. StarPU automatically call
  822. <c>free(prologue_callback_pop_arg)</c> when destroying the
  823. task.
  824. With starpu_task_insert() and alike this is set to 1 when using
  825. ::STARPU_PROLOGUE_CALLBACK_POP_ARG, or set to 0 when using
  826. ::STARPU_PROLOGUE_CALLBACK_POP_ARG_NFREE
  827. */
  828. unsigned prologue_callback_pop_arg_free:1;
  829. /**
  830. Optional field, the default value is 0. If set, this flag
  831. indicates that the task should be associated with the tag
  832. contained in the starpu_task::tag_id field. Tag allow the
  833. application to synchronize with the task and to express
  834. task dependencies easily.
  835. With starpu_task_insert() and alike this is set to 1 when using
  836. ::STARPU_TAG.
  837. */
  838. unsigned use_tag:1;
  839. /**
  840. If this flag is set (which is the default), sequential
  841. consistency is enforced for the data parameters of this
  842. task for which sequential consistency is enabled. Clearing
  843. this flag permits to disable sequential consistency for
  844. this task, even if data have it enabled.
  845. With starpu_task_insert() and alike this can be specified thanks to
  846. ::STARPU_SEQUENTIAL_CONSISTENCY followed by an unsigned.
  847. */
  848. unsigned sequential_consistency:1;
  849. /**
  850. If this flag is set, the function starpu_task_submit() is
  851. blocking and returns only when the task has been executed
  852. (or if no worker is able to process the task). Otherwise,
  853. starpu_task_submit() returns immediately.
  854. With starpu_task_insert() and alike this can be specified thanks to
  855. ::STARPU_TASK_SYNCHRONOUS followed an int.
  856. */
  857. unsigned synchronous:1;
  858. /**
  859. Default value is 0. If this flag is set, StarPU will bypass
  860. the scheduler and directly affect this task to the worker
  861. specified by the field starpu_task::workerid.
  862. With starpu_task_insert() and alike this is set to 1 when using
  863. ::STARPU_EXECUTE_ON_WORKER.
  864. */
  865. unsigned execute_on_a_specific_worker:1;
  866. /**
  867. Optional field, default value is 1. If this flag is set, it
  868. is not possible to synchronize with the task by the means
  869. of starpu_task_wait() later on. Internal data structures
  870. are only guaranteed to be freed once starpu_task_wait() is
  871. called if the flag is not set.
  872. With starpu_task_insert() and alike this is set to 1.
  873. */
  874. unsigned detach:1;
  875. /**
  876. Optional value. Default value is 0 for starpu_task_init(),
  877. and 1 for starpu_task_create(). If this flag is set, the
  878. task structure will automatically be freed, either after
  879. the execution of the callback if the task is detached, or
  880. during starpu_task_wait() otherwise. If this flag is not
  881. set, dynamically allocated data structures will not be
  882. freed until starpu_task_destroy() is called explicitly.
  883. Setting this flag for a statically allocated task structure
  884. will result in undefined behaviour. The flag is set to 1
  885. when the task is created by calling starpu_task_create().
  886. Note that starpu_task_wait_for_all() will not free any task.
  887. With starpu_task_insert() and alike this is set to 1.
  888. */
  889. unsigned destroy:1;
  890. /**
  891. Optional field. If this flag is set, the task will be
  892. re-submitted to StarPU once it has been executed. This flag
  893. must not be set if the flag starpu_task::destroy is set.
  894. This flag must be set before making another task depend on
  895. this one.
  896. With starpu_task_insert() and alike this is set to 0.
  897. */
  898. unsigned regenerate:1;
  899. /**
  900. do not allocate a submitorder id for this task
  901. With starpu_task_insert() and alike this can be specified
  902. thanks to ::STARPU_TASK_NO_SUBMITORDER followed by
  903. an unsigned.
  904. */
  905. unsigned no_submitorder:1;
  906. /**
  907. @private
  908. This is only used for tasks that use multiformat handle.
  909. This should only be used by StarPU.
  910. */
  911. unsigned char mf_skip;
  912. /**
  913. Whether this task has failed and will thus have to be retried
  914. Set by StarPU.
  915. */
  916. unsigned char failed;
  917. /**
  918. Whether the scheduler has pushed the task on some queue
  919. Set by StarPU.
  920. */
  921. unsigned char scheduled;
  922. /**
  923. Whether the scheduler has prefetched the task's data
  924. Set by StarPU.
  925. */
  926. unsigned char prefetched;
  927. /**
  928. Optional field. If the field
  929. starpu_task::execute_on_a_specific_worker is set, this
  930. field indicates the identifier of the worker that should
  931. process this task (as returned by starpu_worker_get_id()).
  932. This field is ignored if the field
  933. starpu_task::execute_on_a_specific_worker is set to 0.
  934. With starpu_task_insert() and alike this can be specified thanks to
  935. ::STARPU_EXECUTE_ON_WORKER followed by an int.
  936. */
  937. unsigned workerid;
  938. /**
  939. Optional field. If the field
  940. starpu_task::execute_on_a_specific_worker is set, this
  941. field indicates the per-worker consecutive order in which
  942. tasks should be executed on the worker. Tasks will be
  943. executed in consecutive starpu_task::workerorder values,
  944. thus ignoring the availability order or task priority. See
  945. \ref StaticScheduling for more details. This field is
  946. ignored if the field
  947. starpu_task::execute_on_a_specific_worker is set to 0.
  948. With starpu_task_insert() and alike this can be specified thanks to
  949. ::STARPU_WORKER_ORDER followed by an unsigned.
  950. */
  951. unsigned workerorder;
  952. /**
  953. Optional field. If the field starpu_task::workerids_len is
  954. different from 0, this field indicates an array of bits
  955. (stored as uint32_t values) which indicate the set of
  956. workers which are allowed to execute the task.
  957. starpu_task::workerid takes precedence over this.
  958. With starpu_task_insert() and alike, this can be specified
  959. along the field workerids_len thanks to ::STARPU_TASK_WORKERIDS
  960. followed by a number of workers and an array of bits which
  961. size is the number of workers.
  962. */
  963. uint32_t *workerids;
  964. /**
  965. Optional field. This provides the number of uint32_t values
  966. in the starpu_task::workerids array.
  967. With starpu_task_insert() and alike, this can be specified
  968. along the field workerids thanks to ::STARPU_TASK_WORKERIDS
  969. followed by a number of workers and an array of bits which
  970. size is the number of workers.
  971. */
  972. unsigned workerids_len;
  973. /**
  974. Optional field, the default value is ::STARPU_DEFAULT_PRIO.
  975. This field indicates a level of priority for the task. This
  976. is an integer value that must be set between the return
  977. values of the function starpu_sched_get_min_priority() for
  978. the least important tasks, and that of the function
  979. starpu_sched_get_max_priority() for the most important
  980. tasks (included). The ::STARPU_MIN_PRIO and
  981. ::STARPU_MAX_PRIO macros are provided for convenience and
  982. respectively return the value of
  983. starpu_sched_get_min_priority() and
  984. starpu_sched_get_max_priority(). Default priority is
  985. ::STARPU_DEFAULT_PRIO, which is always defined as 0 in
  986. order to allow static task initialization. Scheduling
  987. strategies that take priorities into account can use this
  988. parameter to take better scheduling decisions, but the
  989. scheduling policy may also ignore it.
  990. With starpu_task_insert() and alike this can be specified thanks to
  991. ::STARPU_PRIORITY followed by an unsigned long long.
  992. */
  993. int priority;
  994. /**
  995. Current state of the task.
  996. Set by StarPU.
  997. */
  998. enum starpu_task_status status;
  999. /**
  1000. @private
  1001. This field is set when initializing a task. The function
  1002. starpu_task_submit() will fail if the field does not have
  1003. the correct value. This will hence avoid submitting tasks
  1004. which have not been properly initialised.
  1005. */
  1006. int magic;
  1007. /**
  1008. Allow to get the type of task, for filtering out tasks
  1009. in profiling outputs, whether it is really internal to
  1010. StarPU (::STARPU_TASK_TYPE_INTERNAL), a data acquisition
  1011. synchronization task (::STARPU_TASK_TYPE_DATA_ACQUIRE), or
  1012. a normal task (::STARPU_TASK_TYPE_NORMAL)
  1013. Set by StarPU.
  1014. */
  1015. unsigned type;
  1016. /**
  1017. color of the task to be used in dag.dot.
  1018. With starpu_task_insert() and alike this can be specified thanks to
  1019. ::STARPU_TASK_COLOR followed by an int.
  1020. */
  1021. unsigned color;
  1022. /**
  1023. Scheduling context.
  1024. With starpu_task_insert() and alike this can be specified thanks to
  1025. ::STARPU_SCHED_CTX followed by an unsigned.
  1026. */
  1027. unsigned sched_ctx;
  1028. /**
  1029. Help the hypervisor monitor the execution of this task.
  1030. With starpu_task_insert() and alike this can be specified thanks to
  1031. ::STARPU_HYPERVISOR_TAG followed by an int.
  1032. */
  1033. int hypervisor_tag;
  1034. /**
  1035. TODO: related with sched contexts and parallel tasks
  1036. With starpu_task_insert() and alike this can be specified thanks to
  1037. ::STARPU_POSSIBLY_PARALLEL followed by an unsigned.
  1038. */
  1039. unsigned possibly_parallel;
  1040. /**
  1041. Optional field. The bundle that includes this task. If no
  1042. bundle is used, this should be <c>NULL</c>.
  1043. */
  1044. starpu_task_bundle_t bundle;
  1045. /**
  1046. Optional field. Profiling information for the task.
  1047. With starpu_task_insert() and alike this can be specified thanks to
  1048. ::STARPU_TASK_PROFILING_INFO followed by a pointer to the
  1049. appropriate struct.
  1050. */
  1051. struct starpu_profiling_task_info *profiling_info;
  1052. /**
  1053. This can be set to the number of floating points operations
  1054. that the task will have to achieve. This is useful for
  1055. easily getting GFlops curves from the tool
  1056. <c>starpu_perfmodel_plot</c>, and for the hypervisor load
  1057. balancing.
  1058. With starpu_task_insert() and alike this can be specified thanks to
  1059. ::STARPU_FLOPS followed by a double.
  1060. */
  1061. double flops;
  1062. /**
  1063. Output field. Predicted duration of the task. This field is
  1064. only set if the scheduling strategy uses performance
  1065. models.
  1066. Set by StarPU.
  1067. */
  1068. double predicted;
  1069. /**
  1070. Output field. Predicted data transfer duration for the task in
  1071. microseconds. This field is only valid if the scheduling
  1072. strategy uses performance models.
  1073. Set by StarPU.
  1074. */
  1075. double predicted_transfer;
  1076. double predicted_start;
  1077. /**
  1078. @private
  1079. A pointer to the previous task. This should only be used by
  1080. StarPU schedulers.
  1081. */
  1082. struct starpu_task *prev;
  1083. /**
  1084. @private
  1085. A pointer to the next task. This should only be used by
  1086. StarPU schedulers.
  1087. */
  1088. struct starpu_task *next;
  1089. /**
  1090. @private
  1091. This is private to StarPU, do not modify.
  1092. */
  1093. void *starpu_private;
  1094. #ifdef STARPU_OPENMP
  1095. /**
  1096. @private
  1097. This is private to StarPU, do not modify.
  1098. */
  1099. struct starpu_omp_task *omp_task;
  1100. #else
  1101. void *omp_task;
  1102. #endif
  1103. /**
  1104. @private
  1105. This is private to StarPU, do not modify.
  1106. */
  1107. unsigned nb_termination_call_required;
  1108. /**
  1109. This field is managed by the scheduler, is it allowed to do
  1110. whatever with it. Typically, some area would be allocated on push, and released on pop.
  1111. With starpu_task_insert() and alike this is set when using
  1112. ::STARPU_TASK_SCHED_DATA.
  1113. */
  1114. void *sched_data;
  1115. };
  1116. /**
  1117. To be used in the starpu_task::type field, for normal application tasks.
  1118. */
  1119. #define STARPU_TASK_TYPE_NORMAL 0
  1120. /**
  1121. To be used in the starpu_task::type field, for StarPU-internal tasks.
  1122. */
  1123. #define STARPU_TASK_TYPE_INTERNAL (1<<0)
  1124. /**
  1125. To be used in the starpu_task::type field, for StarPU-internal data acquisition tasks.
  1126. */
  1127. #define STARPU_TASK_TYPE_DATA_ACQUIRE (1<<1)
  1128. /**
  1129. Value to be used to initialize statically allocated tasks. This is
  1130. equivalent to initializing a structure starpu_task
  1131. with the function starpu_task_init().
  1132. */
  1133. /* Note: remember to update starpu_task_init and starpu_task_ft_create_retry
  1134. * as well */
  1135. #define STARPU_TASK_INITIALIZER \
  1136. { \
  1137. .cl = NULL, \
  1138. .where = -1, \
  1139. .cl_arg = NULL, \
  1140. .cl_arg_size = 0, \
  1141. .cl_ret = NULL, \
  1142. .cl_ret_size = 0, \
  1143. .callback_func = NULL, \
  1144. .callback_arg = NULL, \
  1145. .epilogue_callback_func = NULL, \
  1146. .epilogue_callback_arg = NULL, \
  1147. .priority = STARPU_DEFAULT_PRIO, \
  1148. .use_tag = 0, \
  1149. .sequential_consistency = 1, \
  1150. .synchronous = 0, \
  1151. .execute_on_a_specific_worker = 0, \
  1152. .workerorder = 0, \
  1153. .bundle = NULL, \
  1154. .detach = 1, \
  1155. .destroy = 0, \
  1156. .regenerate = 0, \
  1157. .status = STARPU_TASK_INIT, \
  1158. .profiling_info = NULL, \
  1159. .predicted = NAN, \
  1160. .predicted_transfer = NAN, \
  1161. .predicted_start = NAN, \
  1162. .starpu_private = NULL, \
  1163. .magic = 42, \
  1164. .type = 0, \
  1165. .color = 0, \
  1166. .sched_ctx = STARPU_NMAX_SCHED_CTXS, \
  1167. .hypervisor_tag = 0, \
  1168. .flops = 0.0, \
  1169. .scheduled = 0, \
  1170. .prefetched = 0, \
  1171. .dyn_handles = NULL, \
  1172. .dyn_interfaces = NULL, \
  1173. .dyn_modes = NULL, \
  1174. .name = NULL, \
  1175. .possibly_parallel = 0 \
  1176. }
  1177. /**
  1178. Return the number of buffers for \p task, i.e.
  1179. starpu_codelet::nbuffers, or starpu_task::nbuffers if the former is
  1180. \ref STARPU_VARIABLE_NBUFFERS.
  1181. */
  1182. #define STARPU_TASK_GET_NBUFFERS(task) ((unsigned)((task)->cl->nbuffers == STARPU_VARIABLE_NBUFFERS ? ((task)->nbuffers) : ((task)->cl->nbuffers)))
  1183. /**
  1184. Return the \p i -th data handle of \p task. If \p task is defined
  1185. with a static or dynamic number of handles, will either return the
  1186. \p i -th element of the field starpu_task::handles or the \p i -th
  1187. element of the field starpu_task::dyn_handles (see \ref
  1188. SettingManyDataHandlesForATask)
  1189. */
  1190. #define STARPU_TASK_GET_HANDLE(task, i) (((task)->dyn_handles) ? (task)->dyn_handles[i] : (task)->handles[i])
  1191. /**
  1192. Return all the data handles of \p task. If \p task is defined
  1193. with a static or dynamic number of handles, will either return all
  1194. the element of the field starpu_task::handles or all the elements
  1195. of the field starpu_task::dyn_handles (see \ref SettingManyDataHandlesForATask)
  1196. */
  1197. #define STARPU_TASK_GET_HANDLES(task) (((task)->dyn_handles) ? (task)->dyn_handles : (task)->handles)
  1198. /**
  1199. Set the \p i -th data handle of \p task with \p handle. If \p task
  1200. is defined with a static or dynamic number of handles, will either
  1201. set the \p i -th element of the field starpu_task::handles or the
  1202. \p i -th element of the field starpu_task::dyn_handles
  1203. (see \ref SettingManyDataHandlesForATask)
  1204. */
  1205. #define STARPU_TASK_SET_HANDLE(task, handle, i) \
  1206. do { if ((task)->dyn_handles) (task)->dyn_handles[i] = handle; else (task)->handles[i] = handle; } while(0)
  1207. /**
  1208. Return the access mode of the \p i -th data handle of \p codelet.
  1209. If \p codelet is defined with a static or dynamic number of
  1210. handles, will either return the \p i -th element of the field
  1211. starpu_codelet::modes or the \p i -th element of the field
  1212. starpu_codelet::dyn_modes (see \ref SettingManyDataHandlesForATask)
  1213. */
  1214. #define STARPU_CODELET_GET_MODE(codelet, i) \
  1215. (((codelet)->dyn_modes) ? (codelet)->dyn_modes[i] : (assert(i < STARPU_NMAXBUFS), (codelet)->modes[i]))
  1216. /**
  1217. Set the access mode of the \p i -th data handle of \p codelet. If
  1218. \p codelet is defined with a static or dynamic number of handles,
  1219. will either set the \p i -th element of the field
  1220. starpu_codelet::modes or the \p i -th element of the field
  1221. starpu_codelet::dyn_modes (see \ref SettingManyDataHandlesForATask)
  1222. */
  1223. #define STARPU_CODELET_SET_MODE(codelet, mode, i) \
  1224. do { if ((codelet)->dyn_modes) (codelet)->dyn_modes[i] = mode; else (codelet)->modes[i] = mode; } while(0)
  1225. /**
  1226. Return the access mode of the \p i -th data handle of \p task. If
  1227. \p task is defined with a static or dynamic number of handles, will
  1228. either return the \p i -th element of the field starpu_task::modes
  1229. or the \p i -th element of the field starpu_task::dyn_modes (see
  1230. \ref SettingManyDataHandlesForATask)
  1231. */
  1232. #define STARPU_TASK_GET_MODE(task, i) \
  1233. ((task)->cl->nbuffers == STARPU_VARIABLE_NBUFFERS || (task)->dyn_modes ? \
  1234. (((task)->dyn_modes) ? (task)->dyn_modes[i] : (task)->modes[i]) : \
  1235. STARPU_CODELET_GET_MODE((task)->cl, i) )
  1236. /**
  1237. Set the access mode of the \p i -th data handle of \p task. If \p
  1238. task is defined with a static or dynamic number of handles, will
  1239. either set the \p i -th element of the field starpu_task::modes or
  1240. the \p i -th element of the field starpu_task::dyn_modes (see \ref
  1241. SettingManyDataHandlesForATask)
  1242. */
  1243. #define STARPU_TASK_SET_MODE(task, mode, i) \
  1244. do { \
  1245. if ((task)->cl->nbuffers == STARPU_VARIABLE_NBUFFERS || (task)->cl->nbuffers > STARPU_NMAXBUFS) \
  1246. if ((task)->dyn_modes) (task)->dyn_modes[i] = mode; else (task)->modes[i] = mode; \
  1247. else \
  1248. { \
  1249. enum starpu_data_access_mode cl_mode = STARPU_CODELET_GET_MODE((task)->cl, i); \
  1250. STARPU_ASSERT_MSG(cl_mode == mode, \
  1251. "Task <%s> can't set its %d-th buffer mode to %d as the codelet it derives from uses %d", \
  1252. (task)->cl->name, i, mode, cl_mode); \
  1253. } \
  1254. } while(0)
  1255. /**
  1256. Return the target node of the \p i -th data handle of \p codelet.
  1257. If \p node is defined with a static or dynamic number of handles,
  1258. will either return the \p i -th element of the field
  1259. starpu_codelet::nodes or the \p i -th element of the field
  1260. starpu_codelet::dyn_nodes (see \ref SettingManyDataHandlesForATask)
  1261. */
  1262. #define STARPU_CODELET_GET_NODE(codelet, i) (((codelet)->dyn_nodes) ? (codelet)->dyn_nodes[i] : (codelet)->nodes[i])
  1263. /**
  1264. Set the target node of the \p i -th data handle of \p codelet. If
  1265. \p codelet is defined with a static or dynamic number of handles,
  1266. will either set the \p i -th element of the field
  1267. starpu_codelet::nodes or the \p i -th element of the field
  1268. starpu_codelet::dyn_nodes (see \ref SettingManyDataHandlesForATask)
  1269. */
  1270. #define STARPU_CODELET_SET_NODE(codelet, __node, i) \
  1271. do { if ((codelet)->dyn_nodes) (codelet)->dyn_nodes[i] = __node; else (codelet)->nodes[i] = __node; } while(0)
  1272. /**
  1273. Initialize \p task with default values. This function is implicitly
  1274. called by starpu_task_create(). By default, tasks initialized with
  1275. starpu_task_init() must be deinitialized explicitly with
  1276. starpu_task_clean(). Tasks can also be initialized statically,
  1277. using ::STARPU_TASK_INITIALIZER.
  1278. */
  1279. void starpu_task_init(struct starpu_task *task);
  1280. /**
  1281. Release all the structures automatically allocated to execute \p
  1282. task, but not the task structure itself and values set by the user
  1283. remain unchanged. It is thus useful for statically allocated tasks
  1284. for instance. It is also useful when users want to execute the same
  1285. operation several times with as least overhead as possible. It is
  1286. called automatically by starpu_task_destroy(). It has to be called
  1287. only after explicitly waiting for the task or after
  1288. starpu_shutdown() (waiting for the callback is not enough, since
  1289. StarPU still manipulates the task after calling the callback).
  1290. */
  1291. void starpu_task_clean(struct starpu_task *task);
  1292. /**
  1293. Allocate a task structure and initialize it with default values.
  1294. Tasks allocated dynamically with starpu_task_create() are
  1295. automatically freed when the task is terminated. This means that
  1296. the task pointer can not be used any more once the task is
  1297. submitted, since it can be executed at any time (unless
  1298. dependencies make it wait) and thus freed at any time. If the field
  1299. starpu_task::destroy is explicitly unset, the resources used by the
  1300. task have to be freed by calling starpu_task_destroy().
  1301. */
  1302. struct starpu_task *starpu_task_create(void) STARPU_ATTRIBUTE_MALLOC;
  1303. /**
  1304. Free the resource allocated during starpu_task_create() and
  1305. associated with \p task. This function is called automatically
  1306. after the execution of a task when the field starpu_task::destroy
  1307. is set, which is the default for tasks created by
  1308. starpu_task_create(). Calling this function on a statically
  1309. allocated task results in an undefined behaviour.
  1310. */
  1311. void starpu_task_destroy(struct starpu_task *task);
  1312. /**
  1313. Submit \p task to StarPU. Calling this function does not mean that
  1314. the task will be executed immediately as there can be data or task
  1315. (tag) dependencies that are not fulfilled yet: StarPU will take
  1316. care of scheduling this task with respect to such dependencies.
  1317. This function returns immediately if the field
  1318. starpu_task::synchronous is set to 0, and block until the
  1319. termination of the task otherwise. It is also possible to
  1320. synchronize the application with asynchronous tasks by the means of
  1321. tags, using the function starpu_tag_wait() function for instance.
  1322. In case of success, this function returns 0, a return value of
  1323. <c>-ENODEV</c> means that there is no worker able to process this
  1324. task (e.g. there is no GPU available and this task is only
  1325. implemented for CUDA devices). starpu_task_submit() can be called
  1326. from anywhere, including codelet functions and callbacks, provided
  1327. that the field starpu_task::synchronous is set to 0.
  1328. */
  1329. int starpu_task_submit(struct starpu_task *task) STARPU_WARN_UNUSED_RESULT;
  1330. #ifdef STARPU_USE_FXT
  1331. static inline int starpu_task_submit_line(struct starpu_task *task, const char *file, int line)
  1332. {
  1333. task->file = file;
  1334. task->line = line;
  1335. return starpu_task_submit(task);
  1336. }
  1337. #define starpu_task_submit(task) starpu_task_submit_line((task), __FILE__, __LINE__)
  1338. #endif
  1339. /**
  1340. Submit \p task to StarPU with dependency bypass.
  1341. This can only be called on behalf of another task which has already taken the
  1342. proper dependencies, e.g. this task is just an attempt of doing the actual
  1343. computation of that task.
  1344. */
  1345. int starpu_task_submit_nodeps(struct starpu_task *task) STARPU_WARN_UNUSED_RESULT;
  1346. /**
  1347. Submit \p task to the context \p sched_ctx_id. By default,
  1348. starpu_task_submit() submits the task to a global context that is
  1349. created automatically by StarPU.
  1350. */
  1351. int starpu_task_submit_to_ctx(struct starpu_task *task, unsigned sched_ctx_id);
  1352. /**
  1353. Return 1 if \p task is terminated
  1354. */
  1355. int starpu_task_finished(struct starpu_task *task) STARPU_WARN_UNUSED_RESULT;
  1356. /**
  1357. Block until \p task has been executed. It is not possible to
  1358. synchronize with a task more than once. It is not possible to wait
  1359. for synchronous or detached tasks. Upon successful completion, this
  1360. function returns 0. Otherwise, <c>-EINVAL</c> indicates that the
  1361. specified task was either synchronous or detached.
  1362. */
  1363. int starpu_task_wait(struct starpu_task *task) STARPU_WARN_UNUSED_RESULT;
  1364. /**
  1365. Allow to wait for an array of tasks. Upon successful completion,
  1366. this function returns 0. Otherwise, <c>-EINVAL</c> indicates that
  1367. one of the tasks was either synchronous or detached.
  1368. */
  1369. int starpu_task_wait_array(struct starpu_task **tasks, unsigned nb_tasks) STARPU_WARN_UNUSED_RESULT;
  1370. /**
  1371. Block until all the tasks that were submitted (to the current
  1372. context or the global one if there is no current context) are
  1373. terminated. It does not destroy these tasks.
  1374. */
  1375. int starpu_task_wait_for_all(void);
  1376. /**
  1377. Block until there are \p n submitted tasks left (to the current
  1378. context or the global one if there is no current context) to be
  1379. executed. It does not destroy these tasks.
  1380. */
  1381. int starpu_task_wait_for_n_submitted(unsigned n);
  1382. /**
  1383. Wait until all the tasks that were already submitted to the context
  1384. \p sched_ctx_id have been terminated.
  1385. */
  1386. int starpu_task_wait_for_all_in_ctx(unsigned sched_ctx_id);
  1387. /**
  1388. Wait until there are \p n tasks submitted left to be
  1389. executed that were already submitted to the context \p
  1390. sched_ctx_id.
  1391. */
  1392. int starpu_task_wait_for_n_submitted_in_ctx(unsigned sched_ctx_id, unsigned n);
  1393. /**
  1394. Wait until there is no more ready task.
  1395. */
  1396. int starpu_task_wait_for_no_ready(void);
  1397. /**
  1398. Return the number of submitted tasks which are ready for execution
  1399. are already executing. It thus does not include tasks waiting for
  1400. dependencies.
  1401. */
  1402. int starpu_task_nready(void);
  1403. /**
  1404. Return the number of submitted tasks which have not completed yet.
  1405. */
  1406. int starpu_task_nsubmitted(void);
  1407. /**
  1408. Set the iteration number for all the tasks to be submitted after
  1409. this call. This is typically called at the beginning of a task
  1410. submission loop. This number will then show up in tracing tools. A
  1411. corresponding starpu_iteration_pop() call must be made to match the
  1412. call to starpu_iteration_push(), at the end of the same task
  1413. submission loop, typically.
  1414. Nested calls to starpu_iteration_push() and starpu_iteration_pop()
  1415. are allowed, to describe a loop nest for instance, provided that
  1416. they match properly.
  1417. */
  1418. void starpu_iteration_push(unsigned long iteration);
  1419. /**
  1420. Drop the iteration number for submitted tasks. This must match a
  1421. previous call to starpu_iteration_push(), and is typically called
  1422. at the end of a task submission loop.
  1423. */
  1424. void starpu_iteration_pop(void);
  1425. void starpu_do_schedule(void);
  1426. /**
  1427. Initialize \p cl with default values. Codelets should preferably be
  1428. initialized statically as shown in \ref DefiningACodelet. However
  1429. such a initialisation is not always possible, e.g. when using C++.
  1430. */
  1431. void starpu_codelet_init(struct starpu_codelet *cl);
  1432. /**
  1433. Output on \c stderr some statistics on the codelet \p cl.
  1434. */
  1435. void starpu_codelet_display_stats(struct starpu_codelet *cl);
  1436. /**
  1437. Return the task currently executed by the worker, or <c>NULL</c> if
  1438. it is called either from a thread that is not a task or simply
  1439. because there is no task being executed at the moment.
  1440. */
  1441. struct starpu_task *starpu_task_get_current(void);
  1442. /**
  1443. Return the memory node number of parameter \p i of the task
  1444. currently executed, or -1 if it is called either from a thread that
  1445. is not a task or simply because there is no task being executed at
  1446. the moment.
  1447. Usually, the returned memory node number is simply the memory node
  1448. for the current worker. That may however be different when using
  1449. e.g. starpu_codelet::specific_nodes.
  1450. */
  1451. int starpu_task_get_current_data_node(unsigned i);
  1452. /**
  1453. Return the name of the performance model of \p task.
  1454. */
  1455. const char *starpu_task_get_model_name(struct starpu_task *task);
  1456. /**
  1457. Return the name of \p task, i.e. either its starpu_task::name
  1458. field, or the name of the corresponding performance model.
  1459. */
  1460. const char *starpu_task_get_name(struct starpu_task *task);
  1461. /**
  1462. Allocate a task structure which is the exact duplicate of \p task.
  1463. */
  1464. struct starpu_task *starpu_task_dup(struct starpu_task *task);
  1465. /**
  1466. This function should be called by schedulers to specify the
  1467. codelet implementation to be executed when executing \p task.
  1468. */
  1469. void starpu_task_set_implementation(struct starpu_task *task, unsigned impl);
  1470. /**
  1471. Return the codelet implementation to be executed
  1472. when executing \p task.
  1473. */
  1474. unsigned starpu_task_get_implementation(struct starpu_task *task);
  1475. /**
  1476. Create and submit an empty task that unlocks a tag once all its
  1477. dependencies are fulfilled.
  1478. */
  1479. void starpu_create_sync_task(starpu_tag_t sync_tag, unsigned ndeps, starpu_tag_t *deps, void (*callback)(void *), void *callback_arg);
  1480. /**
  1481. Create and submit an empty task with the given callback
  1482. */
  1483. void starpu_create_callback_task(void (*callback)(void *), void *callback_arg);
  1484. /**
  1485. Function to be used as a prologue callback to enable fault tolerance for the
  1486. task. This prologue will create a try-task, i.e a duplicate of the task,
  1487. which will to the actual computation.
  1488. The prologue argument can be set to a check_ft function that will be
  1489. called on termination of the duplicate, which can check the result of the
  1490. task, and either confirm success, or resubmit another attempt.
  1491. If it is not set, the default implementation is to just resubmit a new
  1492. try-task.
  1493. */
  1494. void starpu_task_ft_prologue(void *check_ft);
  1495. /**
  1496. Create a try-task for a \p meta_task, given a \p template_task task
  1497. template. The meta task can be passed as template on the first call, but
  1498. since it is mangled by starpu_task_ft_create_retry(), further calls
  1499. (typically made by the check_ft callback) need to be passed the previous
  1500. try-task as template task.
  1501. \p check_ft is similar to the prologue argument of
  1502. starpu_task_ft_prologue(), and is typicall set to the very function calling
  1503. starpu_task_ft_create_retry().
  1504. The try-task is returned, and can be modified (e.g. to change scheduling
  1505. parameters) before being submitted with starpu_task_submit_nodeps().
  1506. */
  1507. struct starpu_task * starpu_task_ft_create_retry(const struct starpu_task *meta_task, const struct starpu_task *template_task, void (*check_ft)(void*));
  1508. /**
  1509. Record that this task failed, and should thus be retried.
  1510. This is usually called from the task codelet function itself, after checking
  1511. the result and noticing that the computation went wrong, and thus the task
  1512. should be retried. The performance of this task execution will not be
  1513. recorded for performance models.
  1514. This can only be called for a task whose data access modes are either
  1515. STARPU_R and STARPU_W.
  1516. */
  1517. void starpu_task_ft_failed(struct starpu_task *task);
  1518. /**
  1519. Notify that the try-task was successful and thus the meta-task was
  1520. successful.
  1521. */
  1522. void starpu_task_ft_success(struct starpu_task *meta_task);
  1523. /**
  1524. Set the function to call when the watchdog detects that StarPU has
  1525. not finished any task for STARPU_WATCHDOG_TIMEOUT seconds
  1526. */
  1527. void starpu_task_watchdog_set_hook(void (*hook)(void *), void *hook_arg);
  1528. /**
  1529. * Return the given status as a string
  1530. */
  1531. char *starpu_task_status_get_as_string(enum starpu_task_status status);
  1532. /** @} */
  1533. #ifdef __cplusplus
  1534. }
  1535. #endif
  1536. #endif /* __STARPU_TASK_H__ */