fstarpu_mod.f90 104 KB

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