fstarpu_mod.f90 102 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691
  1. ! StarPU --- Runtime system for heterogeneous multicore architectures.
  2. !
  3. ! Copyright (C) 2016 Inria
  4. !
  5. ! StarPU is free software; you can redistribute it and/or modify
  6. ! it under the terms of the GNU Lesser General Public License as published by
  7. ! the Free Software Foundation; either version 2.1 of the License, or (at
  8. ! your option) any later version.
  9. !
  10. ! StarPU is distributed in the hope that it will be useful, but
  11. ! WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. !
  14. ! See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. module fstarpu_mod
  16. use iso_c_binding
  17. implicit none
  18. ! Note: Constants truly are intptr_t, but are declared as c_ptr to be
  19. ! readily usable in c_ptr arrays to mimic variadic functions.
  20. ! Note: Bitwise or operator is provided by the .ior. overloaded operator
  21. type(c_ptr), bind(C) :: FSTARPU_R
  22. type(c_ptr), bind(C) :: FSTARPU_W
  23. type(c_ptr), bind(C) :: FSTARPU_RW
  24. type(c_ptr), bind(C) :: FSTARPU_SCRATCH
  25. type(c_ptr), bind(C) :: FSTARPU_REDUX
  26. type(c_ptr), bind(C) :: FSTARPU_COMMUTE
  27. type(c_ptr), bind(C) :: FSTARPU_SSEND
  28. type(c_ptr), bind(C) :: FSTARPU_LOCALITY
  29. type(c_ptr), bind(C) :: FSTARPU_DATA_ARRAY
  30. type(c_ptr), bind(C) :: FSTARPU_DATA_MODE_ARRAY
  31. type(c_ptr), bind(C) :: FSTARPU_CL_ARGS
  32. type(c_ptr), bind(C) :: FSTARPU_CALLBACK
  33. type(c_ptr), bind(C) :: FSTARPU_CALLBACK_WITH_ARG
  34. type(c_ptr), bind(C) :: FSTARPU_CALLBACK_ARG
  35. type(c_ptr), bind(C) :: FSTARPU_PROLOGUE_CALLBACK
  36. type(c_ptr), bind(C) :: FSTARPU_PROLOGUE_CALLBACK_ARG
  37. type(c_ptr), bind(C) :: FSTARPU_PROLOGUE_CALLBACK_POP
  38. type(c_ptr), bind(C) :: FSTARPU_PROLOGUE_CALLBACK_POP_ARG
  39. type(c_ptr), bind(C) :: FSTARPU_PRIORITY
  40. type(c_ptr), bind(C) :: FSTARPU_EXECUTE_ON_NODE
  41. type(c_ptr), bind(C) :: FSTARPU_EXECUTE_ON_DATA
  42. type(c_ptr), bind(C) :: FSTARPU_EXECUTE_ON_WORKER
  43. type(c_ptr), bind(C) :: FSTARPU_WORKER_ORDER
  44. type(c_ptr), bind(C) :: FSTARPU_HYPERVISOR_TAG
  45. type(c_ptr), bind(C) :: FSTARPU_POSSIBLY_PARALLEL
  46. type(c_ptr), bind(C) :: FSTARPU_FLOPS
  47. type(c_ptr), bind(C) :: FSTARPU_TAG
  48. type(c_ptr), bind(C) :: FSTARPU_TAG_ONLY
  49. type(c_ptr), bind(C) :: FSTARPU_NAME
  50. type(c_ptr), bind(C) :: FSTARPU_NODE_SELECTION_POLICY
  51. type(c_ptr), bind(C) :: FSTARPU_VALUE
  52. type(c_ptr), bind(C) :: FSTARPU_SCHED_CTX
  53. type(c_ptr), bind(C) :: FSTARPU_CPU_WORKER
  54. type(c_ptr), bind(C) :: FSTARPU_CUDA_WORKER
  55. type(c_ptr), bind(C) :: FSTARPU_OPENCL_WORKER
  56. type(c_ptr), bind(C) :: FSTARPU_MIC_WORKER
  57. type(c_ptr), bind(C) :: FSTARPU_SCC_WORKER
  58. type(c_ptr), bind(C) :: FSTARPU_ANY_WORKER
  59. integer(c_int), bind(C) :: FSTARPU_NMAXBUFS
  60. type(c_ptr), bind(C) :: FSTARPU_SZ_C_INT
  61. type(c_ptr), bind(C) :: FSTARPU_SZ_C_INTPTR_T
  62. type(c_ptr), bind(C) :: FSTARPU_SZ_INT4
  63. type(c_ptr), bind(C) :: FSTARPU_SZ_INT8
  64. type(c_ptr), bind(C) :: FSTARPU_SZ_REAL4
  65. type(c_ptr), bind(C) :: FSTARPU_SZ_REAL8
  66. interface operator (.ior.)
  67. procedure or_cptrs
  68. end interface operator (.ior.)
  69. interface
  70. ! == starpu.h ==
  71. ! void starpu_conf_init(struct starpu_conf *conf);
  72. subroutine fstarpu_conf_init (conf) bind(C,name="starpu_conf_init")
  73. use iso_c_binding, only: c_ptr
  74. type(c_ptr), value, intent(in) :: conf
  75. end subroutine fstarpu_conf_init
  76. function fstarpu_conf_allocate () bind(C)
  77. use iso_c_binding, only: c_ptr
  78. type(c_ptr) :: fstarpu_conf_allocate
  79. end function fstarpu_conf_allocate
  80. subroutine fstarpu_conf_free (conf) bind(C)
  81. use iso_c_binding, only: c_ptr
  82. type(c_ptr), value, intent(in) :: conf
  83. end subroutine fstarpu_conf_free
  84. subroutine fstarpu_conf_set_sched_policy_name (conf, policy_name) bind(C)
  85. use iso_c_binding, only: c_ptr, c_char
  86. type(c_ptr), value, intent(in) :: conf
  87. character(c_char), intent(in) :: policy_name
  88. end subroutine fstarpu_conf_set_sched_policy_name
  89. subroutine fstarpu_conf_set_min_prio (conf, min_prio) bind(C)
  90. use iso_c_binding, only: c_ptr, c_int
  91. type(c_ptr), value, intent(in) :: conf
  92. integer(c_int), value, intent(in) :: min_prio
  93. end subroutine fstarpu_conf_set_min_prio
  94. subroutine fstarpu_conf_set_max_prio (conf, max_prio) bind(C)
  95. use iso_c_binding, only: c_ptr, c_int
  96. type(c_ptr), value, intent(in) :: conf
  97. integer(c_int), value, intent(in) :: max_prio
  98. end subroutine fstarpu_conf_set_max_prio
  99. subroutine fstarpu_conf_set_ncpu (conf, ncpu) bind(C)
  100. use iso_c_binding, only: c_ptr, c_int
  101. type(c_ptr), value, intent(in) :: conf
  102. integer(c_int), value, intent(in) :: ncpu
  103. end subroutine fstarpu_conf_set_ncpu
  104. subroutine fstarpu_conf_set_ncuda (conf, ncuda) bind(C)
  105. use iso_c_binding, only: c_ptr, c_int
  106. type(c_ptr), value, intent(in) :: conf
  107. integer(c_int), value, intent(in) :: ncuda
  108. end subroutine fstarpu_conf_set_ncuda
  109. subroutine fstarpu_conf_set_nopencl (conf, nopencl) bind(C)
  110. use iso_c_binding, only: c_ptr, c_int
  111. type(c_ptr), value, intent(in) :: conf
  112. integer(c_int), value, intent(in) :: nopencl
  113. end subroutine fstarpu_conf_set_nopencl
  114. subroutine fstarpu_conf_set_nmic (conf, nmic) bind(C)
  115. use iso_c_binding, only: c_ptr, c_int
  116. type(c_ptr), value, intent(in) :: conf
  117. integer(c_int), value, intent(in) :: nmic
  118. end subroutine fstarpu_conf_set_nmic
  119. subroutine fstarpu_conf_set_nscc (conf, nscc) bind(C)
  120. use iso_c_binding, only: c_ptr, c_int
  121. type(c_ptr), value, intent(in) :: conf
  122. integer(c_int), value, intent(in) :: nscc
  123. end subroutine fstarpu_conf_set_nscc
  124. ! starpu_init: see fstarpu_init
  125. ! starpu_initialize: see fstarpu_init
  126. ! void starpu_pause(void);
  127. subroutine fstarpu_pause() bind(C,name="starpu_pause")
  128. end subroutine fstarpu_pause
  129. ! void starpu_resume(void);
  130. subroutine fstarpu_resume() bind(C,name="starpu_resume")
  131. end subroutine fstarpu_resume
  132. ! void starpu_shutdown(void);
  133. subroutine fstarpu_shutdown () bind(C,name="starpu_shutdown")
  134. end subroutine fstarpu_shutdown
  135. ! starpu_topology_print
  136. subroutine fstarpu_topology_print () bind(C)
  137. end subroutine fstarpu_topology_print
  138. ! int starpu_asynchronous_copy_disabled(void);
  139. function fstarpu_asynchronous_copy_disabled() bind(C,name="starpu_asynchronous_copy_disabled")
  140. use iso_c_binding, only: c_int
  141. integer(c_int) :: fstarpu_asynchronous_copy_disabled
  142. end function fstarpu_asynchronous_copy_disabled
  143. ! int starpu_asynchronous_cuda_copy_disabled(void);
  144. function fstarpu_asynchronous_cuda_copy_disabled() bind(C,name="starpu_asynchronous_cuda_copy_disabled")
  145. use iso_c_binding, only: c_int
  146. integer(c_int) :: fstarpu_asynchronous_cuda_copy_disabled
  147. end function fstarpu_asynchronous_cuda_copy_disabled
  148. ! int starpu_asynchronous_opencl_copy_disabled(void);
  149. function fstarpu_asynchronous_opencl_copy_disabled() bind(C,name="starpu_asynchronous_opencl_copy_disabled")
  150. use iso_c_binding, only: c_int
  151. integer(c_int) :: fstarpu_asynchronous_opencl_copy_disabled
  152. end function fstarpu_asynchronous_opencl_copy_disabled
  153. ! int starpu_asynchronous_mic_copy_disabled(void);
  154. function fstarpu_asynchronous_mic_copy_disabled() bind(C,name="starpu_asynchronous_mic_copy_disabled")
  155. use iso_c_binding, only: c_int
  156. integer(c_int) :: fstarpu_asynchronous_mic_copy_disabled
  157. end function fstarpu_asynchronous_mic_copy_disabled
  158. ! void starpu_display_stats();
  159. subroutine fstarpu_display_stats() bind(C,name="starpu_display_stats")
  160. end subroutine fstarpu_display_stats
  161. ! void starpu_get_version(int *major, int *minor, int *release);
  162. subroutine fstarpu_get_version(major,minor,release) bind(C,name="starpu_get_version")
  163. use iso_c_binding, only: c_int
  164. integer(c_int), intent(out) :: major,minor,release
  165. end subroutine fstarpu_get_version
  166. ! == starpu_worker.h ==
  167. ! unsigned starpu_worker_get_count(void);
  168. function fstarpu_worker_get_count() bind(C,name="starpu_worker_get_count")
  169. use iso_c_binding, only: c_int
  170. integer(c_int) :: fstarpu_worker_get_count
  171. end function fstarpu_worker_get_count
  172. ! unsigned starpu_combined_worker_get_count(void);
  173. function fstarpu_combined_worker_get_count() bind(C,name="starpu_combined_worker_get_count")
  174. use iso_c_binding, only: c_int
  175. integer(c_int) :: fstarpu_combined_worker_get_count
  176. end function fstarpu_combined_worker_get_count
  177. ! unsigned starpu_worker_is_combined_worker(int id);
  178. function fstarpu_worker_is_combined_worker(id) bind(C,name="starpu_worker_is_combined_worker")
  179. use iso_c_binding, only: c_int
  180. integer(c_int) :: fstarpu_worker_is_combined_worker
  181. integer(c_int), value, intent(in) :: id
  182. end function fstarpu_worker_is_combined_worker
  183. ! unsigned starpu_cpu_worker_get_count(void);
  184. function fstarpu_cpu_worker_get_count() bind(C,name="starpu_cpu_worker_get_count")
  185. use iso_c_binding, only: c_int
  186. integer(c_int) :: fstarpu_cpu_worker_get_count
  187. end function fstarpu_cpu_worker_get_count
  188. ! unsigned starpu_cuda_worker_get_count(void);
  189. function fstarpu_cuda_worker_get_count() bind(C,name="starpu_cuda_worker_get_count")
  190. use iso_c_binding, only: c_int
  191. integer(c_int) :: fstarpu_cuda_worker_get_count
  192. end function fstarpu_cuda_worker_get_count
  193. ! unsigned starpu_opencl_worker_get_count(void);
  194. function fstarpu_opencl_worker_get_count() bind(C,name="starpu_opencl_worker_get_count")
  195. use iso_c_binding, only: c_int
  196. integer(c_int) :: fstarpu_opencl_worker_get_count
  197. end function fstarpu_opencl_worker_get_count
  198. ! unsigned starpu_mic_worker_get_count(void);
  199. function fstarpu_mic_worker_get_count() bind(C,name="starpu_mic_worker_get_count")
  200. use iso_c_binding, only: c_int
  201. integer(c_int) :: fstarpu_mic_worker_get_count
  202. end function fstarpu_mic_worker_get_count
  203. ! unsigned starpu_scc_worker_get_count(void);
  204. function fstarpu_scc_worker_get_count() bind(C,name="starpu_scc_worker_get_count")
  205. use iso_c_binding, only: c_int
  206. integer(c_int) :: fstarpu_scc_worker_get_count
  207. end function fstarpu_scc_worker_get_count
  208. ! int starpu_worker_get_id(void);
  209. function fstarpu_worker_get_id() bind(C,name="starpu_worker_get_id")
  210. use iso_c_binding, only: c_int
  211. integer(c_int) :: fstarpu_worker_get_id
  212. end function fstarpu_worker_get_id
  213. ! _starpu_worker_get_id_check
  214. ! starpu_worker_get_id_check
  215. ! int starpu_worker_get_bindid(int workerid);
  216. function fstarpu_worker_get_bindid(id) bind(C,name="starpu_worker_get_bindid")
  217. use iso_c_binding, only: c_int
  218. integer(c_int) :: fstarpu_worker_get_bindid
  219. integer(c_int), value, intent(in) :: id
  220. end function fstarpu_worker_get_bindid
  221. ! int starpu_combined_worker_get_id(void);
  222. function fstarpu_combined_worker_get_id() bind(C,name="starpu_combined_worker_get_id")
  223. use iso_c_binding, only: c_int
  224. integer(c_int) :: fstarpu_combined_worker_get_id
  225. end function fstarpu_combined_worker_get_id
  226. ! int starpu_combined_worker_get_size(void);
  227. function fstarpu_combined_worker_get_size() bind(C,name="starpu_combined_worker_get_size")
  228. use iso_c_binding, only: c_int
  229. integer(c_int) :: fstarpu_combined_worker_get_size
  230. end function fstarpu_combined_worker_get_size
  231. ! int starpu_combined_worker_get_rank(void);
  232. function fstarpu_combined_worker_get_rank() bind(C,name="starpu_combined_worker_get_rank")
  233. use iso_c_binding, only: c_int
  234. integer(c_int) :: fstarpu_combined_worker_get_rank
  235. end function fstarpu_combined_worker_get_rank
  236. ! enum starpu_worker_archtype starpu_worker_get_type(int id);
  237. function fstarpu_worker_get_type(id) bind(C)
  238. use iso_c_binding, only: c_int, c_ptr
  239. type(c_ptr) :: fstarpu_worker_get_type ! C function returns c_intptr_t
  240. integer(c_int),value,intent(in) :: id
  241. end function fstarpu_worker_get_type
  242. ! int starpu_worker_get_count_by_type(enum starpu_worker_archtype type);
  243. function fstarpu_worker_get_count_by_type(typeid) bind(C)
  244. use iso_c_binding, only: c_int, c_ptr
  245. integer(c_int) :: fstarpu_worker_get_count_by_type
  246. type(c_ptr),value,intent(in) :: typeid ! c_intptr_t expected by C func
  247. end function fstarpu_worker_get_count_by_type
  248. ! int starpu_worker_get_ids_by_type(enum starpu_worker_archtype type, int *workerids, int maxsize);
  249. function fstarpu_worker_get_ids_by_type(typeid, workerids, maxsize) bind(C)
  250. use iso_c_binding, only: c_int, c_ptr
  251. integer(c_int) :: fstarpu_worker_get_ids_by_type
  252. type(c_ptr),value,intent(in) :: typeid ! c_intptr_t expected by C func
  253. integer(c_int),intent(out) :: workerids(*)
  254. integer(c_int),value,intent(in) :: maxsize
  255. end function fstarpu_worker_get_ids_by_type
  256. ! int starpu_worker_get_by_type(enum starpu_worker_archtype type, int num);
  257. function fstarpu_worker_get_by_type(typeid, num) bind(C)
  258. use iso_c_binding, only: c_int, c_ptr
  259. integer(c_int) :: fstarpu_worker_get_by_type
  260. type(c_ptr),value,intent(in) :: typeid ! c_intptr_t expected by C func
  261. integer(c_int),value,intent(in) :: num
  262. end function fstarpu_worker_get_by_type
  263. ! int starpu_worker_get_by_devid(enum starpu_worker_archtype type, int devid);
  264. function fstarpu_worker_get_by_devid(typeid, devid) bind(C)
  265. use iso_c_binding, only: c_int, c_ptr
  266. integer(c_int) :: fstarpu_worker_get_by_type
  267. type(c_ptr),value,intent(in) :: typeid ! c_intptr_t expected by C func
  268. integer(c_int),value,intent(in) :: devid
  269. end function fstarpu_worker_get_by_devid
  270. ! void starpu_worker_get_name(int id, char *dst, size_t maxlen);
  271. subroutine fstarpu_worker_get_name(id, dst, maxlen) bind(C,name="starpu_worker_get_name")
  272. use iso_c_binding, only: c_int, c_char, c_size_t
  273. integer(c_int),value,intent(in) :: id
  274. character(c_char),intent(out) :: dst(*)
  275. integer(c_size_t),value,intent(in) :: maxlen
  276. end subroutine fstarpu_worker_get_name
  277. ! int starpu_worker_get_devid(int id);
  278. function fstarpu_worker_get_devid(id) bind(C,name="starpu_worker_get_devid")
  279. use iso_c_binding, only: c_int
  280. integer(c_int) :: fstarpu_worker_get_devid
  281. integer(c_int), value, intent(in) :: id
  282. end function fstarpu_worker_get_devid
  283. ! int starpu_worker_get_mp_nodeid(int id);
  284. function fstarpu_worker_get_mp_nodeid(id) bind(C,name="starpu_worker_get_mp_nodeid")
  285. use iso_c_binding, only: c_int
  286. integer(c_int) :: fstarpu_worker_get_mp_nodeid
  287. integer(c_int), value, intent(in) :: id
  288. end function fstarpu_worker_get_mp_nodeid
  289. ! struct starpu_tree* starpu_workers_get_tree(void);
  290. ! unsigned starpu_worker_get_sched_ctx_list(int worker, unsigned **sched_ctx);
  291. ! unsigned starpu_worker_is_blocked(int workerid);
  292. function fstarpu_worker_is_blocked(id) bind(C,name="starpu_worker_is_blocked")
  293. use iso_c_binding, only: c_int
  294. integer(c_int) :: fstarpu_worker_is_blocked
  295. integer(c_int), value, intent(in) :: id
  296. end function fstarpu_worker_is_blocked
  297. ! unsigned starpu_worker_is_slave_somewhere(int workerid);
  298. function fstarpu_worker_is_slave_somewhere(id) bind(C,name="starpu_worker_is_slave_somewhere")
  299. use iso_c_binding, only: c_int
  300. integer(c_int) :: fstarpu_worker_is_slave_somewhere
  301. integer(c_int), value, intent(in) :: id
  302. end function fstarpu_worker_is_slave_somewhere
  303. ! char *starpu_worker_get_type_as_string(enum starpu_worker_archtype type);
  304. subroutine fstarpu_worker_get_type_as_string(typeid,dst,maxlen) bind(C)
  305. use iso_c_binding, only: c_ptr, c_char, c_size_t
  306. type(c_ptr),value,intent(in) :: typeid ! c_intptr_t expected by C func
  307. character(c_char),intent(out) :: dst(*)
  308. integer(c_size_t),value,intent(in) :: maxlen
  309. end subroutine fstarpu_worker_get_type_as_string
  310. ! int starpu_bindid_get_workerids(int bindid, int **workerids);
  311. ! == starpu_task.h ==
  312. ! void starpu_tag_declare_deps(starpu_tag_t id, unsigned ndeps, ...);
  313. ! void starpu_tag_declare_deps_array(starpu_tag_t id, unsigned ndeps, starpu_tag_t *array);
  314. subroutine fstarpu_tag_declare_deps_array(id,ndeps,tag_array) bind(C,name="starpu_tag_declare_deps_array")
  315. use iso_c_binding, only: c_int, c_long_long
  316. integer(c_int), value, intent(in) :: id
  317. integer(c_int), value, intent(in) :: ndeps
  318. integer(c_long_long), intent(in) :: tag_array(*)
  319. end subroutine fstarpu_tag_declare_deps_array
  320. ! void starpu_task_declare_deps_array(struct starpu_task *task, unsigned ndeps, struct starpu_task *task_array[]);
  321. subroutine fstarpu_task_declare_deps_array(task,ndeps,task_array) bind(C,name="starpu_task_declare_deps_array")
  322. use iso_c_binding, only: c_int, c_ptr
  323. type(c_ptr), value, intent(in) :: task
  324. integer(c_int), value, intent(in) :: ndeps
  325. type(c_ptr), intent(in) :: task_array(*)
  326. end subroutine fstarpu_task_declare_deps_array
  327. ! int starpu_tag_wait(starpu_tag_t id);
  328. function fstarpu_tag_wait(id) bind(C,name="starpu_tag_wait")
  329. use iso_c_binding, only: c_int, c_long_long
  330. integer(c_int) :: fstarpu_tag_wait
  331. integer(c_long_long), value, intent(in) :: id
  332. end function fstarpu_tag_wait
  333. ! int starpu_tag_wait_array(unsigned ntags, starpu_tag_t *id);
  334. function fstarpu_tag_wait_array(ntags,tag_array) bind(C,name="starpu_tag_wait_array")
  335. use iso_c_binding, only: c_int, c_long_long
  336. integer(c_int) :: fstarpu_tag_wait_array
  337. integer(c_int), value, intent(in) :: ntags
  338. integer(c_long_long), intent(in) :: tag_array(*)
  339. end function fstarpu_tag_wait_array
  340. ! void starpu_tag_notify_from_apps(starpu_tag_t id);
  341. subroutine fstarpu_tag_notify_from_apps(id) bind(C,name="starpu_tag_notify_from_apps")
  342. use iso_c_binding, only: c_long_long
  343. integer(c_long_long), value, intent(in) :: id
  344. end subroutine fstarpu_tag_notify_from_apps
  345. ! void starpu_tag_restart(starpu_tag_t id);
  346. subroutine fstarpu_tag_restart(id) bind(C,name="starpu_tag_restart")
  347. use iso_c_binding, only: c_long_long
  348. integer(c_long_long), value, intent(in) :: id
  349. end subroutine fstarpu_tag_restart
  350. ! void starpu_tag_remove(starpu_tag_t id);
  351. subroutine fstarpu_tag_remove(id) bind(C,name="starpu_tag_remove")
  352. use iso_c_binding, only: c_long_long
  353. integer(c_long_long), value, intent(in) :: id
  354. end subroutine fstarpu_tag_remove
  355. ! struct starpu_task *starpu_tag_get_task(starpu_tag_t id);
  356. function fstarpu_tag_get_task(id) bind(C,name="starpu_tag_get_task")
  357. use iso_c_binding, only: c_ptr, c_long_long
  358. type(c_ptr) :: fstarpu_tag_get_task
  359. integer(c_long_long), value, intent(in) :: id
  360. end function fstarpu_tag_get_task
  361. ! void starpu_task_init(struct starpu_task *task);
  362. subroutine fstarpu_task_init (task) bind(C,name="starpu_task_init")
  363. use iso_c_binding, only: c_ptr
  364. type(c_ptr), value, intent(in) :: task
  365. end subroutine fstarpu_task_init
  366. ! void starpu_task_clean(struct starpu_task *task);
  367. subroutine fstarpu_task_clean (task) bind(C,name="starpu_task_clean")
  368. use iso_c_binding, only: c_ptr
  369. type(c_ptr), value, intent(in) :: task
  370. end subroutine fstarpu_task_clean
  371. ! struct starpu_task *starpu_task_create(void) STARPU_ATTRIBUTE_MALLOC;
  372. function fstarpu_task_create () bind(C,name="starpu_task_create")
  373. use iso_c_binding, only: c_ptr
  374. type(c_ptr) :: fstarpu_task_create
  375. end function fstarpu_task_create
  376. ! void starpu_task_destroy(struct starpu_task *task);
  377. subroutine fstarpu_task_destroy (task) bind(C,name="starpu_task_destroy")
  378. use iso_c_binding, only: c_ptr
  379. type(c_ptr), value, intent(in) :: task
  380. end subroutine fstarpu_task_destroy
  381. ! int starpu_task_submit(struct starpu_task *task) STARPU_WARN_UNUSED_RESULT;
  382. function fstarpu_task_submit (task) bind(C,name="starpu_task_submit")
  383. use iso_c_binding, only: c_int,c_ptr
  384. integer(c_int) :: fstarpu_task_submit
  385. type(c_ptr), value, intent(in) :: task
  386. end function fstarpu_task_submit
  387. ! int starpu_task_submit_to_ctx(struct starpu_task *task, unsigned sched_ctx_id);
  388. function fstarpu_task_submit_to_ctx (task,sched_ctx_id) bind(C,name="starpu_task_submit_to_ctx")
  389. use iso_c_binding, only: c_int,c_ptr
  390. integer(c_int) :: fstarpu_task_submit_to_ctx
  391. type(c_ptr), value, intent(in) :: task
  392. integer(c_int), value, intent(in) :: sched_ctx_id
  393. end function fstarpu_task_submit_to_ctx
  394. ! int starpu_task_finished(struct starpu_task *task) STARPU_WARN_UNUSED_RESULT;
  395. function fstarpu_task_finished (task) bind(C,name="starpu_task_finished")
  396. use iso_c_binding, only: c_int,c_ptr
  397. integer(c_int) :: fstarpu_task_finished
  398. type(c_ptr), value, intent(in) :: task
  399. end function fstarpu_task_finished
  400. ! int starpu_task_wait(struct starpu_task *task) STARPU_WARN_UNUSED_RESULT;
  401. function fstarpu_task_wait (task) bind(C,name="starpu_task_wait")
  402. use iso_c_binding, only: c_int,c_ptr
  403. integer(c_int) :: fstarpu_task_wait
  404. type(c_ptr), value, intent(in) :: task
  405. end function fstarpu_task_wait
  406. ! int starpu_task_wait_array(struct starpu_task **tasks, unsigned nb_tasks) STARPU_WARN_UNUSED_RESULT;
  407. function fstarpu_task_wait_array(task_array,ntasks) bind(C,name="starpu_task_wait_array")
  408. use iso_c_binding, only: c_int, c_ptr
  409. integer(c_int) :: fstarpu_task_wait_array
  410. integer(c_int), value, intent(in) :: ntasks
  411. type(c_ptr), intent(in) :: task_array
  412. end function fstarpu_task_wait_array
  413. ! int starpu_task_wait_for_all(void);
  414. subroutine fstarpu_task_wait_for_all () bind(C,name="starpu_task_wait_for_all")
  415. end subroutine fstarpu_task_wait_for_all
  416. ! int starpu_task_wait_for_n_submitted(unsigned n);
  417. subroutine fstarpu_task_wait_for_n_submitted (n) bind(C,name="starpu_task_wait_for_n_submitted")
  418. use iso_c_binding, only: c_int
  419. integer(c_int), value, intent(in) :: n
  420. end subroutine fstarpu_task_wait_for_n_submitted
  421. ! int starpu_task_wait_for_all_in_ctx(unsigned sched_ctx_id);
  422. subroutine fstarpu_task_wait_for_all_in_ctx (ctx) bind(C,name="starpu_task_wait_for_all_in_ctx")
  423. use iso_c_binding, only: c_int
  424. integer(c_int), value, intent(in) :: ctx
  425. end subroutine fstarpu_task_wait_for_all_in_ctx
  426. ! int starpu_task_wait_for_n_submitted_in_ctx(unsigned sched_ctx_id, unsigned n);
  427. subroutine fstarpu_task_wait_for_n_submitted_in_ctx (ctx,n) bind(C,name="starpu_task_wait_for_n_submitted_in_ctx")
  428. use iso_c_binding, only: c_int
  429. integer(c_int), value, intent(in) :: ctx
  430. integer(c_int), value, intent(in) :: n
  431. end subroutine fstarpu_task_wait_for_n_submitted_in_ctx
  432. ! int starpu_task_wait_for_no_ready(void);
  433. function fstarpu_task_wait_for_no_ready () bind(C,name="starpu_task_wait_for_no_ready")
  434. use iso_c_binding, only: c_int
  435. integer(c_int) :: fstarpu_task_wait_for_no_ready
  436. end function fstarpu_task_wait_for_no_ready
  437. ! int starpu_task_nready(void);
  438. function fstarpu_task_nready () bind(C,name="starpu_task_nready")
  439. use iso_c_binding, only: c_int
  440. integer(c_int) :: fstarpu_task_nready
  441. end function fstarpu_task_nready
  442. ! int starpu_task_nsubmitted(void);
  443. function fstarpu_task_nsubmitted () bind(C,name="starpu_task_nsubmitted")
  444. use iso_c_binding, only: c_int
  445. integer(c_int) :: fstarpu_task_nsubmitted
  446. end function fstarpu_task_nsubmitted
  447. ! void starpu_do_schedule(void);
  448. subroutine fstarpu_do_schedule () bind(C,name="starpu_do_schedule")
  449. end subroutine fstarpu_do_schedule
  450. ! starpu_codelet_init
  451. subroutine fstarpu_codelet_init (codelet) bind(C,name="starpu_codelet_init")
  452. use iso_c_binding, only: c_ptr
  453. type(c_ptr), value, intent(in) :: codelet
  454. end subroutine fstarpu_codelet_init
  455. ! starpu_codelet_display_stats
  456. subroutine fstarpu_codelet_display_stats (codelet) bind(C,name="starpu_codelet_display_stats")
  457. use iso_c_binding, only: c_ptr
  458. type(c_ptr), value, intent(in) :: codelet
  459. end subroutine fstarpu_codelet_display_stats
  460. ! struct starpu_task *starpu_task_get_current(void);
  461. function fstarpu_task_get_current () bind(C,name="starpu_task_get_current")
  462. use iso_c_binding, only: c_ptr
  463. type(c_ptr) :: fstarpu_task_get_current
  464. end function fstarpu_task_get_current
  465. ! void starpu_parallel_task_barrier_init(struct starpu_task *task, int workerid);
  466. subroutine fstarpu_parallel_task_barrier_init_init (task,id) &
  467. bind(C,name="starpu_parallel_task_barrier_init_init")
  468. use iso_c_binding, only: c_ptr, c_int
  469. type(c_ptr), value, intent(in) :: task
  470. integer(c_int), value, intent(in) :: id
  471. end subroutine fstarpu_parallel_task_barrier_init_init
  472. ! void starpu_parallel_task_barrier_init_n(struct starpu_task *task, int worker_size);
  473. subroutine fstarpu_parallel_task_barrier_init_n_init_n (task,sz) &
  474. bind(C,name="starpu_parallel_task_barrier_init_n_init_n")
  475. use iso_c_binding, only: c_ptr, c_int
  476. type(c_ptr), value, intent(in) :: task
  477. integer(c_int), value, intent(in) :: sz
  478. end subroutine fstarpu_parallel_task_barrier_init_n_init_n
  479. ! struct starpu_task *starpu_task_dup(struct starpu_task *task);
  480. function fstarpu_task_dup (task) bind(C,name="starpu_task_dup")
  481. use iso_c_binding, only: c_ptr
  482. type(c_ptr) :: fstarpu_task_dup
  483. type(c_ptr), value, intent(in) :: task
  484. end function fstarpu_task_dup
  485. ! void starpu_task_set_implementation(struct starpu_task *task, unsigned impl);
  486. subroutine fstarpu_task_set_implementation (task,impl) &
  487. bind(C,name="starpu_task_set_implementation")
  488. use iso_c_binding, only: c_ptr,c_int
  489. type(c_ptr), value, intent(in) :: task
  490. integer(c_int), value, intent(in) :: impl
  491. end subroutine fstarpu_task_set_implementation
  492. ! unsigned starpu_task_get_implementation(struct starpu_task *task);
  493. function fstarpu_task_get_implementation (task) &
  494. bind(C,name="starpu_task_get_implementation")
  495. use iso_c_binding, only: c_ptr,c_int
  496. type(c_ptr), value, intent(in) :: task
  497. integer(c_int) :: fstarpu_task_get_implementation
  498. end function fstarpu_task_get_implementation
  499. ! --
  500. function fstarpu_codelet_allocate () bind(C)
  501. use iso_c_binding, only: c_ptr
  502. type(c_ptr) :: fstarpu_codelet_allocate
  503. end function fstarpu_codelet_allocate
  504. subroutine fstarpu_codelet_free (cl) bind(C)
  505. use iso_c_binding, only: c_ptr
  506. type(c_ptr), value, intent(in) :: cl
  507. end subroutine fstarpu_codelet_free
  508. subroutine fstarpu_codelet_set_name (cl, cl_name) bind(C)
  509. use iso_c_binding, only: c_ptr, c_char
  510. type(c_ptr), value, intent(in) :: cl
  511. character(c_char), intent(in) :: cl_name
  512. end subroutine fstarpu_codelet_set_name
  513. subroutine fstarpu_codelet_add_cpu_func (cl, f_ptr) bind(C)
  514. use iso_c_binding, only: c_ptr, c_funptr
  515. type(c_ptr), value, intent(in) :: cl
  516. type(c_funptr), value, intent(in) :: f_ptr
  517. end subroutine fstarpu_codelet_add_cpu_func
  518. subroutine fstarpu_codelet_add_cuda_func (cl, f_ptr) bind(C)
  519. use iso_c_binding, only: c_ptr, c_funptr
  520. type(c_ptr), value, intent(in) :: cl
  521. type(c_funptr), value, intent(in) :: f_ptr
  522. end subroutine fstarpu_codelet_add_cuda_func
  523. subroutine fstarpu_codelet_add_opencl_func (cl, f_ptr) bind(C)
  524. use iso_c_binding, only: c_ptr, c_funptr
  525. type(c_ptr), value, intent(in) :: cl
  526. type(c_funptr), value, intent(in) :: f_ptr
  527. end subroutine fstarpu_codelet_add_opencl_func
  528. subroutine fstarpu_codelet_add_mic_func (cl, f_ptr) bind(C)
  529. use iso_c_binding, only: c_ptr, c_funptr
  530. type(c_ptr), value, intent(in) :: cl
  531. type(c_funptr), value, intent(in) :: f_ptr
  532. end subroutine fstarpu_codelet_add_mic_func
  533. subroutine fstarpu_codelet_add_scc_func (cl, f_ptr) bind(C)
  534. use iso_c_binding, only: c_ptr, c_funptr
  535. type(c_ptr), value, intent(in) :: cl
  536. type(c_funptr), value, intent(in) :: f_ptr
  537. end subroutine fstarpu_codelet_add_scc_func
  538. subroutine fstarpu_codelet_add_buffer (cl, mode) bind(C)
  539. use iso_c_binding, only: c_ptr
  540. type(c_ptr), value, intent(in) :: cl
  541. type(c_ptr), value, intent(in) :: mode ! C function expects an intptr_t
  542. end subroutine fstarpu_codelet_add_buffer
  543. subroutine fstarpu_codelet_set_nbuffers (cl, nbuffers) bind(C)
  544. use iso_c_binding, only: c_ptr,c_int
  545. type(c_ptr), value, intent(in) :: cl
  546. integer(c_int), value, intent(in) :: nbuffers
  547. end subroutine fstarpu_codelet_set_nbuffers
  548. ! == starpu_data_interface.h ==
  549. ! uintptr_t starpu_malloc_on_node_flags(unsigned dst_node, size_t size, int flags);
  550. ! uintptr_t starpu_malloc_on_node(unsigned dst_node, size_t size);
  551. function fstarpu_malloc_on_node(node,sz) bind(C,name="starpu_malloc_on_node")
  552. use iso_c_binding, only: c_int,c_intptr_t,c_size_t
  553. integer(c_intptr_t) :: fstarpu_malloc_on_node
  554. integer(c_int), value, intent(in) :: node
  555. integer(c_size_t), value, intent(in) :: sz
  556. end function fstarpu_malloc_on_node
  557. ! void starpu_free_on_node_flags(unsigned dst_node, uintptr_t addr, size_t size, int flags);
  558. ! void starpu_free_on_node(unsigned dst_node, uintptr_t addr, size_t size);
  559. subroutine fstarpu_free_on_node(node,addr,sz) bind(C,name="starpu_free_on_node")
  560. use iso_c_binding, only: c_int,c_intptr_t,c_size_t
  561. integer(c_int), value, intent(in) :: node
  562. integer(c_intptr_t), value, intent(in) :: addr
  563. integer(c_size_t), value, intent(in) :: sz
  564. end subroutine fstarpu_free_on_node
  565. ! void starpu_malloc_on_node_set_default_flags(unsigned node, int flags);
  566. ! int starpu_data_interface_get_next_id(void);
  567. ! void starpu_data_register(starpu_data_handle_t *handleptr, unsigned home_node, void *data_interface, struct starpu_data_interface_ops *ops);
  568. ! void starpu_data_ptr_register(starpu_data_handle_t handle, unsigned node);
  569. subroutine fstarpug_data_ptr_register (dh,node) bind(C,name="starpu_data_ptr_register")
  570. use iso_c_binding, only: c_ptr, c_int
  571. type(c_ptr), value, intent(in) :: dh
  572. integer(c_int), value, intent(in) :: node
  573. end subroutine fstarpug_data_ptr_register
  574. ! void starpu_data_register_same(starpu_data_handle_t *handledst, starpu_data_handle_t handlesrc);
  575. subroutine fstarpu_data_register_same (dh_dst,dh_src) bind(C,name="starpu_data_register_same")
  576. use iso_c_binding, only: c_ptr
  577. type(c_ptr), intent(out) :: dh_dst
  578. type(c_ptr), value, intent(in) :: dh_src
  579. end subroutine fstarpu_data_register_same
  580. ! void *starpu_data_handle_to_pointer(starpu_data_handle_t handle, unsigned node);
  581. function fstarpu_data_handle_to_pointer (dh,node) bind(C,name="starpu_data_handle_to_pointer")
  582. use iso_c_binding, only: c_ptr, c_int
  583. type(c_ptr) :: fstarpu_data_handle_to_pointer
  584. type(c_ptr), value, intent(in) :: dh
  585. integer(c_int), value, intent(in) :: node
  586. end function fstarpu_data_handle_to_pointer
  587. ! void *starpu_data_get_local_ptr(starpu_data_handle_t handle);
  588. function fstarpu_data_get_local_ptr (dh) bind(C,name="starpu_data_get_local_ptr")
  589. use iso_c_binding, only: c_ptr, c_int
  590. type(c_ptr) :: fstarpu_data_get_local_ptr
  591. type(c_ptr), value, intent(in) :: dh
  592. end function fstarpu_data_get_local_ptr
  593. ! void *starpu_data_get_interface_on_node(starpu_data_handle_t handle, unsigned memory_node);
  594. ! == starpu_data_interface.h: block ==
  595. ! void starpu_block_data_register(starpu_data_handle_t *handle, unsigned home_node, uintptr_t ptr, uint32_t ldy, uint32_t ldz, uint32_t nx, uint32_t ny, uint32_t nz, size_t elemsize);
  596. subroutine fstarpu_block_data_register(dh, home_node, ptr, ldy, ldz, nx, ny, nz, elt_size) &
  597. bind(C,name="starpu_block_data_register")
  598. use iso_c_binding, only: c_ptr, c_int, c_size_t
  599. type(c_ptr), intent(out) :: dh
  600. integer(c_int), value, intent(in) :: home_node
  601. type(c_ptr), value, intent(in) :: ptr
  602. integer(c_int), value, intent(in) :: ldy
  603. integer(c_int), value, intent(in) :: ldz
  604. integer(c_int), value, intent(in) :: nx
  605. integer(c_int), value, intent(in) :: ny
  606. integer(c_int), value, intent(in) :: nz
  607. integer(c_size_t), value, intent(in) :: elt_size
  608. end subroutine fstarpu_block_data_register
  609. ! 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);
  610. subroutine fstarpu_block_ptr_register(dh, node, ptr, dev_handle, offset, ldy, ldz) &
  611. bind(C,name="starpu_block_ptr_register")
  612. use iso_c_binding, only: c_ptr, c_int, c_size_t
  613. type(c_ptr), intent(out) :: dh
  614. integer(c_int), value, intent(in) :: node
  615. type(c_ptr), value, intent(in) :: ptr
  616. type(c_ptr), value, intent(in) :: dev_handle
  617. integer(c_size_t), value, intent(in) :: offset
  618. integer(c_int), value, intent(in) :: ldy
  619. integer(c_int), value, intent(in) :: ldz
  620. end subroutine fstarpu_block_ptr_register
  621. function fstarpu_block_get_ptr(buffers, i) bind(C)
  622. use iso_c_binding, only: c_ptr, c_int
  623. type(c_ptr) :: fstarpu_block_get_ptr
  624. type(c_ptr), value, intent(in) :: buffers
  625. integer(c_int), value, intent(in) :: i
  626. end function fstarpu_block_get_ptr
  627. function fstarpu_block_get_ldy(buffers, i) bind(C)
  628. use iso_c_binding, only: c_ptr, c_int
  629. integer(c_int) :: fstarpu_block_get_ldy
  630. type(c_ptr), value, intent(in) :: buffers
  631. integer(c_int), value, intent(in) :: i
  632. end function fstarpu_block_get_ldy
  633. function fstarpu_block_get_ldz(buffers, i) bind(C)
  634. use iso_c_binding, only: c_ptr, c_int
  635. integer(c_int) :: fstarpu_block_get_ldz
  636. type(c_ptr), value, intent(in) :: buffers
  637. integer(c_int), value, intent(in) :: i
  638. end function fstarpu_block_get_ldz
  639. function fstarpu_block_get_nx(buffers, i) bind(C)
  640. use iso_c_binding, only: c_ptr, c_int
  641. integer(c_int) :: fstarpu_block_get_nx
  642. type(c_ptr), value, intent(in) :: buffers
  643. integer(c_int), value, intent(in) :: i
  644. end function fstarpu_block_get_nx
  645. function fstarpu_block_get_ny(buffers, i) bind(C)
  646. use iso_c_binding, only: c_ptr, c_int
  647. integer(c_int) :: fstarpu_block_get_ny
  648. type(c_ptr), value, intent(in) :: buffers
  649. integer(c_int), value, intent(in) :: i
  650. end function fstarpu_block_get_ny
  651. function fstarpu_block_get_nz(buffers, i) bind(C)
  652. use iso_c_binding, only: c_ptr, c_int
  653. integer(c_int) :: fstarpu_block_get_nz
  654. type(c_ptr), value, intent(in) :: buffers
  655. integer(c_int), value, intent(in) :: i
  656. end function fstarpu_block_get_nz
  657. ! == starpu_data_interface.h: matrix ==
  658. ! void starpu_matrix_data_register(starpu_data_handle_t *handle, unsigned home_node, uintptr_t ptr, uint32_t ld, uint32_t nx, uint32_t ny, size_t elemsize);
  659. subroutine fstarpu_matrix_data_register(dh, home_node, ptr, ld, nx, ny, elt_size) &
  660. bind(C,name="starpu_matrix_data_register")
  661. use iso_c_binding, only: c_ptr, c_int, c_size_t
  662. type(c_ptr), intent(out) :: dh
  663. integer(c_int), value, intent(in) :: home_node
  664. type(c_ptr), value, intent(in) :: ptr
  665. integer(c_int), value, intent(in) :: ld
  666. integer(c_int), value, intent(in) :: nx
  667. integer(c_int), value, intent(in) :: ny
  668. integer(c_size_t), value, intent(in) :: elt_size
  669. end subroutine fstarpu_matrix_data_register
  670. ! 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);
  671. subroutine fstarpu_matrix_ptr_register(dh, node, ptr, dev_handle, offset, ld) &
  672. bind(C,name="starpu_matrix_ptr_register")
  673. use iso_c_binding, only: c_ptr, c_int, c_size_t
  674. type(c_ptr), intent(out) :: dh
  675. integer(c_int), value, intent(in) :: node
  676. type(c_ptr), value, intent(in) :: ptr
  677. type(c_ptr), value, intent(in) :: dev_handle
  678. integer(c_size_t), value, intent(in) :: offset
  679. integer(c_int), value, intent(in) :: ld
  680. end subroutine fstarpu_matrix_ptr_register
  681. function fstarpu_matrix_get_ptr(buffers, i) bind(C)
  682. use iso_c_binding, only: c_ptr, c_int
  683. type(c_ptr) :: fstarpu_matrix_get_ptr
  684. type(c_ptr), value, intent(in) :: buffers
  685. integer(c_int), value, intent(in) :: i
  686. end function fstarpu_matrix_get_ptr
  687. function fstarpu_matrix_get_ld(buffers, i) bind(C)
  688. use iso_c_binding, only: c_ptr, c_int
  689. integer(c_int) :: fstarpu_matrix_get_ld
  690. type(c_ptr), value, intent(in) :: buffers
  691. integer(c_int), value, intent(in) :: i
  692. end function fstarpu_matrix_get_ld
  693. function fstarpu_matrix_get_nx(buffers, i) bind(C)
  694. use iso_c_binding, only: c_ptr, c_int
  695. integer(c_int) :: fstarpu_matrix_get_nx
  696. type(c_ptr), value, intent(in) :: buffers
  697. integer(c_int), value, intent(in) :: i
  698. end function fstarpu_matrix_get_nx
  699. function fstarpu_matrix_get_ny(buffers, i) bind(C)
  700. use iso_c_binding, only: c_ptr, c_int
  701. integer(c_int) :: fstarpu_matrix_get_ny
  702. type(c_ptr), value, intent(in) :: buffers
  703. integer(c_int), value, intent(in) :: i
  704. end function fstarpu_matrix_get_ny
  705. ! == starpu_data_interface.h: vector ==
  706. ! void starpu_vector_data_register(starpu_data_handle_t *handle, unsigned home_node, uintptr_t ptr, uint32_t nx, size_t elemsize);
  707. subroutine fstarpu_vector_data_register(dh, home_node, ptr,nx, elt_size) &
  708. bind(C,name="starpu_vector_data_register")
  709. use iso_c_binding, only: c_ptr, c_int, c_size_t
  710. type(c_ptr), intent(out) :: dh
  711. integer(c_int), value, intent(in) :: home_node
  712. type(c_ptr), value, intent(in) :: ptr
  713. integer(c_int), value, intent(in) :: nx
  714. integer(c_size_t), value, intent(in) :: elt_size
  715. end subroutine fstarpu_vector_data_register
  716. ! void starpu_vector_ptr_register(starpu_data_handle_t handle, unsigned node, uintptr_t ptr, uintptr_t dev_handle, size_t offset);
  717. subroutine fstarpu_vector_ptr_register(dh, node, ptr, dev_handle, offset, ld) &
  718. bind(C,name="starpu_vector_ptr_register")
  719. use iso_c_binding, only: c_ptr, c_int, c_size_t
  720. type(c_ptr), intent(out) :: dh
  721. integer(c_int), value, intent(in) :: node
  722. type(c_ptr), value, intent(in) :: ptr
  723. type(c_ptr), value, intent(in) :: dev_handle
  724. integer(c_size_t), value, intent(in) :: offset
  725. end subroutine fstarpu_vector_ptr_register
  726. function fstarpu_vector_get_ptr(buffers, i) bind(C)
  727. use iso_c_binding, only: c_ptr, c_int
  728. type(c_ptr) :: fstarpu_vector_get_ptr
  729. type(c_ptr), value, intent(in) :: buffers
  730. integer(c_int), value, intent(in) :: i
  731. end function fstarpu_vector_get_ptr
  732. function fstarpu_vector_get_nx(buffers, i) bind(C)
  733. use iso_c_binding, only: c_ptr, c_int
  734. integer(c_int) :: fstarpu_vector_get_nx
  735. type(c_ptr), value, intent(in) :: buffers
  736. integer(c_int), value, intent(in) :: i
  737. end function fstarpu_vector_get_nx
  738. ! == starpu_data_interface.h: variable ==
  739. ! void starpu_variable_data_register(starpu_data_handle_t *handle, unsigned home_node, uintptr_t ptr, size_t size);
  740. subroutine fstarpu_variable_data_register(dh, home_node, ptr, elt_size) &
  741. bind(C,name="starpu_variable_data_register")
  742. use iso_c_binding, only: c_ptr, c_int, c_size_t
  743. type(c_ptr), intent(out) :: dh
  744. integer(c_int), value, intent(in) :: home_node
  745. type(c_ptr), value, intent(in) :: ptr
  746. integer(c_size_t), value, intent(in) :: elt_size
  747. end subroutine fstarpu_variable_data_register
  748. ! void starpu_variable_ptr_register(starpu_data_handle_t handle, unsigned node, uintptr_t ptr, uintptr_t dev_handle, size_t offset);
  749. subroutine fstarpu_variable_ptr_register(dh, node, ptr, dev_handle, offset, ld) &
  750. bind(C,name="starpu_variable_ptr_register")
  751. use iso_c_binding, only: c_ptr, c_int, c_size_t
  752. type(c_ptr), intent(out) :: dh
  753. integer(c_int), value, intent(in) :: node
  754. type(c_ptr), value, intent(in) :: ptr
  755. type(c_ptr), value, intent(in) :: dev_handle
  756. integer(c_size_t), value, intent(in) :: offset
  757. end subroutine fstarpu_variable_ptr_register
  758. function fstarpu_variable_get_ptr(buffers, i) bind(C)
  759. use iso_c_binding, only: c_ptr, c_int
  760. type(c_ptr) :: fstarpu_variable_get_ptr
  761. type(c_ptr), value, intent(in) :: buffers
  762. integer(c_int), value, intent(in) :: i
  763. end function fstarpu_variable_get_ptr
  764. ! == starpu_data_interface.h: void ==
  765. ! void starpu_void_data_register(starpu_data_handle_t *handle);
  766. subroutine fstarpu_void_data_register(dh) &
  767. bind(C,name="starpu_void_data_register")
  768. use iso_c_binding, only: c_ptr, c_int, c_size_t
  769. type(c_ptr), intent(out) :: dh
  770. end subroutine fstarpu_void_data_register
  771. ! == starpu_data_filter.h ==
  772. ! void starpu_data_partition(starpu_data_handle_t initial_handle, struct starpu_data_filter *f);
  773. subroutine fstarpu_data_partition (dh,filter) bind(C,name="starpu_data_partition")
  774. use iso_c_binding, only: c_ptr
  775. type(c_ptr), value, intent(in) :: dh
  776. type(c_ptr), value, intent(in) :: filter
  777. end subroutine fstarpu_data_partition
  778. ! void starpu_data_unpartition(starpu_data_handle_t root_data, unsigned gathering_node);
  779. subroutine fstarpug_data_data_unpartition (root_dh,gathering_node) bind(C,name="starpu_data_data_unpartition")
  780. use iso_c_binding, only: c_ptr, c_int
  781. type(c_ptr), value, intent(in) :: root_dh
  782. integer(c_int), value, intent(in) :: gathering_node
  783. end subroutine fstarpug_data_data_unpartition
  784. ! void starpu_data_partition_plan(starpu_data_handle_t initial_handle, struct starpu_data_filter *f, starpu_data_handle_t *children);
  785. subroutine fstarpu_data_partition_plan (dh,filter,children) &
  786. bind(C,name="starpu_data_partition_plan")
  787. use iso_c_binding, only: c_ptr
  788. type(c_ptr), value, intent(in) :: dh
  789. type(c_ptr), value, intent(in) :: filter
  790. type(c_ptr), intent(in) :: children(*)
  791. end subroutine fstarpu_data_partition_plan
  792. ! void starpu_data_partition_submit(starpu_data_handle_t initial_handle, unsigned nparts, starpu_data_handle_t *children);
  793. subroutine fstarpu_data_partition_submit (dh,nparts,children) &
  794. bind(C,name="starpu_data_partition_submit")
  795. use iso_c_binding, only: c_ptr
  796. type(c_ptr), value, intent(in) :: dh
  797. type(c_ptr), value, intent(in) :: nparts
  798. type(c_ptr), intent(in) :: children(*)
  799. end subroutine fstarpu_data_partition_submit
  800. ! void starpu_data_partition_readonly_submit(starpu_data_handle_t initial_handle, unsigned nparts, starpu_data_handle_t *children);
  801. subroutine fstarpu_data_partition_readonly_submit (dh,nparts,children) &
  802. bind(C,name="starpu_data_partition_readonly_submit")
  803. use iso_c_binding, only: c_ptr
  804. type(c_ptr), value, intent(in) :: dh
  805. type(c_ptr), value, intent(in) :: nparts
  806. type(c_ptr), intent(in) :: children(*)
  807. end subroutine fstarpu_data_partition_readonly_submit
  808. ! void starpu_data_partition_readwrite_upgrade_submit(starpu_data_handle_t initial_handle, unsigned nparts, starpu_data_handle_t *children);
  809. subroutine fstarpu_data_partition_readwrite_upgrade_submit (dh,nparts,children) &
  810. bind(C,name="starpu_data_partition_readwrite_upgrade_submit")
  811. use iso_c_binding, only: c_ptr
  812. type(c_ptr), value, intent(in) :: dh
  813. type(c_ptr), value, intent(in) :: nparts
  814. type(c_ptr), intent(in) :: children(*)
  815. end subroutine fstarpu_data_partition_readwrite_upgrade_submit
  816. ! void starpu_data_unpartition_submit(starpu_data_handle_t initial_handle, unsigned nparts, starpu_data_handle_t *children, int gathering_node);
  817. subroutine fstarpu_data_unpartition_submit (dh,nparts,children,gathering_node) &
  818. bind(C,name="starpu_data_unpartition_submit")
  819. use iso_c_binding, only: c_ptr, c_int
  820. type(c_ptr), value, intent(in) :: dh
  821. type(c_ptr), value, intent(in) :: nparts
  822. type(c_ptr), intent(in) :: children(*)
  823. integer(c_int), value, intent(in) :: gathering_node
  824. end subroutine fstarpu_data_unpartition_submit
  825. ! void starpu_data_unpartition_readonly_submit(starpu_data_handle_t initial_handle, unsigned nparts, starpu_data_handle_t *children, int gathering_node);
  826. subroutine fstarpu_data_unpartition_readonly_submit (dh,nparts,children,gathering_node) &
  827. bind(C,name="starpu_data_unpartition_readonly_submit")
  828. use iso_c_binding, only: c_ptr, c_int
  829. type(c_ptr), value, intent(in) :: dh
  830. type(c_ptr), value, intent(in) :: nparts
  831. type(c_ptr), intent(in) :: children(*)
  832. integer(c_int), value, intent(in) :: gathering_node
  833. end subroutine fstarpu_data_unpartition_readonly_submit
  834. ! void starpu_data_partition_clean(starpu_data_handle_t root_data, unsigned nparts, starpu_data_handle_t *children);
  835. subroutine fstarpu_data_partition_clean (dh,nparts,children) &
  836. bind(C,name="starpu_data_partition_clean")
  837. use iso_c_binding, only: c_ptr
  838. type(c_ptr), value, intent(in) :: dh
  839. type(c_ptr), value, intent(in) :: nparts
  840. type(c_ptr), intent(in) :: children(*)
  841. end subroutine fstarpu_data_partition_clean
  842. ! int starpu_data_get_nb_children(starpu_data_handle_t handle);
  843. function fstarpu_data_get_nb_children(dh) bind(C,name="starpu_data_get_nb_children")
  844. use iso_c_binding, only: c_ptr, c_int
  845. integer(c_int) :: fstarpu_data_get_nb_children
  846. type(c_ptr), value, intent(in) :: dh
  847. end function fstarpu_data_get_nb_children
  848. ! starpu_data_handle_t starpu_data_get_child(starpu_data_handle_t handle, unsigned i);
  849. function fstarpu_data_get_child(dh,i) bind(C,name="starpu_data_get_child")
  850. use iso_c_binding, only: c_ptr, c_int
  851. type(c_ptr) :: fstarpu_data_get_child
  852. type(c_ptr), value, intent(in) :: dh
  853. integer(c_int), value, intent(in) :: i
  854. end function fstarpu_data_get_child
  855. ! starpu_data_handle_t starpu_data_get_sub_data(starpu_data_handle_t root_data, unsigned depth, ... );
  856. ! starpu_data_handle_t starpu_data_vget_sub_data(starpu_data_handle_t root_data, unsigned depth, va_list pa);
  857. ! void starpu_matrix_filter_block(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
  858. subroutine fstarpu_matrix_filter_block (father_interface,child_interface,filter,id,nparts) &
  859. bind(C,name="starpu_matrix_filter_block")
  860. use iso_c_binding, only: c_ptr
  861. type(c_ptr), value, intent(in) :: father_interface
  862. type(c_ptr), value, intent(in) :: child_interface
  863. type(c_ptr), value, intent(in) :: filter
  864. type(c_ptr), value, intent(in) :: id
  865. type(c_ptr), value, intent(in) :: nparts
  866. end subroutine fstarpu_matrix_filter_block
  867. ! void starpu_matrix_filter_block_shadow(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
  868. subroutine fstarpu_matrix_filter_block_shadow (father_interface,child_interface,filter,id,nparts) &
  869. bind(C,name="starpu_matrix_filter_block_shadow")
  870. use iso_c_binding, only: c_ptr
  871. type(c_ptr), value, intent(in) :: father_interface
  872. type(c_ptr), value, intent(in) :: child_interface
  873. type(c_ptr), value, intent(in) :: filter
  874. type(c_ptr), value, intent(in) :: id
  875. type(c_ptr), value, intent(in) :: nparts
  876. end subroutine fstarpu_matrix_filter_block_shadow
  877. ! void starpu_matrix_filter_vertical_block(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
  878. subroutine fstarpu_matrix_filter_vertical_block (father_interface,child_interface,filter,id,nparts) &
  879. bind(C,name="starpu_matrix_filter_vertical_block")
  880. use iso_c_binding, only: c_ptr
  881. type(c_ptr), value, intent(in) :: father_interface
  882. type(c_ptr), value, intent(in) :: child_interface
  883. type(c_ptr), value, intent(in) :: filter
  884. type(c_ptr), value, intent(in) :: id
  885. type(c_ptr), value, intent(in) :: nparts
  886. end subroutine fstarpu_matrix_filter_vertical_block
  887. ! void starpu_matrix_filter_vertical_block_shadow(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
  888. subroutine fstarpu_matrix_filter_vertical_block_shadow (father_interface,child_interface,filter,id,nparts) &
  889. bind(C,name="starpu_matrix_filter_vertical_block_shadow")
  890. use iso_c_binding, only: c_ptr
  891. type(c_ptr), value, intent(in) :: father_interface
  892. type(c_ptr), value, intent(in) :: child_interface
  893. type(c_ptr), value, intent(in) :: filter
  894. type(c_ptr), value, intent(in) :: id
  895. type(c_ptr), value, intent(in) :: nparts
  896. end subroutine fstarpu_matrix_filter_vertical_block_shadow
  897. ! void starpu_vector_filter_block(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
  898. subroutine fstarpu_vector_filter_block (father_interface,child_interface,filter,id,nparts) &
  899. bind(C,name="starpu_vector_filter_block")
  900. use iso_c_binding, only: c_ptr
  901. type(c_ptr), value, intent(in) :: father_interface
  902. type(c_ptr), value, intent(in) :: child_interface
  903. type(c_ptr), value, intent(in) :: filter
  904. type(c_ptr), value, intent(in) :: id
  905. type(c_ptr), value, intent(in) :: nparts
  906. end subroutine fstarpu_vector_filter_block
  907. ! void starpu_vector_filter_block_shadow(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
  908. subroutine fstarpu_vector_filter_block_shadow (father_interface,child_interface,filter,id,nparts) &
  909. bind(C,name="starpu_vector_filter_block_shadow")
  910. use iso_c_binding, only: c_ptr
  911. type(c_ptr), value, intent(in) :: father_interface
  912. type(c_ptr), value, intent(in) :: child_interface
  913. type(c_ptr), value, intent(in) :: filter
  914. type(c_ptr), value, intent(in) :: id
  915. type(c_ptr), value, intent(in) :: nparts
  916. end subroutine fstarpu_vector_filter_block_shadow
  917. ! void starpu_vector_filter_list(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
  918. subroutine fstarpu_vector_filter_list (father_interface,child_interface,filter,id,nparts) &
  919. bind(C,name="starpu_vector_filter_list")
  920. use iso_c_binding, only: c_ptr
  921. type(c_ptr), value, intent(in) :: father_interface
  922. type(c_ptr), value, intent(in) :: child_interface
  923. type(c_ptr), value, intent(in) :: filter
  924. type(c_ptr), value, intent(in) :: id
  925. type(c_ptr), value, intent(in) :: nparts
  926. end subroutine fstarpu_vector_filter_list
  927. ! void starpu_vector_filter_divide_in_2(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
  928. ! void starpu_vector_filter_list(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
  929. subroutine fstarpu_vector_divide_in_2 (father_interface,child_interface,filter,id,nparts) &
  930. bind(C,name="starpu_vector_divide_in_2")
  931. use iso_c_binding, only: c_ptr
  932. type(c_ptr), value, intent(in) :: father_interface
  933. type(c_ptr), value, intent(in) :: child_interface
  934. type(c_ptr), value, intent(in) :: filter
  935. type(c_ptr), value, intent(in) :: id
  936. type(c_ptr), value, intent(in) :: nparts
  937. end subroutine fstarpu_vector_divide_in_2
  938. ! void starpu_block_filter_block(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
  939. subroutine fstarpu_block_filter_block (father_interface,child_interface,filter,id,nparts) &
  940. bind(C,name="starpu_block_filter_block")
  941. use iso_c_binding, only: c_ptr
  942. type(c_ptr), value, intent(in) :: father_interface
  943. type(c_ptr), value, intent(in) :: child_interface
  944. type(c_ptr), value, intent(in) :: filter
  945. type(c_ptr), value, intent(in) :: id
  946. type(c_ptr), value, intent(in) :: nparts
  947. end subroutine fstarpu_block_filter_block
  948. ! void starpu_block_filter_block_shadow(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
  949. subroutine fstarpu_block_filter_block_shadow (father_interface,child_interface,filter,id,nparts) &
  950. bind(C,name="starpu_block_filter_block_shadow")
  951. use iso_c_binding, only: c_ptr
  952. type(c_ptr), value, intent(in) :: father_interface
  953. type(c_ptr), value, intent(in) :: child_interface
  954. type(c_ptr), value, intent(in) :: filter
  955. type(c_ptr), value, intent(in) :: id
  956. type(c_ptr), value, intent(in) :: nparts
  957. end subroutine fstarpu_block_filter_block_shadow
  958. ! void starpu_block_filter_vertical_block(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
  959. subroutine fstarpu_block_filter_vertical_block (father_interface,child_interface,filter,id,nparts) &
  960. bind(C,name="starpu_block_filter_vertical_block")
  961. use iso_c_binding, only: c_ptr
  962. type(c_ptr), value, intent(in) :: father_interface
  963. type(c_ptr), value, intent(in) :: child_interface
  964. type(c_ptr), value, intent(in) :: filter
  965. type(c_ptr), value, intent(in) :: id
  966. type(c_ptr), value, intent(in) :: nparts
  967. end subroutine fstarpu_block_filter_vertical_block
  968. ! void starpu_block_filter_vertical_block_shadow(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
  969. subroutine fstarpu_block_filter_vertical_block_shadow (father_interface,child_interface,filter,id,nparts) &
  970. bind(C,name="starpu_block_filter_vertical_block_shadow")
  971. use iso_c_binding, only: c_ptr
  972. type(c_ptr), value, intent(in) :: father_interface
  973. type(c_ptr), value, intent(in) :: child_interface
  974. type(c_ptr), value, intent(in) :: filter
  975. type(c_ptr), value, intent(in) :: id
  976. type(c_ptr), value, intent(in) :: nparts
  977. end subroutine fstarpu_block_filter_vertical_block_shadow
  978. ! void starpu_block_filter_depth_block(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
  979. subroutine fstarpu_block_filter_depth_block (father_interface,child_interface,filter,id,nparts) &
  980. bind(C,name="starpu_block_filter_depth_block")
  981. use iso_c_binding, only: c_ptr
  982. type(c_ptr), value, intent(in) :: father_interface
  983. type(c_ptr), value, intent(in) :: child_interface
  984. type(c_ptr), value, intent(in) :: filter
  985. type(c_ptr), value, intent(in) :: id
  986. type(c_ptr), value, intent(in) :: nparts
  987. end subroutine fstarpu_block_filter_depth_block
  988. ! void starpu_block_filter_depth_block_shadow(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
  989. subroutine fstarpu_block_filter_depth_block_shadow (father_interface,child_interface,filter,id,nparts) &
  990. bind(C,name="starpu_block_filter_depth_block_shadow")
  991. use iso_c_binding, only: c_ptr
  992. type(c_ptr), value, intent(in) :: father_interface
  993. type(c_ptr), value, intent(in) :: child_interface
  994. type(c_ptr), value, intent(in) :: filter
  995. type(c_ptr), value, intent(in) :: id
  996. type(c_ptr), value, intent(in) :: nparts
  997. end subroutine fstarpu_block_filter_depth_block_shadow
  998. ! == starpu_data.h ==
  999. ! void starpu_data_unregister(starpu_data_handle_t handle);
  1000. subroutine fstarpu_data_unregister (dh) bind(C,name="starpu_data_unregister")
  1001. use iso_c_binding, only: c_ptr
  1002. type(c_ptr), value, intent(in) :: dh
  1003. end subroutine fstarpu_data_unregister
  1004. ! void starpu_data_unregister_no_coherency(starpu_data_handle_t handle);
  1005. subroutine fstarpu_data_unregister_no_coherency (dh) bind(C,name="starpu_data_unregister_no_coherency")
  1006. use iso_c_binding, only: c_ptr
  1007. type(c_ptr), value, intent(in) :: dh
  1008. end subroutine fstarpu_data_unregister_no_coherency
  1009. ! void starpu_data_unregister_submit(starpu_data_handle_t handle);
  1010. subroutine fstarpu_data_unregister_submit (dh) bind(C,name="starpu_data_unregister_submit")
  1011. use iso_c_binding, only: c_ptr
  1012. type(c_ptr), value, intent(in) :: dh
  1013. end subroutine fstarpu_data_unregister_submit
  1014. ! void starpu_data_invalidate(starpu_data_handle_t handle);
  1015. subroutine fstarpu_data_invalidate (dh) bind(C,name="starpu_data_invalidate")
  1016. use iso_c_binding, only: c_ptr
  1017. type(c_ptr), value, intent(in) :: dh
  1018. end subroutine fstarpu_data_invalidate
  1019. ! void starpu_data_invalidate_submit(starpu_data_handle_t handle);
  1020. subroutine fstarpu_data_invalidate_submit (dh) bind(C,name="starpu_data_invalidate_submit")
  1021. use iso_c_binding, only: c_ptr
  1022. type(c_ptr), value, intent(in) :: dh
  1023. end subroutine fstarpu_data_invalidate_submit
  1024. ! void starpu_data_advise_as_important(starpu_data_handle_t handle, unsigned is_important);
  1025. subroutine fstarpu_data_advise_as_important (dh,is_important) bind(C,name="starpu_data_advise_as_important")
  1026. use iso_c_binding, only: c_ptr,c_int
  1027. type(c_ptr), value, intent(in) :: dh
  1028. integer(c_int), value, intent(in) :: is_important
  1029. end subroutine fstarpu_data_advise_as_important
  1030. ! starpu_data_acquire: see fstarpu_data_acquire
  1031. subroutine fstarpu_data_acquire (dh, mode) bind(C)
  1032. use iso_c_binding, only: c_ptr
  1033. type(c_ptr), value, intent(in) :: dh
  1034. type(c_ptr), value, intent(in) :: mode ! C function expects an intptr_t
  1035. end subroutine fstarpu_data_acquire
  1036. ! int starpu_data_acquire_on_node(starpu_data_handle_t handle, int node, enum starpu_data_access_mode mode);
  1037. ! int starpu_data_acquire_cb(starpu_data_handle_t handle, enum starpu_data_access_mode mode, void (*callback)(void *), void *arg);
  1038. ! int starpu_data_acquire_on_node_cb(starpu_data_handle_t handle, int node, enum starpu_data_access_mode mode, void (*callback)(void *), void *arg);
  1039. ! int starpu_data_acquire_cb_sequential_consistency(starpu_data_handle_t handle, enum starpu_data_access_mode mode, void (*callback)(void *), void *arg, int sequential_consistency);
  1040. ! int starpu_data_acquire_on_node_cb_sequential_consistency(starpu_data_handle_t handle, int node, enum starpu_data_access_mode mode, void (*callback)(void *), void *arg, int sequential_consistency);
  1041. ! void starpu_data_release(starpu_data_handle_t handle);
  1042. subroutine fstarpu_data_release (dh) bind(C,name="starpu_data_release")
  1043. use iso_c_binding, only: c_ptr
  1044. type(c_ptr), value, intent(in) :: dh
  1045. end subroutine fstarpu_data_release
  1046. ! void starpu_data_release_on_node(starpu_data_handle_t handle, int node);
  1047. subroutine fstarpu_data_release_on_node (dh, node) bind(C,name="starpu_data_release_on_node")
  1048. use iso_c_binding, only: c_ptr, c_int
  1049. type(c_ptr), value, intent(in) :: dh
  1050. integer(c_int), value, intent(in) :: node
  1051. end subroutine fstarpu_data_release_on_node
  1052. ! void starpu_data_assign_arbiter(starpu_data_handle_t handle, starpu_arbiter_t arbiter);
  1053. ! void starpu_arbiter_destroy(starpu_arbiter_t arbiter);
  1054. ! void starpu_data_display_memory_stats();
  1055. subroutine fstarpu_display_memory_stats() bind(C,name="starpu_display_memory_stats")
  1056. end subroutine fstarpu_display_memory_stats
  1057. ! int starpu_data_request_allocation(starpu_data_handle_t handle, unsigned node);
  1058. subroutine fstarpu_data_request_allocation (dh, node) &
  1059. bind(C,name="starpu_data_request_allocation")
  1060. use iso_c_binding, only: c_ptr, c_int
  1061. type(c_ptr), value, intent(in) :: dh
  1062. integer(c_int), value, intent(in) :: node
  1063. end subroutine fstarpu_data_request_allocation
  1064. ! int starpu_data_fetch_on_node(starpu_data_handle_t handle, unsigned node, unsigned async);
  1065. subroutine fstarpu_data_fetch_on_node (dh, node, async) &
  1066. bind(C,name="starpu_data_fetch_on_node")
  1067. use iso_c_binding, only: c_ptr, c_int
  1068. type(c_ptr), value, intent(in) :: dh
  1069. integer(c_int), value, intent(in) :: node
  1070. integer(c_int), value, intent(in) :: async
  1071. end subroutine fstarpu_data_fetch_on_node
  1072. ! int starpu_data_prefetch_on_node(starpu_data_handle_t handle, unsigned node, unsigned async);
  1073. subroutine fstarpu_data_prefetch_on_node (dh, node, async) &
  1074. bind(C,name="starpu_data_prefetch_on_node")
  1075. use iso_c_binding, only: c_ptr, c_int
  1076. type(c_ptr), value, intent(in) :: dh
  1077. integer(c_int), value, intent(in) :: node
  1078. integer(c_int), value, intent(in) :: async
  1079. end subroutine fstarpu_data_prefetch_on_node
  1080. ! int starpu_data_prefetch_on_node_prio(starpu_data_handle_t handle, unsigned node, unsigned async, int prio);
  1081. subroutine fstarpu_data_prefetch_on_node_prio (dh, node, async, prio) &
  1082. bind(C,name="starpu_data_prefetch_on_node_prio")
  1083. use iso_c_binding, only: c_ptr, c_int
  1084. type(c_ptr), value, intent(in) :: dh
  1085. integer(c_int), value, intent(in) :: node
  1086. integer(c_int), value, intent(in) :: async
  1087. integer(c_int), value, intent(in) :: prio
  1088. end subroutine fstarpu_data_prefetch_on_node_prio
  1089. ! int starpu_data_idle_prefetch_on_node(starpu_data_handle_t handle, unsigned node, unsigned async);
  1090. subroutine fstarpu_data_idle_prefetch_on_node (dh, node, async) &
  1091. bind(C,name="starpu_data_idle_prefetch_on_node")
  1092. use iso_c_binding, only: c_ptr, c_int
  1093. type(c_ptr), value, intent(in) :: dh
  1094. integer(c_int), value, intent(in) :: node
  1095. integer(c_int), value, intent(in) :: async
  1096. end subroutine fstarpu_data_idle_prefetch_on_node
  1097. ! int starpu_data_idle_prefetch_on_node_prio(starpu_data_handle_t handle, unsigned node, unsigned async, int prio);
  1098. subroutine fstarpu_data_idle_prefetch_on_node_prio (dh, node, async, prio) &
  1099. bind(C,name="starpu_data_idle_prefetch_on_node_prio")
  1100. use iso_c_binding, only: c_ptr, c_int
  1101. type(c_ptr), value, intent(in) :: dh
  1102. integer(c_int), value, intent(in) :: node
  1103. integer(c_int), value, intent(in) :: async
  1104. integer(c_int), value, intent(in) :: prio
  1105. end subroutine fstarpu_data_idle_prefetch_on_node_prio
  1106. ! void starpu_data_wont_use(starpu_data_handle_t handle);
  1107. subroutine fstarpu_data_wont_use (dh) bind(c,name="starpu_data_wont_use")
  1108. use iso_c_binding, only: c_ptr
  1109. type(c_ptr), value, intent(in) :: dh
  1110. end subroutine fstarpu_data_wont_use
  1111. ! unsigned starpu_worker_get_memory_node(unsigned workerid);
  1112. function fstarpu_worker_get_memory_node(id) bind(C,name="starpu_worker_get_memory_node")
  1113. use iso_c_binding, only: c_int
  1114. integer(c_int) :: fstarpu_worker_get_memory_node
  1115. integer(c_int), value, intent(in) :: id
  1116. end function fstarpu_worker_get_memory_node
  1117. ! unsigned starpu_memory_nodes_get_count(void);
  1118. function fstarpu_memory_nodes_get_count() bind(C,name="starpu_memory_nodes_get_count")
  1119. use iso_c_binding, only: c_int
  1120. integer(c_int) :: fstarpu_memory_nodes_get_count
  1121. end function fstarpu_memory_nodes_get_count
  1122. ! enum starpu_node_kind starpu_node_get_kind(unsigned node);
  1123. ! void starpu_data_set_wt_mask(starpu_data_handle_t handle, uint32_t wt_mask);
  1124. ! void starpu_data_set_sequential_consistency_flag(starpu_data_handle_t handle, unsigned flag);
  1125. ! unsigned starpu_data_get_sequential_consistency_flag(starpu_data_handle_t handle);
  1126. ! unsigned starpu_data_get_default_sequential_consistency_flag(void);
  1127. ! void starpu_data_set_default_sequential_consistency_flag(unsigned flag);
  1128. ! void starpu_data_query_status(starpu_data_handle_t handle, int memory_node, int *is_allocated, int *is_valid, int *is_requested);
  1129. ! void starpu_data_set_reduction_methods(starpu_data_handle_t handle, struct starpu_codelet *redux_cl, struct starpu_codelet *init_cl);
  1130. subroutine fstarpu_data_set_reduction_methods (dh,redux_cl,init_cl) bind(C,name="starpu_data_set_reduction_methods")
  1131. use iso_c_binding, only: c_ptr
  1132. type(c_ptr), value, intent(in) :: dh
  1133. type(c_ptr), value, intent(in) :: redux_cl
  1134. type(c_ptr), value, intent(in) :: init_cl
  1135. end subroutine fstarpu_data_set_reduction_methods
  1136. ! struct starpu_data_interface_ops* starpu_data_get_interface_ops(starpu_data_handle_t handle);
  1137. ! unsigned starpu_data_test_if_allocated_on_node(starpu_data_handle_t handle, unsigned memory_node);
  1138. function fstarpu_data_test_if_allocated_on_node(dh,mem_node) bind(C,name="starpu_data_test_if_allocated_on_node")
  1139. use iso_c_binding, only: c_ptr, c_int
  1140. integer(c_int) :: fstarpu_data_test_if_allocated_on_node
  1141. type(c_ptr), value, intent(in) :: dh
  1142. integer(c_int), value, intent(in) :: mem_node
  1143. end function fstarpu_data_test_if_allocated_on_node
  1144. ! void starpu_memchunk_tidy(unsigned memory_node);
  1145. subroutine fstarpu_memchunk_tidy (mem_node) bind(c,name="starpu_memchunk_tidy")
  1146. use iso_c_binding, only: c_int
  1147. integer(c_int), value, intent(in) :: mem_node
  1148. end subroutine fstarpu_memchunk_tidy
  1149. ! == starpu_task_util.h ==
  1150. ! struct starpu_data_handle *fstarpu_data_handle_array_alloc(int nb);
  1151. function fstarpu_data_handle_array_alloc (nb) bind(C)
  1152. use iso_c_binding, only: c_ptr, c_int
  1153. type(c_ptr) :: fstarpu_data_handle_array_alloc
  1154. integer(c_int), value, intent(in) :: nb
  1155. end function fstarpu_data_handle_array_alloc
  1156. ! void fstarpu_data_handle_array_free(starpu_data_handle_t *handles);
  1157. subroutine fstarpu_data_handle_array_free (handles) bind(C)
  1158. use iso_c_binding, only: c_ptr
  1159. type(c_ptr), value, intent(in) :: handles
  1160. end subroutine fstarpu_data_handle_array_free
  1161. ! void fstarpu_data_handle_array_set(starpu_data_handle_t *handles, int i, starpu_data_handle_t handle);
  1162. subroutine fstarpu_data_handle_array_set (handles, i, handle) bind(C)
  1163. use iso_c_binding, only: c_ptr, c_int
  1164. type(c_ptr), value, intent(in) :: handles
  1165. integer(c_int), value, intent(in) :: i
  1166. type(c_ptr), value, intent(in) :: handle
  1167. end subroutine fstarpu_data_handle_array_set
  1168. ! struct starpu_data_descr *fstarpu_data_descr_array_alloc(int nb);
  1169. function fstarpu_data_descr_array_alloc (nb) bind(C)
  1170. use iso_c_binding, only: c_ptr, c_int
  1171. type(c_ptr) :: fstarpu_data_descr_array_alloc
  1172. integer(c_int), value, intent(in) :: nb
  1173. end function fstarpu_data_descr_array_alloc
  1174. ! struct starpu_data_descr *fstarpu_data_descr_alloc(void);
  1175. function fstarpu_data_descr_alloc (nb) bind(C)
  1176. use iso_c_binding, only: c_ptr
  1177. type(c_ptr) :: fstarpu_data_descr_alloc
  1178. end function fstarpu_data_descr_alloc
  1179. ! void fstarpu_data_descr_array_free(struct starpu_data_descr *descrs);
  1180. subroutine fstarpu_data_descr_array_free (descrs) bind(C)
  1181. use iso_c_binding, only: c_ptr
  1182. type(c_ptr), value, intent(in) :: descrs
  1183. end subroutine fstarpu_data_descr_array_free
  1184. ! void fstarpu_data_descr_free(struct starpu_data_descr *descr);
  1185. subroutine fstarpu_data_descrg_free (descr) bind(C)
  1186. use iso_c_binding, only: c_ptr
  1187. type(c_ptr), value, intent(in) :: descr
  1188. end subroutine fstarpu_data_descrg_free
  1189. ! void fstarpu_data_descr_array_set(struct starpu_data_descr *descrs, int i, starpu_data_handle_t handle, intptr_t mode);
  1190. subroutine fstarpu_data_descr_array_set (descrs, i, handle, mode) bind(C)
  1191. use iso_c_binding, only: c_ptr, c_int, c_intptr_t
  1192. type(c_ptr), value, intent(in) :: descrs
  1193. integer(c_int), value, intent(in) :: i
  1194. type(c_ptr), value, intent(in) :: handle
  1195. type(c_ptr), value, intent(in) :: mode ! C func expects c_intptr_t
  1196. end subroutine fstarpu_data_descr_array_set
  1197. ! void fstarpu_data_descr_set(struct starpu_data_descr *descr, starpu_data_handle_t handle, intptr_t mode);
  1198. subroutine fstarpu_data_descr_set (descr, handle, mode) bind(C)
  1199. use iso_c_binding, only: c_ptr, c_intptr_t
  1200. type(c_ptr), value, intent(in) :: descr
  1201. type(c_ptr), value, intent(in) :: handle
  1202. type(c_ptr), value, intent(in) :: mode ! C func expects c_intptr_t
  1203. end subroutine fstarpu_data_descr_set
  1204. subroutine fstarpu_insert_task(arglist) bind(C)
  1205. use iso_c_binding, only: c_ptr
  1206. type(c_ptr), dimension(:), intent(in) :: arglist
  1207. end subroutine fstarpu_insert_task
  1208. subroutine fstarpu_unpack_arg(cl_arg,bufferlist) bind(C)
  1209. use iso_c_binding, only: c_ptr
  1210. type(c_ptr), value, intent(in) :: cl_arg
  1211. type(c_ptr), dimension(:), intent(in) :: bufferlist
  1212. end subroutine fstarpu_unpack_arg
  1213. ! == starpu_sched_ctx.h ==
  1214. ! starpu_sched_ctx_create: see fstarpu_sched_ctx_create
  1215. function fstarpu_sched_ctx_create(workers_array,nworkers,ctx_name) bind(C)
  1216. use iso_c_binding, only: c_int, c_char
  1217. integer(c_int) :: fstarpu_sched_ctx_create
  1218. integer(c_int), intent(in) :: workers_array(*)
  1219. integer(c_int), value, intent(in) :: nworkers
  1220. character(c_char), intent(in) :: ctx_name
  1221. end function fstarpu_sched_ctx_create
  1222. ! unsigned starpu_sched_ctx_create_inside_interval(const char *policy_name, const char *sched_ctx_name, int min_ncpus, int max_ncpus, int min_ngpus, int max_ngpus, unsigned allow_overlap);
  1223. ! void starpu_sched_ctx_register_close_callback(unsigned sched_ctx_id, void (*close_callback)(unsigned sched_ctx_id, void* args), void *args);
  1224. ! void starpu_sched_ctx_add_workers(int *workerids_ctx, int nworkers_ctx, unsigned sched_ctx_id);
  1225. subroutine fstarpu_sched_ctx_add_workers(workerids,nworkers,ctx) bind(C,name="starpu_sched_ctx_add_workers")
  1226. use iso_c_binding, only: c_int
  1227. integer(c_int), intent(in) :: workerids (*)
  1228. integer(c_int), value, intent(in) :: nworkers
  1229. integer(c_int), value, intent(in) :: ctx
  1230. end subroutine fstarpu_sched_ctx_add_workers
  1231. ! void starpu_sched_ctx_remove_workers(int *workerids_ctx, int nworkers_ctx, unsigned sched_ctx_id);
  1232. subroutine fstarpu_sched_ctx_remove_workers(workerids,nworkers,ctx) bind(C,name="starpu_sched_ctx_remove_workers")
  1233. use iso_c_binding, only: c_int
  1234. integer(c_int), intent(in) :: workerids (*)
  1235. integer(c_int), value, intent(in) :: nworkers
  1236. integer(c_int), value, intent(in) :: ctx
  1237. end subroutine fstarpu_sched_ctx_remove_workers
  1238. ! starpu_sched_ctx_display_workers: see fstarpu_sched_ctx_display_workers
  1239. subroutine fstarpu_sched_ctx_display_workers (ctx) bind(C)
  1240. use iso_c_binding, only: c_int
  1241. integer(c_int), value, intent(in) :: ctx
  1242. end subroutine fstarpu_sched_ctx_display_workers
  1243. ! void starpu_sched_ctx_delete(unsigned sched_ctx_id);
  1244. subroutine fstarpu_sched_ctx_delete (ctx) bind(C,name="starpu_sched_ctx_delete")
  1245. use iso_c_binding, only: c_int
  1246. integer(c_int), value, intent(in) :: ctx
  1247. end subroutine fstarpu_sched_ctx_delete
  1248. ! void starpu_sched_ctx_set_inheritor(unsigned sched_ctx_id, unsigned inheritor);
  1249. subroutine fstarpu_sched_ctx_set_inheritor (ctx,inheritor) bind(C,name="starpu_sched_ctx_set_inheritor")
  1250. use iso_c_binding, only: c_int
  1251. integer(c_int), value, intent(in) :: ctx
  1252. integer(c_int), value, intent(in) :: inheritor
  1253. end subroutine fstarpu_sched_ctx_set_inheritor
  1254. ! unsigned starpu_sched_ctx_get_inheritor(unsigned sched_ctx_id);
  1255. function fstarpu_sched_ctx_get_inheritor (ctx) bind(C,name="starpu_sched_ctx_get_inheritor")
  1256. use iso_c_binding, only: c_int
  1257. integer(c_int) :: fstarpu_sched_ctx_get_inheritor
  1258. integer(c_int), value, intent(in) :: ctx
  1259. end function fstarpu_sched_ctx_get_inheritor
  1260. ! unsigned starpu_sched_ctx_get_hierarchy_level(unsigned sched_ctx_id);
  1261. function fstarpu_sched_ctx_get_hierarchy_level (ctx) bind(C,name="starpu_sched_ctx_get_hierarchy_level")
  1262. use iso_c_binding, only: c_int
  1263. integer(c_int) :: fstarpu_sched_ctx_get_hierarchy_level
  1264. integer(c_int), value, intent(in) :: ctx
  1265. end function fstarpu_sched_ctx_get_hierarchy_level
  1266. ! void starpu_sched_ctx_set_context(unsigned *sched_ctx_id);
  1267. subroutine fstarpu_sched_ctx_set_context (ctx_ptr) bind(C,name="starpu_sched_ctx_set_context")
  1268. use iso_c_binding, only: c_ptr
  1269. type(c_ptr), value, intent(in) :: ctx_ptr
  1270. end subroutine fstarpu_sched_ctx_set_context
  1271. ! unsigned starpu_sched_ctx_get_context(void);
  1272. function fstarpu_sched_ctx_get_context () bind(C,name="starpu_sched_ctx_get_context")
  1273. use iso_c_binding, only: c_int
  1274. integer(c_int) :: fstarpu_sched_ctx_get_context
  1275. end function fstarpu_sched_ctx_get_context
  1276. ! == starpu_fxt.h ==
  1277. ! void starpu_fxt_options_init(struct starpu_fxt_options *options);
  1278. subroutine fstarpu_fxt_options_init (fxt_options) bind(C,name="starpu_fxt_options_init")
  1279. use iso_c_binding, only: c_ptr
  1280. type(c_ptr), value, intent(in) :: fxt_options
  1281. end subroutine fstarpu_fxt_options_init
  1282. ! void starpu_fxt_generate_trace(struct starpu_fxt_options *options);
  1283. subroutine fstarpu_fxt_generate_trace (fxt_options) bind(C,name="starpu_fxt_generate_trace")
  1284. use iso_c_binding, only: c_ptr
  1285. type(c_ptr), value, intent(in) :: fxt_options
  1286. end subroutine fstarpu_fxt_generate_trace
  1287. ! void starpu_fxt_autostart_profiling(int autostart);
  1288. subroutine fstarpu_fxt_autostart_profiling (autostart) bind(c,name="starpu_fxt_autostart_profiling")
  1289. use iso_c_binding, only: c_int
  1290. integer(c_int), value, intent(in) :: autostart
  1291. end subroutine fstarpu_fxt_autostart_profiling
  1292. ! void starpu_fxt_start_profiling(void);
  1293. subroutine fstarpu_fxt_start_profiling () bind(c,name="starpu_fxt_start_profiling")
  1294. use iso_c_binding
  1295. end subroutine fstarpu_fxt_start_profiling
  1296. ! void starpu_fxt_stop_profiling(void);
  1297. subroutine fstarpu_fxt_stop_profiling () bind(c,name="starpu_fxt_stop_profiling")
  1298. use iso_c_binding
  1299. end subroutine fstarpu_fxt_stop_profiling
  1300. ! void starpu_fxt_write_data_trace(char *filename_in);
  1301. subroutine fstarpu_fxt_write_data_trace (filename) bind(c,name="starpu_fxt_write_data_trace")
  1302. use iso_c_binding, only: c_char
  1303. character(c_char), intent(in) :: filename
  1304. end subroutine fstarpu_fxt_write_data_trace
  1305. ! void starpu_fxt_trace_user_event(unsigned long code);
  1306. subroutine fstarpu_trace_user_event (code) bind(c,name="starpu_trace_user_event")
  1307. use iso_c_binding, only: c_long
  1308. integer(c_long), value, intent(in) :: code
  1309. end subroutine fstarpu_trace_user_event
  1310. end interface
  1311. contains
  1312. function or_cptrs(op1,op2)
  1313. type(c_ptr) :: or_cptrs
  1314. type(c_ptr),intent(in) :: op1,op2
  1315. integer(c_intptr_t) :: i_op1,i_op2
  1316. i_op1 = transfer(op1,0_c_intptr_t)
  1317. i_op2 = transfer(op2,0_c_intptr_t)
  1318. or_cptrs = transfer(ior(i_op1,i_op2), C_NULL_PTR)
  1319. end function
  1320. function ip_to_p(i) bind(C)
  1321. use iso_c_binding, only: c_ptr,c_intptr_t,C_NULL_PTR
  1322. type(c_ptr) :: ip_to_p
  1323. integer(c_intptr_t), value, intent(in) :: i
  1324. ip_to_p = transfer(i,C_NULL_PTR)
  1325. end function ip_to_p
  1326. function p_to_ip(p) bind(C)
  1327. use iso_c_binding, only: c_ptr,c_intptr_t
  1328. integer(c_intptr_t) :: p_to_ip
  1329. type(c_ptr), value, intent(in) :: p
  1330. p_to_ip = transfer(p,0_c_intptr_t)
  1331. end function p_to_ip
  1332. function sz_to_p(sz) bind(C)
  1333. use iso_c_binding, only: c_ptr,c_size_t,c_intptr_t
  1334. type(c_ptr) :: sz_to_p
  1335. integer(c_size_t), value, intent(in) :: sz
  1336. sz_to_p = ip_to_p(int(sz,kind=c_intptr_t))
  1337. end function sz_to_p
  1338. function fstarpu_init (conf) bind(C)
  1339. use iso_c_binding
  1340. integer(c_int) :: fstarpu_init
  1341. type(c_ptr), value, intent(in) :: conf
  1342. integer(c_int) :: FSTARPU_SZ_C_INT_dummy
  1343. integer(c_intptr_t) :: FSTARPU_SZ_C_INTPTR_T_dummy
  1344. integer(4) :: FSTARPU_SZ_INT4_dummy
  1345. integer(8) :: FSTARPU_SZ_INT8_dummy
  1346. real(4) :: FSTARPU_SZ_REAL4_dummy
  1347. real(8) :: FSTARPU_SZ_REAL8_dummy
  1348. ! Note: Referencing global C constants from Fortran has
  1349. ! been found unreliable on some architectures, notably
  1350. ! on Darwin. The get_integer/get_pointer_constant
  1351. ! scheme is a workaround to that issue.
  1352. interface
  1353. ! These functions are not exported to the end user
  1354. function fstarpu_get_constant(s) bind(C)
  1355. use iso_c_binding, only: c_ptr,c_char
  1356. type(c_ptr) :: fstarpu_get_constant ! C function returns an intptr_t
  1357. character(kind=c_char) :: s
  1358. end function fstarpu_get_constant
  1359. function fstarpu_init_internal (conf) bind(C,name="starpu_init")
  1360. use iso_c_binding, only: c_ptr,c_int
  1361. integer(c_int) :: fstarpu_init_internal
  1362. type(c_ptr), value :: conf
  1363. end function fstarpu_init_internal
  1364. end interface
  1365. ! Initialize Fortran constants from C peers
  1366. FSTARPU_R = fstarpu_get_constant(C_CHAR_"FSTARPU_R"//C_NULL_CHAR)
  1367. FSTARPU_W = fstarpu_get_constant(C_CHAR_"FSTARPU_W"//C_NULL_CHAR)
  1368. FSTARPU_RW = fstarpu_get_constant(C_CHAR_"FSTARPU_RW"//C_NULL_CHAR)
  1369. FSTARPU_SCRATCH = fstarpu_get_constant(C_CHAR_"FSTARPU_SCRATCH"//C_NULL_CHAR)
  1370. FSTARPU_REDUX = fstarpu_get_constant(C_CHAR_"FSTARPU_REDUX"//C_NULL_CHAR)
  1371. FSTARPU_COMMUTE = fstarpu_get_constant(C_CHAR_"FSTARPU_COMMUTE"//C_NULL_CHAR)
  1372. FSTARPU_SSEND = fstarpu_get_constant(C_CHAR_"FSTARPU_SSEND"//C_NULL_CHAR)
  1373. FSTARPU_LOCALITY = fstarpu_get_constant(C_CHAR_"FSTARPU_LOCALITY"//C_NULL_CHAR)
  1374. FSTARPU_DATA_ARRAY = fstarpu_get_constant(C_CHAR_"FSTARPU_DATA_ARRAY"//C_NULL_CHAR)
  1375. FSTARPU_DATA_MODE_ARRAY = fstarpu_get_constant(C_CHAR_"FSTARPU_DATA_MODE_ARRAY"//C_NULL_CHAR)
  1376. FSTARPU_CL_ARGS = fstarpu_get_constant(C_CHAR_"FSTARPU_CL_ARGS"//C_NULL_CHAR)
  1377. FSTARPU_CALLBACK = fstarpu_get_constant(C_CHAR_"FSTARPU_CALLBACK"//C_NULL_CHAR)
  1378. FSTARPU_CALLBACK_WITH_ARG = fstarpu_get_constant(C_CHAR_"FSTARPU_CALLBACK_WITH_ARG"//C_NULL_CHAR)
  1379. FSTARPU_CALLBACK_ARG = fstarpu_get_constant(C_CHAR_"FSTARPU_CALLBACK_ARG"//C_NULL_CHAR)
  1380. FSTARPU_PROLOGUE_CALLBACK = fstarpu_get_constant(C_CHAR_"FSTARPU_PROLOGUE_CALLBACK"//C_NULL_CHAR)
  1381. FSTARPU_PROLOGUE_CALLBACK_ARG = fstarpu_get_constant(C_CHAR_"FSTARPU_PROLOGUE_CALLBACK_ARG"//C_NULL_CHAR)
  1382. FSTARPU_PROLOGUE_CALLBACK_POP = fstarpu_get_constant(C_CHAR_"FSTARPU_PROLOGUE_CALLBACK_POP"//C_NULL_CHAR)
  1383. FSTARPU_PROLOGUE_CALLBACK_POP_ARG = &
  1384. fstarpu_get_constant(C_CHAR_"FSTARPU_PROLOGUE_CALLBACK_POP_ARG"//C_NULL_CHAR)
  1385. FSTARPU_PRIORITY = fstarpu_get_constant(C_CHAR_"FSTARPU_PRIORITY"//C_NULL_CHAR)
  1386. FSTARPU_EXECUTE_ON_NODE = fstarpu_get_constant(C_CHAR_"FSTARPU_EXECUTE_ON_NODE"//C_NULL_CHAR)
  1387. FSTARPU_EXECUTE_ON_DATA = fstarpu_get_constant(C_CHAR_"FSTARPU_EXECUTE_ON_DATA"//C_NULL_CHAR)
  1388. FSTARPU_EXECUTE_ON_WORKER = fstarpu_get_constant(C_CHAR_"FSTARPU_EXECUTE_ON_WORKER"//C_NULL_CHAR)
  1389. FSTARPU_WORKER_ORDER = fstarpu_get_constant(C_CHAR_"FSTARPU_WORKER_ORDER"//C_NULL_CHAR)
  1390. FSTARPU_HYPERVISOR_TAG = fstarpu_get_constant(C_CHAR_"FSTARPU_HYPERVISOR_TAG"//C_NULL_CHAR)
  1391. FSTARPU_POSSIBLY_PARALLEL = fstarpu_get_constant(C_CHAR_"FSTARPU_POSSIBLY_PARALLEL"//C_NULL_CHAR)
  1392. FSTARPU_FLOPS = fstarpu_get_constant(C_CHAR_"FSTARPU_FLOPS"//C_NULL_CHAR)
  1393. FSTARPU_TAG = fstarpu_get_constant(C_CHAR_"FSTARPU_TAG"//C_NULL_CHAR)
  1394. FSTARPU_TAG_ONLY = fstarpu_get_constant(C_CHAR_"FSTARPU_TAG_ONLY"//C_NULL_CHAR)
  1395. FSTARPU_NAME = fstarpu_get_constant(C_CHAR_"FSTARPU_NAME"//C_NULL_CHAR)
  1396. FSTARPU_NODE_SELECTION_POLICY = fstarpu_get_constant(C_CHAR_"FSTARPU_NODE_SELECTION_POLICY"//C_NULL_CHAR)
  1397. FSTARPU_VALUE = fstarpu_get_constant(C_CHAR_"FSTARPU_VALUE"//C_NULL_CHAR)
  1398. FSTARPU_SCHED_CTX = fstarpu_get_constant(C_CHAR_"FSTARPU_SCHED_CTX"//C_NULL_CHAR)
  1399. FSTARPU_CPU_WORKER = fstarpu_get_constant(C_CHAR_"FSTARPU_CPU_WORKER"//C_NULL_CHAR)
  1400. FSTARPU_CUDA_WORKER = fstarpu_get_constant(C_CHAR_"FSTARPU_CUDA_WORKER"//C_NULL_CHAR)
  1401. FSTARPU_OPENCL_WORKER = fstarpu_get_constant(C_CHAR_"FSTARPU_OPENCL_WORKER"//C_NULL_CHAR)
  1402. FSTARPU_MIC_WORKER = fstarpu_get_constant(C_CHAR_"FSTARPU_MIC_WORKER"//C_NULL_CHAR)
  1403. FSTARPU_SCC_WORKER = fstarpu_get_constant(C_CHAR_"FSTARPU_SCC_WORKER"//C_NULL_CHAR)
  1404. FSTARPU_ANY_WORKER = fstarpu_get_constant(C_CHAR_"FSTARPU_ANY_WORKER"//C_NULL_CHAR)
  1405. FSTARPU_NMAXBUFS = int(p_to_ip(fstarpu_get_constant(C_CHAR_"FSTARPU_NMAXBUFS"//C_NULL_CHAR)),c_int)
  1406. ! Initialize size constants as 'c_ptr'
  1407. FSTARPU_SZ_C_INT = sz_to_p(c_sizeof(FSTARPU_SZ_C_INT_dummy))
  1408. FSTARPU_SZ_C_INTPTR_T = sz_to_p(c_sizeof(FSTARPU_SZ_C_INTPTR_T_dummy))
  1409. FSTARPU_SZ_INT4 = sz_to_p(c_sizeof(FSTARPU_SZ_INT4_dummy))
  1410. FSTARPU_SZ_INT8 = sz_to_p(c_sizeof(FSTARPU_SZ_INT8_dummy))
  1411. FSTARPU_SZ_REAL4 = sz_to_p(c_sizeof(FSTARPU_SZ_REAL4_dummy))
  1412. FSTARPU_SZ_REAL8 = sz_to_p(c_sizeof(FSTARPU_SZ_REAL8_dummy))
  1413. ! Initialize StarPU
  1414. if (c_associated(conf)) then
  1415. fstarpu_init = fstarpu_init_internal(conf)
  1416. else
  1417. fstarpu_init = fstarpu_init_internal(C_NULL_PTR)
  1418. end if
  1419. end function fstarpu_init
  1420. function fstarpu_csizet_to_cptr(i) bind(C)
  1421. use iso_c_binding
  1422. type(c_ptr) :: fstarpu_csizet_to_cptr
  1423. integer(c_size_t) :: i
  1424. fstarpu_csizet_to_cptr = transfer(int(i,kind=c_intptr_t),C_NULL_PTR)
  1425. end function fstarpu_csizet_to_cptr
  1426. function fstarpu_int_to_cptr(i) bind(C)
  1427. use iso_c_binding
  1428. type(c_ptr) :: fstarpu_int_to_cptr
  1429. integer :: i
  1430. fstarpu_int_to_cptr = transfer(int(i,kind=c_intptr_t),C_NULL_PTR)
  1431. end function fstarpu_int_to_cptr
  1432. end module fstarpu_mod