fstarpu_mod.f90 60 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074
  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_VALUE
  30. type(c_ptr), bind(C) :: FSTARPU_SCHED_CTX
  31. type(c_ptr), bind(C) :: FSTARPU_CPU_WORKER
  32. type(c_ptr), bind(C) :: FSTARPU_CUDA_WORKER
  33. type(c_ptr), bind(C) :: FSTARPU_OPENCL_WORKER
  34. type(c_ptr), bind(C) :: FSTARPU_MIC_WORKER
  35. type(c_ptr), bind(C) :: FSTARPU_SCC_WORKER
  36. type(c_ptr), bind(C) :: FSTARPU_ANY_WORKER
  37. type(c_ptr), bind(C) :: FSTARPU_SZ_INT4
  38. type(c_ptr), bind(C) :: FSTARPU_SZ_INT8
  39. type(c_ptr), bind(C) :: FSTARPU_SZ_REAL4
  40. type(c_ptr), bind(C) :: FSTARPU_SZ_REAL8
  41. interface operator (.ior.)
  42. procedure or_cptrs
  43. end interface operator (.ior.)
  44. interface
  45. ! == starpu.h ==
  46. ! void starpu_conf_init(struct starpu_conf *conf);
  47. subroutine fstarpu_conf_init (conf) bind(C,name="starpu_conf_init")
  48. use iso_c_binding, only: c_ptr
  49. type(c_ptr), value, intent(in) :: conf
  50. end subroutine fstarpu_conf_init
  51. function fstarpu_conf_allocate () bind(C)
  52. use iso_c_binding, only: c_ptr
  53. type(c_ptr) :: fstarpu_conf_allocate
  54. end function fstarpu_conf_allocate
  55. subroutine fstarpu_conf_free (conf) bind(C)
  56. use iso_c_binding, only: c_ptr
  57. type(c_ptr), value, intent(in) :: conf
  58. end subroutine fstarpu_conf_free
  59. subroutine fstarpu_conf_set_sched_policy_name (conf, policy_name) bind(C)
  60. use iso_c_binding, only: c_ptr, c_char
  61. type(c_ptr), value, intent(in) :: conf
  62. character(c_char), intent(in) :: policy_name
  63. end subroutine fstarpu_conf_set_sched_policy_name
  64. subroutine fstarpu_conf_set_min_prio (conf, min_prio) bind(C)
  65. use iso_c_binding, only: c_ptr, c_int
  66. type(c_ptr), value, intent(in) :: conf
  67. integer(c_int), value, intent(in) :: min_prio
  68. end subroutine fstarpu_conf_set_min_prio
  69. subroutine fstarpu_conf_set_max_prio (conf, max_prio) bind(C)
  70. use iso_c_binding, only: c_ptr, c_int
  71. type(c_ptr), value, intent(in) :: conf
  72. integer(c_int), value, intent(in) :: max_prio
  73. end subroutine fstarpu_conf_set_max_prio
  74. subroutine fstarpu_conf_set_ncpu (conf, ncpu) bind(C)
  75. use iso_c_binding, only: c_ptr, c_int
  76. type(c_ptr), value, intent(in) :: conf
  77. integer(c_int), value, intent(in) :: ncpu
  78. end subroutine fstarpu_conf_set_ncpu
  79. subroutine fstarpu_conf_set_ncuda (conf, ncuda) bind(C)
  80. use iso_c_binding, only: c_ptr, c_int
  81. type(c_ptr), value, intent(in) :: conf
  82. integer(c_int), value, intent(in) :: ncuda
  83. end subroutine fstarpu_conf_set_ncuda
  84. subroutine fstarpu_conf_set_nopencl (conf, nopencl) bind(C)
  85. use iso_c_binding, only: c_ptr, c_int
  86. type(c_ptr), value, intent(in) :: conf
  87. integer(c_int), value, intent(in) :: nopencl
  88. end subroutine fstarpu_conf_set_nopencl
  89. subroutine fstarpu_conf_set_nmic (conf, nmic) bind(C)
  90. use iso_c_binding, only: c_ptr, c_int
  91. type(c_ptr), value, intent(in) :: conf
  92. integer(c_int), value, intent(in) :: nmic
  93. end subroutine fstarpu_conf_set_nmic
  94. subroutine fstarpu_conf_set_nscc (conf, nscc) bind(C)
  95. use iso_c_binding, only: c_ptr, c_int
  96. type(c_ptr), value, intent(in) :: conf
  97. integer(c_int), value, intent(in) :: nscc
  98. end subroutine fstarpu_conf_set_nscc
  99. ! starpu_init: see fstarpu_init
  100. ! starpu_initialize: see fstarpu_init
  101. ! void starpu_pause(void);
  102. subroutine fstarpu_pause() bind(C,name="starpu_pause")
  103. end subroutine fstarpu_pause
  104. ! void starpu_resume(void);
  105. subroutine fstarpu_resume() bind(C,name="starpu_resume")
  106. end subroutine fstarpu_resume
  107. ! void starpu_shutdown(void);
  108. subroutine fstarpu_shutdown () bind(C,name="starpu_shutdown")
  109. end subroutine fstarpu_shutdown
  110. ! starpu_topology_print
  111. subroutine fstarpu_topology_print () bind(C)
  112. end subroutine fstarpu_topology_print
  113. ! int starpu_asynchronous_copy_disabled(void);
  114. function fstarpu_asynchronous_copy_disabled() bind(C,name="starpu_asynchronous_copy_disabled")
  115. use iso_c_binding, only: c_int
  116. integer(c_int) :: fstarpu_asynchronous_copy_disabled
  117. end function fstarpu_asynchronous_copy_disabled
  118. ! int starpu_asynchronous_cuda_copy_disabled(void);
  119. function fstarpu_asynchronous_cuda_copy_disabled() bind(C,name="starpu_asynchronous_cuda_copy_disabled")
  120. use iso_c_binding, only: c_int
  121. integer(c_int) :: fstarpu_asynchronous_cuda_copy_disabled
  122. end function fstarpu_asynchronous_cuda_copy_disabled
  123. ! int starpu_asynchronous_opencl_copy_disabled(void);
  124. function fstarpu_asynchronous_opencl_copy_disabled() bind(C,name="starpu_asynchronous_opencl_copy_disabled")
  125. use iso_c_binding, only: c_int
  126. integer(c_int) :: fstarpu_asynchronous_opencl_copy_disabled
  127. end function fstarpu_asynchronous_opencl_copy_disabled
  128. ! int starpu_asynchronous_mic_copy_disabled(void);
  129. function fstarpu_asynchronous_mic_copy_disabled() bind(C,name="starpu_asynchronous_mic_copy_disabled")
  130. use iso_c_binding, only: c_int
  131. integer(c_int) :: fstarpu_asynchronous_mic_copy_disabled
  132. end function fstarpu_asynchronous_mic_copy_disabled
  133. ! void starpu_display_stats();
  134. subroutine fstarpu_display_stats() bind(C,name="starpu_display_stats")
  135. end subroutine fstarpu_display_stats
  136. ! void starpu_get_version(int *major, int *minor, int *release);
  137. subroutine fstarpu_get_version(major,minor,release) bind(C,name="starpu_get_version")
  138. use iso_c_binding, only: c_int
  139. integer(c_int), intent(out) :: major,minor,release
  140. end subroutine fstarpu_get_version
  141. ! == starpu_worker.h ==
  142. ! unsigned starpu_worker_get_count(void);
  143. function fstarpu_worker_get_count() bind(C,name="starpu_worker_get_count")
  144. use iso_c_binding, only: c_int
  145. integer(c_int) :: fstarpu_worker_get_count
  146. end function fstarpu_worker_get_count
  147. ! unsigned starpu_combined_worker_get_count(void);
  148. function fstarpu_combined_worker_get_count() bind(C,name="starpu_combined_worker_get_count")
  149. use iso_c_binding, only: c_int
  150. integer(c_int) :: fstarpu_combined_worker_get_count
  151. end function fstarpu_combined_worker_get_count
  152. ! unsigned starpu_worker_is_combined_worker(int id);
  153. function fstarpu_worker_is_combined_worker(id) bind(C,name="starpu_worker_is_combined_worker")
  154. use iso_c_binding, only: c_int
  155. integer(c_int) :: fstarpu_worker_is_combined_worker
  156. integer(c_int), value, intent(in) :: id
  157. end function fstarpu_worker_is_combined_worker
  158. ! unsigned starpu_cpu_worker_get_count(void);
  159. function fstarpu_cpu_worker_get_count() bind(C,name="starpu_cpu_worker_get_count")
  160. use iso_c_binding, only: c_int
  161. integer(c_int) :: fstarpu_cpu_worker_get_count
  162. end function fstarpu_cpu_worker_get_count
  163. ! unsigned starpu_cuda_worker_get_count(void);
  164. function fstarpu_cuda_worker_get_count() bind(C,name="starpu_cuda_worker_get_count")
  165. use iso_c_binding, only: c_int
  166. integer(c_int) :: fstarpu_cuda_worker_get_count
  167. end function fstarpu_cuda_worker_get_count
  168. ! unsigned starpu_opencl_worker_get_count(void);
  169. function fstarpu_opencl_worker_get_count() bind(C,name="starpu_opencl_worker_get_count")
  170. use iso_c_binding, only: c_int
  171. integer(c_int) :: fstarpu_opencl_worker_get_count
  172. end function fstarpu_opencl_worker_get_count
  173. ! unsigned starpu_mic_worker_get_count(void);
  174. function fstarpu_mic_worker_get_count() bind(C,name="starpu_mic_worker_get_count")
  175. use iso_c_binding, only: c_int
  176. integer(c_int) :: fstarpu_mic_worker_get_count
  177. end function fstarpu_mic_worker_get_count
  178. ! unsigned starpu_scc_worker_get_count(void);
  179. function fstarpu_scc_worker_get_count() bind(C,name="starpu_scc_worker_get_count")
  180. use iso_c_binding, only: c_int
  181. integer(c_int) :: fstarpu_scc_worker_get_count
  182. end function fstarpu_scc_worker_get_count
  183. ! int starpu_worker_get_id(void);
  184. function fstarpu_worker_get_id() bind(C,name="starpu_worker_get_id")
  185. use iso_c_binding, only: c_int
  186. integer(c_int) :: fstarpu_worker_get_id
  187. end function fstarpu_worker_get_id
  188. ! _starpu_worker_get_id_check
  189. ! starpu_worker_get_id_check
  190. ! int starpu_worker_get_bindid(int workerid);
  191. function fstarpu_worker_get_bindid(id) bind(C,name="starpu_worker_get_bindid")
  192. use iso_c_binding, only: c_int
  193. integer(c_int) :: fstarpu_worker_get_bindid
  194. integer(c_int), value, intent(in) :: id
  195. end function fstarpu_worker_get_bindid
  196. ! int starpu_combined_worker_get_id(void);
  197. function fstarpu_combined_worker_get_id() bind(C,name="starpu_combined_worker_get_id")
  198. use iso_c_binding, only: c_int
  199. integer(c_int) :: fstarpu_combined_worker_get_id
  200. end function fstarpu_combined_worker_get_id
  201. ! int starpu_combined_worker_get_size(void);
  202. function fstarpu_combined_worker_get_size() bind(C,name="starpu_combined_worker_get_size")
  203. use iso_c_binding, only: c_int
  204. integer(c_int) :: fstarpu_combined_worker_get_size
  205. end function fstarpu_combined_worker_get_size
  206. ! int starpu_combined_worker_get_rank(void);
  207. function fstarpu_combined_worker_get_rank() bind(C,name="starpu_combined_worker_get_rank")
  208. use iso_c_binding, only: c_int
  209. integer(c_int) :: fstarpu_combined_worker_get_rank
  210. end function fstarpu_combined_worker_get_rank
  211. ! enum starpu_worker_archtype starpu_worker_get_type(int id);
  212. function fstarpu_worker_get_type(id) bind(C)
  213. use iso_c_binding, only: c_int, c_ptr
  214. type(c_ptr) :: fstarpu_worker_get_type ! C function returns c_intptr_t
  215. integer(c_int),value,intent(in) :: id
  216. end function fstarpu_worker_get_type
  217. ! int starpu_worker_get_count_by_type(enum starpu_worker_archtype type);
  218. function fstarpu_worker_get_count_by_type(typeid) bind(C)
  219. use iso_c_binding, only: c_int, c_ptr
  220. integer(c_int) :: fstarpu_worker_get_count_by_type
  221. type(c_ptr),value,intent(in) :: typeid ! c_intptr_t expected by C func
  222. end function fstarpu_worker_get_count_by_type
  223. ! int starpu_worker_get_ids_by_type(enum starpu_worker_archtype type, int *workerids, int maxsize);
  224. function fstarpu_worker_get_ids_by_type(typeid, workerids, maxsize) bind(C)
  225. use iso_c_binding, only: c_int, c_ptr
  226. integer(c_int) :: fstarpu_worker_get_ids_by_type
  227. type(c_ptr),value,intent(in) :: typeid ! c_intptr_t expected by C func
  228. integer(c_int),intent(out) :: workerids(*)
  229. integer(c_int),value,intent(in) :: maxsize
  230. end function fstarpu_worker_get_ids_by_type
  231. ! int starpu_worker_get_by_type(enum starpu_worker_archtype type, int num);
  232. function fstarpu_worker_get_by_type(typeid, num) bind(C)
  233. use iso_c_binding, only: c_int, c_ptr
  234. integer(c_int) :: fstarpu_worker_get_by_type
  235. type(c_ptr),value,intent(in) :: typeid ! c_intptr_t expected by C func
  236. integer(c_int),value,intent(in) :: num
  237. end function fstarpu_worker_get_by_type
  238. ! int starpu_worker_get_by_devid(enum starpu_worker_archtype type, int devid);
  239. function fstarpu_worker_get_by_devid(typeid, devid) bind(C)
  240. use iso_c_binding, only: c_int, c_ptr
  241. integer(c_int) :: fstarpu_worker_get_by_type
  242. type(c_ptr),value,intent(in) :: typeid ! c_intptr_t expected by C func
  243. integer(c_int),value,intent(in) :: devid
  244. end function fstarpu_worker_get_by_devid
  245. ! void starpu_worker_get_name(int id, char *dst, size_t maxlen);
  246. subroutine fstarpu_worker_get_name(id, dst, maxlen) bind(C,name="starpu_worker_get_name")
  247. use iso_c_binding, only: c_int, c_char, c_size_t
  248. integer(c_int),value,intent(in) :: id
  249. character(c_char),intent(out) :: dst(*)
  250. integer(c_size_t),value,intent(in) :: maxlen
  251. end subroutine fstarpu_worker_get_name
  252. ! int starpu_worker_get_devid(int id);
  253. function fstarpu_worker_get_devid(id) bind(C,name="starpu_worker_get_devid")
  254. use iso_c_binding, only: c_int
  255. integer(c_int) :: fstarpu_worker_get_devid
  256. integer(c_int), value, intent(in) :: id
  257. end function fstarpu_worker_get_devid
  258. ! int starpu_worker_get_mp_nodeid(int id);
  259. function fstarpu_worker_get_mp_nodeid(id) bind(C,name="starpu_worker_get_mp_nodeid")
  260. use iso_c_binding, only: c_int
  261. integer(c_int) :: fstarpu_worker_get_mp_nodeid
  262. integer(c_int), value, intent(in) :: id
  263. end function fstarpu_worker_get_mp_nodeid
  264. ! struct starpu_tree* starpu_workers_get_tree(void);
  265. ! unsigned starpu_worker_get_sched_ctx_list(int worker, unsigned **sched_ctx);
  266. ! unsigned starpu_worker_is_blocked(int workerid);
  267. function fstarpu_worker_is_blocked(id) bind(C,name="starpu_worker_is_blocked")
  268. use iso_c_binding, only: c_int
  269. integer(c_int) :: fstarpu_worker_is_blocked
  270. integer(c_int), value, intent(in) :: id
  271. end function fstarpu_worker_is_blocked
  272. ! unsigned starpu_worker_is_slave_somewhere(int workerid);
  273. function fstarpu_worker_is_slave_somewhere(id) bind(C,name="starpu_worker_is_slave_somewhere")
  274. use iso_c_binding, only: c_int
  275. integer(c_int) :: fstarpu_worker_is_slave_somewhere
  276. integer(c_int), value, intent(in) :: id
  277. end function fstarpu_worker_is_slave_somewhere
  278. ! char *starpu_worker_get_type_as_string(enum starpu_worker_archtype type);
  279. subroutine fstarpu_worker_get_type_as_string(typeid,dst,maxlen) bind(C)
  280. use iso_c_binding, only: c_ptr, c_char, c_size_t
  281. type(c_ptr),value,intent(in) :: typeid ! c_intptr_t expected by C func
  282. character(c_char),intent(out) :: dst(*)
  283. integer(c_size_t),value,intent(in) :: maxlen
  284. end subroutine fstarpu_worker_get_type_as_string
  285. ! int starpu_bindid_get_workerids(int bindid, int **workerids);
  286. ! == starpu_task.h ==
  287. ! starpu_tag_declare_deps
  288. ! starpu_tag_declare_deps_array
  289. ! starpu_task_declare_deps_array
  290. ! starpu_tag_wait
  291. ! starpu_tag_wait_array
  292. ! starpu_tag_notify_from_apps
  293. ! starpu_tag_restart
  294. ! starpu_tag_remove
  295. ! struct starpu_task *starpu_tag_get_task(starpu_tag_t id);
  296. ! void starpu_task_init(struct starpu_task *task);
  297. subroutine fstarpu_task_init (task) bind(C,name="starpu_task_init")
  298. use iso_c_binding, only: c_ptr
  299. type(c_ptr), value, intent(in) :: task
  300. end subroutine fstarpu_task_init
  301. ! void starpu_task_clean(struct starpu_task *task);
  302. subroutine fstarpu_task_clean (task) bind(C,name="starpu_task_clean")
  303. use iso_c_binding, only: c_ptr
  304. type(c_ptr), value, intent(in) :: task
  305. end subroutine fstarpu_task_clean
  306. ! struct starpu_task *starpu_task_create(void) STARPU_ATTRIBUTE_MALLOC;
  307. function fstarpu_task_create () bind(C,name="starpu_task_create")
  308. use iso_c_binding, only: c_ptr
  309. type(c_ptr) :: fstarpu_task_create
  310. end function fstarpu_task_create
  311. ! void starpu_task_destroy(struct starpu_task *task);
  312. subroutine fstarpu_task_destroy (task) bind(C,name="starpu_task_destroy")
  313. use iso_c_binding, only: c_ptr
  314. type(c_ptr), value, intent(in) :: task
  315. end subroutine fstarpu_task_destroy
  316. ! int starpu_task_submit(struct starpu_task *task) STARPU_WARN_UNUSED_RESULT;
  317. function fstarpu_task_submit (task) bind(C,name="starpu_task_submit")
  318. use iso_c_binding, only: c_int,c_ptr
  319. integer(c_int) :: fstarpu_task_submit
  320. type(c_ptr), value, intent(in) :: task
  321. end function fstarpu_task_submit
  322. ! int starpu_task_submit_to_ctx(struct starpu_task *task, unsigned sched_ctx_id);
  323. function fstarpu_task_submit_to_ctx (task,sched_ctx_id) bind(C,name="starpu_task_submit_to_ctx")
  324. use iso_c_binding, only: c_int,c_ptr
  325. integer(c_int) :: fstarpu_task_submit_to_ctx
  326. type(c_ptr), value, intent(in) :: task
  327. integer(c_int), value, intent(in) :: sched_ctx_id
  328. end function fstarpu_task_submit_to_ctx
  329. ! int starpu_task_finished(struct starpu_task *task) STARPU_WARN_UNUSED_RESULT;
  330. function fstarpu_task_finished (task) bind(C,name="starpu_task_finished")
  331. use iso_c_binding, only: c_int,c_ptr
  332. integer(c_int) :: fstarpu_task_finished
  333. type(c_ptr), value, intent(in) :: task
  334. end function fstarpu_task_finished
  335. ! int starpu_task_wait(struct starpu_task *task) STARPU_WARN_UNUSED_RESULT;
  336. function fstarpu_task_wait (task) bind(C,name="starpu_task_wait")
  337. use iso_c_binding, only: c_int,c_ptr
  338. integer(c_int) :: fstarpu_task_wait
  339. type(c_ptr), value, intent(in) :: task
  340. end function fstarpu_task_wait
  341. ! int starpu_task_wait_array(struct starpu_task **tasks, unsigned nb_tasks) STARPU_WARN_UNUSED_RESULT;
  342. ! int starpu_task_wait_for_all(void);
  343. subroutine fstarpu_task_wait_for_all () bind(C,name="starpu_task_wait_for_all")
  344. end subroutine fstarpu_task_wait_for_all
  345. ! int starpu_task_wait_for_n_submitted(unsigned n);
  346. subroutine fstarpu_task_wait_for_n_submitted (n) bind(C,name="starpu_task_wait_for_n_submitted")
  347. use iso_c_binding, only: c_int
  348. integer(c_int), value, intent(in) :: n
  349. end subroutine fstarpu_task_wait_for_n_submitted
  350. ! int starpu_task_wait_for_all_in_ctx(unsigned sched_ctx_id);
  351. subroutine fstarpu_task_wait_for_all_in_ctx (ctx) bind(C,name="starpu_task_wait_for_all_in_ctx")
  352. use iso_c_binding, only: c_int
  353. integer(c_int), value, intent(in) :: ctx
  354. end subroutine fstarpu_task_wait_for_all_in_ctx
  355. ! int starpu_task_wait_for_n_submitted_in_ctx(unsigned sched_ctx_id, unsigned n);
  356. subroutine fstarpu_task_wait_for_n_submitted_in_ctx (ctx,n) bind(C,name="starpu_task_wait_for_n_submitted_in_ctx")
  357. use iso_c_binding, only: c_int
  358. integer(c_int), value, intent(in) :: ctx
  359. integer(c_int), value, intent(in) :: n
  360. end subroutine fstarpu_task_wait_for_n_submitted_in_ctx
  361. ! int starpu_task_wait_for_no_ready(void);
  362. function fstarpu_task_wait_for_no_ready () bind(C,name="starpu_task_wait_for_no_ready")
  363. use iso_c_binding, only: c_int
  364. integer(c_int) :: fstarpu_task_wait_for_no_ready
  365. end function fstarpu_task_wait_for_no_ready
  366. ! int starpu_task_nready(void);
  367. function fstarpu_task_nready () bind(C,name="starpu_task_nready")
  368. use iso_c_binding, only: c_int
  369. integer(c_int) :: fstarpu_task_nready
  370. end function fstarpu_task_nready
  371. ! int starpu_task_nsubmitted(void);
  372. function fstarpu_task_nsubmitted () bind(C,name="starpu_task_nsubmitted")
  373. use iso_c_binding, only: c_int
  374. integer(c_int) :: fstarpu_task_nsubmitted
  375. end function fstarpu_task_nsubmitted
  376. ! void starpu_do_schedule(void);
  377. subroutine fstarpu_do_schedule () bind(C,name="starpu_do_schedule")
  378. end subroutine fstarpu_do_schedule
  379. ! starpu_codelet_init
  380. subroutine fstarpu_codelet_init (codelet) bind(C,name="starpu_codelet_init")
  381. use iso_c_binding, only: c_ptr
  382. type(c_ptr), value, intent(in) :: codelet
  383. end subroutine fstarpu_codelet_init
  384. ! starpu_codelet_display_stats
  385. subroutine fstarpu_codelet_display_stats (codelet) bind(C,name="starpu_codelet_display_stats")
  386. use iso_c_binding, only: c_ptr
  387. type(c_ptr), value, intent(in) :: codelet
  388. end subroutine fstarpu_codelet_display_stats
  389. ! struct starpu_task *starpu_task_get_current(void);
  390. function fstarpu_task_get_current () bind(C,name="starpu_task_get_current")
  391. use iso_c_binding, only: c_ptr
  392. type(c_ptr) :: fstarpu_task_get_current
  393. end function fstarpu_task_get_current
  394. ! starpu_parallel_task_barrier_init
  395. ! starpu_parallel_task_barrier_init_n
  396. ! struct starpu_task *starpu_task_dup(struct starpu_task *task);
  397. function fstarpu_task_dup (task) bind(C,name="starpu_task_dup")
  398. use iso_c_binding, only: c_ptr
  399. type(c_ptr) :: fstarpu_task_dup
  400. type(c_ptr), value, intent(in) :: task
  401. end function fstarpu_task_dup
  402. ! starpu_task_set_implementation
  403. ! starpu_task_get_implementation
  404. ! --
  405. function fstarpu_codelet_allocate () bind(C)
  406. use iso_c_binding, only: c_ptr
  407. type(c_ptr) :: fstarpu_codelet_allocate
  408. end function fstarpu_codelet_allocate
  409. subroutine fstarpu_codelet_free (cl) bind(C)
  410. use iso_c_binding, only: c_ptr
  411. type(c_ptr), value, intent(in) :: cl
  412. end subroutine fstarpu_codelet_free
  413. subroutine fstarpu_codelet_set_name (cl, cl_name) bind(C)
  414. use iso_c_binding, only: c_ptr, c_char
  415. type(c_ptr), value, intent(in) :: cl
  416. character(c_char), intent(in) :: cl_name
  417. end subroutine fstarpu_codelet_set_name
  418. subroutine fstarpu_codelet_add_cpu_func (cl, f_ptr) bind(C)
  419. use iso_c_binding, only: c_ptr, c_funptr
  420. type(c_ptr), value, intent(in) :: cl
  421. type(c_funptr), value, intent(in) :: f_ptr
  422. end subroutine fstarpu_codelet_add_cpu_func
  423. subroutine fstarpu_codelet_add_cuda_func (cl, f_ptr) bind(C)
  424. use iso_c_binding, only: c_ptr, c_funptr
  425. type(c_ptr), value, intent(in) :: cl
  426. type(c_funptr), value, intent(in) :: f_ptr
  427. end subroutine fstarpu_codelet_add_cuda_func
  428. subroutine fstarpu_codelet_add_opencl_func (cl, f_ptr) bind(C)
  429. use iso_c_binding, only: c_ptr, c_funptr
  430. type(c_ptr), value, intent(in) :: cl
  431. type(c_funptr), value, intent(in) :: f_ptr
  432. end subroutine fstarpu_codelet_add_opencl_func
  433. subroutine fstarpu_codelet_add_mic_func (cl, f_ptr) bind(C)
  434. use iso_c_binding, only: c_ptr, c_funptr
  435. type(c_ptr), value, intent(in) :: cl
  436. type(c_funptr), value, intent(in) :: f_ptr
  437. end subroutine fstarpu_codelet_add_mic_func
  438. subroutine fstarpu_codelet_add_scc_func (cl, f_ptr) bind(C)
  439. use iso_c_binding, only: c_ptr, c_funptr
  440. type(c_ptr), value, intent(in) :: cl
  441. type(c_funptr), value, intent(in) :: f_ptr
  442. end subroutine fstarpu_codelet_add_scc_func
  443. subroutine fstarpu_codelet_add_buffer (cl, mode) bind(C)
  444. use iso_c_binding, only: c_ptr
  445. type(c_ptr), value, intent(in) :: cl
  446. type(c_ptr), value, intent(in) :: mode ! C function expects an intptr_t
  447. end subroutine fstarpu_codelet_add_buffer
  448. ! == starpu_data_interface.h ==
  449. ! uintptr_t starpu_malloc_on_node_flags(unsigned dst_node, size_t size, int flags);
  450. ! uintptr_t starpu_malloc_on_node(unsigned dst_node, size_t size);
  451. function fstarpu_malloc_on_node(node,sz) bind(C,name="starpu_malloc_on_node")
  452. use iso_c_binding, only: c_int,c_intptr_t,c_size_t
  453. integer(c_intptr_t) :: fstarpu_malloc_on_node
  454. integer(c_int), value, intent(in) :: node
  455. integer(c_size_t), value, intent(in) :: sz
  456. end function fstarpu_malloc_on_node
  457. ! void starpu_free_on_node_flags(unsigned dst_node, uintptr_t addr, size_t size, int flags);
  458. ! void starpu_free_on_node(unsigned dst_node, uintptr_t addr, size_t size);
  459. subroutine fstarpu_free_on_node(node,addr,sz) bind(C,name="starpu_free_on_node")
  460. use iso_c_binding, only: c_int,c_intptr_t,c_size_t
  461. integer(c_int), value, intent(in) :: node
  462. integer(c_intptr_t), value, intent(in) :: addr
  463. integer(c_size_t), value, intent(in) :: sz
  464. end subroutine fstarpu_free_on_node
  465. ! void starpu_malloc_on_node_set_default_flags(unsigned node, int flags);
  466. ! int starpu_data_interface_get_next_id(void);
  467. ! void starpu_data_register(starpu_data_handle_t *handleptr, unsigned home_node, void *data_interface, struct starpu_data_interface_ops *ops);
  468. ! void starpu_data_ptr_register(starpu_data_handle_t handle, unsigned node);
  469. subroutine fstarpug_data_ptr_register (dh,node) bind(C,name="starpu_data_ptr_register")
  470. use iso_c_binding, only: c_ptr, c_int
  471. type(c_ptr), value, intent(in) :: dh
  472. integer(c_int), value, intent(in) :: node
  473. end subroutine fstarpug_data_ptr_register
  474. ! void starpu_data_register_same(starpu_data_handle_t *handledst, starpu_data_handle_t handlesrc);
  475. subroutine fstarpu_data_register_same (dh_dst,dh_src) bind(C,name="starpu_data_register_same")
  476. use iso_c_binding, only: c_ptr
  477. type(c_ptr), intent(out) :: dh_dst
  478. type(c_ptr), value, intent(in) :: dh_src
  479. end subroutine fstarpu_data_register_same
  480. ! void *starpu_data_handle_to_pointer(starpu_data_handle_t handle, unsigned node);
  481. function fstarpu_data_handle_to_pointer (dh,node) bind(C,name="starpu_data_handle_to_pointer")
  482. use iso_c_binding, only: c_ptr, c_int
  483. type(c_ptr) :: fstarpu_data_handle_to_pointer
  484. type(c_ptr), value, intent(in) :: dh
  485. integer(c_int), value, intent(in) :: node
  486. end function fstarpu_data_handle_to_pointer
  487. ! void *starpu_data_get_local_ptr(starpu_data_handle_t handle);
  488. function fstarpu_data_get_local_ptr (dh) bind(C,name="starpu_data_get_local_ptr")
  489. use iso_c_binding, only: c_ptr, c_int
  490. type(c_ptr) :: fstarpu_data_get_local_ptr
  491. type(c_ptr), value, intent(in) :: dh
  492. end function fstarpu_data_get_local_ptr
  493. ! void *starpu_data_get_interface_on_node(starpu_data_handle_t handle, unsigned memory_node);
  494. ! == starpu_data_interface.h: matrix ==
  495. ! starpu_matrix_data_register: see fstarpu_matrix_data_register
  496. function fstarpu_matrix_data_register(matrix, ldy, ny, nx, elt_size, ram) bind(C)
  497. use iso_c_binding, only: c_ptr, c_int, c_size_t
  498. type(c_ptr) :: fstarpu_matrix_data_register
  499. type(c_ptr), value, intent(in) :: matrix
  500. integer(c_int), value, intent(in) :: ldy
  501. integer(c_int), value, intent(in) :: ny
  502. integer(c_int), value, intent(in) :: nx
  503. integer(c_size_t), value, intent(in) :: elt_size
  504. integer(c_int), value, intent(in) :: ram
  505. end function fstarpu_matrix_data_register
  506. ! starpu_matrix_ptr_register
  507. function fstarpu_matrix_get_ptr(buffers, i) bind(C)
  508. use iso_c_binding, only: c_ptr, c_int
  509. type(c_ptr) :: fstarpu_matrix_get_ptr
  510. type(c_ptr), value, intent(in) :: buffers
  511. integer(c_int), value, intent(in) :: i
  512. end function fstarpu_matrix_get_ptr
  513. function fstarpu_matrix_get_ld(buffers, i) bind(C)
  514. use iso_c_binding, only: c_ptr, c_int
  515. integer(c_int) :: fstarpu_matrix_get_ld
  516. type(c_ptr), value, intent(in) :: buffers
  517. integer(c_int), value, intent(in) :: i
  518. end function fstarpu_matrix_get_ld
  519. function fstarpu_matrix_get_ny(buffers, i) bind(C)
  520. use iso_c_binding, only: c_ptr, c_int
  521. integer(c_int) :: fstarpu_matrix_get_ny
  522. type(c_ptr), value, intent(in) :: buffers
  523. integer(c_int), value, intent(in) :: i
  524. end function fstarpu_matrix_get_ny
  525. function fstarpu_matrix_get_nx(buffers, i) bind(C)
  526. use iso_c_binding, only: c_ptr, c_int
  527. integer(c_int) :: fstarpu_matrix_get_nx
  528. type(c_ptr), value, intent(in) :: buffers
  529. integer(c_int), value, intent(in) :: i
  530. end function fstarpu_matrix_get_nx
  531. ! == starpu_data_interface.h: vector ==
  532. ! starpu_vector_data_register: see fstarpu_vector_data_register
  533. function fstarpu_vector_data_register(vector, nx, elt_size, ram) bind(C)
  534. use iso_c_binding, only: c_ptr, c_int, c_size_t
  535. type(c_ptr) :: fstarpu_vector_data_register
  536. type(c_ptr), value, intent(in) :: vector
  537. integer(c_int), value, intent(in) :: nx
  538. integer(c_size_t), value, intent(in) :: elt_size
  539. integer(c_int), value, intent(in) :: ram
  540. end function fstarpu_vector_data_register
  541. ! starpu_vector_ptr_register
  542. function fstarpu_vector_get_ptr(buffers, i) bind(C)
  543. use iso_c_binding, only: c_ptr, c_int
  544. type(c_ptr) :: fstarpu_vector_get_ptr
  545. type(c_ptr), value, intent(in) :: buffers
  546. integer(c_int), value, intent(in) :: i
  547. end function fstarpu_vector_get_ptr
  548. function fstarpu_vector_get_nx(buffers, i) bind(C)
  549. use iso_c_binding, only: c_ptr, c_int
  550. integer(c_int) :: fstarpu_vector_get_nx
  551. type(c_ptr), value, intent(in) :: buffers
  552. integer(c_int), value, intent(in) :: i
  553. end function fstarpu_vector_get_nx
  554. ! == starpu_data_interface.h: variable ==
  555. ! starpu_variable_data_register: see fstarpu_variable_data_register
  556. function fstarpu_variable_data_register(ptr, sz, ram) bind(C)
  557. use iso_c_binding, only: c_ptr, c_int, c_size_t
  558. type(c_ptr) :: fstarpu_variable_data_register
  559. type(c_ptr), value, intent(in) :: ptr
  560. integer(c_size_t), value, intent(in) :: sz
  561. integer(c_int), value, intent(in) :: ram
  562. end function fstarpu_variable_data_register
  563. ! starpu_variable_ptr_register
  564. function fstarpu_variable_get_ptr(buffers, i) bind(C)
  565. use iso_c_binding, only: c_ptr, c_int
  566. type(c_ptr) :: fstarpu_variable_get_ptr
  567. type(c_ptr), value, intent(in) :: buffers
  568. integer(c_int), value, intent(in) :: i
  569. end function fstarpu_variable_get_ptr
  570. ! == starpu_data_interface.h: void ==
  571. ! starpu_void_data_register: see fstarpu_void_data_register
  572. function fstarpu_void_data_register() bind(C)
  573. use iso_c_binding, only: c_ptr
  574. type(c_ptr) :: fstarpu_void_data_register
  575. end function fstarpu_void_data_register
  576. ! == starpu_data.h ==
  577. ! void starpu_data_unregister(starpu_data_handle_t handle);
  578. subroutine fstarpu_data_unregister (dh) bind(C,name="starpu_data_unregister")
  579. use iso_c_binding, only: c_ptr
  580. type(c_ptr), value, intent(in) :: dh
  581. end subroutine fstarpu_data_unregister
  582. ! void starpu_data_unregister_no_coherency(starpu_data_handle_t handle);
  583. subroutine fstarpu_data_unregister_no_coherency (dh) bind(C,name="starpu_data_unregister_no_coherency")
  584. use iso_c_binding, only: c_ptr
  585. type(c_ptr), value, intent(in) :: dh
  586. end subroutine fstarpu_data_unregister_no_coherency
  587. ! void starpu_data_unregister_submit(starpu_data_handle_t handle);
  588. subroutine fstarpu_data_unregister_submit (dh) bind(C,name="starpu_data_unregister_submit")
  589. use iso_c_binding, only: c_ptr
  590. type(c_ptr), value, intent(in) :: dh
  591. end subroutine fstarpu_data_unregister_submit
  592. ! void starpu_data_invalidate(starpu_data_handle_t handle);
  593. subroutine fstarpu_data_invalidate (dh) bind(C,name="starpu_data_invalidate")
  594. use iso_c_binding, only: c_ptr
  595. type(c_ptr), value, intent(in) :: dh
  596. end subroutine fstarpu_data_invalidate
  597. ! void starpu_data_invalidate_submit(starpu_data_handle_t handle);
  598. subroutine fstarpu_data_invalidate_submit (dh) bind(C,name="starpu_data_invalidate_submit")
  599. use iso_c_binding, only: c_ptr
  600. type(c_ptr), value, intent(in) :: dh
  601. end subroutine fstarpu_data_invalidate_submit
  602. ! void starpu_data_advise_as_important(starpu_data_handle_t handle, unsigned is_important);
  603. subroutine fstarpu_data_advise_as_important (dh,is_important) bind(C,name="starpu_data_advise_as_important")
  604. use iso_c_binding, only: c_ptr,c_int
  605. type(c_ptr), value, intent(in) :: dh
  606. integer(c_int), value, intent(in) :: is_important
  607. end subroutine fstarpu_data_advise_as_important
  608. ! starpu_data_acquire: see fstarpu_data_acquire
  609. subroutine fstarpu_data_acquire (dh, mode) bind(C)
  610. use iso_c_binding, only: c_ptr
  611. type(c_ptr), value, intent(in) :: dh
  612. type(c_ptr), value, intent(in) :: mode ! C function expects an intptr_t
  613. end subroutine fstarpu_data_acquire
  614. ! int starpu_data_acquire_on_node(starpu_data_handle_t handle, int node, enum starpu_data_access_mode mode);
  615. ! int starpu_data_acquire_cb(starpu_data_handle_t handle, enum starpu_data_access_mode mode, void (*callback)(void *), void *arg);
  616. ! 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);
  617. ! 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);
  618. ! 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);
  619. ! void starpu_data_release(starpu_data_handle_t handle);
  620. subroutine fstarpu_data_release (dh) bind(C,name="starpu_data_release")
  621. use iso_c_binding, only: c_ptr
  622. type(c_ptr), value, intent(in) :: dh
  623. end subroutine fstarpu_data_release
  624. ! void starpu_data_release_on_node(starpu_data_handle_t handle, int node);
  625. subroutine fstarpu_data_release_on_node (dh, node) bind(C,name="starpu_data_release_on_node")
  626. use iso_c_binding, only: c_ptr, c_int
  627. type(c_ptr), value, intent(in) :: dh
  628. integer(c_int), value, intent(in) :: node
  629. end subroutine fstarpu_data_release_on_node
  630. ! void starpu_data_assign_arbiter(starpu_data_handle_t handle, starpu_arbiter_t arbiter);
  631. ! void starpu_arbiter_destroy(starpu_arbiter_t arbiter);
  632. ! void starpu_data_display_memory_stats();
  633. subroutine fstarpu_display_memory_stats() bind(C,name="starpu_display_memory_stats")
  634. end subroutine fstarpu_display_memory_stats
  635. ! int starpu_data_request_allocation(starpu_data_handle_t handle, unsigned node);
  636. subroutine fstarpu_data_request_allocation (dh, node) &
  637. bind(C,name="starpu_data_request_allocation")
  638. use iso_c_binding, only: c_ptr, c_int
  639. type(c_ptr), value, intent(in) :: dh
  640. integer(c_int), value, intent(in) :: node
  641. end subroutine fstarpu_data_request_allocation
  642. ! int starpu_data_fetch_on_node(starpu_data_handle_t handle, unsigned node, unsigned async);
  643. subroutine fstarpu_data_fetch_on_node (dh, node, async) &
  644. bind(C,name="starpu_data_fetch_on_node")
  645. use iso_c_binding, only: c_ptr, c_int
  646. type(c_ptr), value, intent(in) :: dh
  647. integer(c_int), value, intent(in) :: node
  648. integer(c_int), value, intent(in) :: async
  649. end subroutine fstarpu_data_fetch_on_node
  650. ! int starpu_data_prefetch_on_node(starpu_data_handle_t handle, unsigned node, unsigned async);
  651. subroutine fstarpu_data_prefetch_on_node (dh, node, async) &
  652. bind(C,name="starpu_data_prefetch_on_node")
  653. use iso_c_binding, only: c_ptr, c_int
  654. type(c_ptr), value, intent(in) :: dh
  655. integer(c_int), value, intent(in) :: node
  656. integer(c_int), value, intent(in) :: async
  657. end subroutine fstarpu_data_prefetch_on_node
  658. ! int starpu_data_prefetch_on_node_prio(starpu_data_handle_t handle, unsigned node, unsigned async, int prio);
  659. subroutine fstarpu_data_prefetch_on_node_prio (dh, node, async, prio) &
  660. bind(C,name="starpu_data_prefetch_on_node_prio")
  661. use iso_c_binding, only: c_ptr, c_int
  662. type(c_ptr), value, intent(in) :: dh
  663. integer(c_int), value, intent(in) :: node
  664. integer(c_int), value, intent(in) :: async
  665. integer(c_int), value, intent(in) :: prio
  666. end subroutine fstarpu_data_prefetch_on_node_prio
  667. ! int starpu_data_idle_prefetch_on_node(starpu_data_handle_t handle, unsigned node, unsigned async);
  668. subroutine fstarpu_data_idle_prefetch_on_node (dh, node, async) &
  669. bind(C,name="starpu_data_idle_prefetch_on_node")
  670. use iso_c_binding, only: c_ptr, c_int
  671. type(c_ptr), value, intent(in) :: dh
  672. integer(c_int), value, intent(in) :: node
  673. integer(c_int), value, intent(in) :: async
  674. end subroutine fstarpu_data_idle_prefetch_on_node
  675. ! int starpu_data_idle_prefetch_on_node_prio(starpu_data_handle_t handle, unsigned node, unsigned async, int prio);
  676. subroutine fstarpu_data_idle_prefetch_on_node_prio (dh, node, async, prio) &
  677. bind(C,name="starpu_data_idle_prefetch_on_node_prio")
  678. use iso_c_binding, only: c_ptr, c_int
  679. type(c_ptr), value, intent(in) :: dh
  680. integer(c_int), value, intent(in) :: node
  681. integer(c_int), value, intent(in) :: async
  682. integer(c_int), value, intent(in) :: prio
  683. end subroutine fstarpu_data_idle_prefetch_on_node_prio
  684. ! void starpu_data_wont_use(starpu_data_handle_t handle);
  685. subroutine fstarpu_data_wont_use (dh) bind(c,name="starpu_data_wont_use")
  686. use iso_c_binding, only: c_ptr
  687. type(c_ptr), value, intent(in) :: dh
  688. end subroutine fstarpu_data_wont_use
  689. ! unsigned starpu_worker_get_memory_node(unsigned workerid);
  690. function fstarpu_worker_get_memory_node(id) bind(C,name="starpu_worker_get_memory_node")
  691. use iso_c_binding, only: c_int
  692. integer(c_int) :: fstarpu_worker_get_memory_node
  693. integer(c_int), value, intent(in) :: id
  694. end function fstarpu_worker_get_memory_node
  695. ! unsigned starpu_memory_nodes_get_count(void);
  696. function fstarpu_memory_nodes_get_count() bind(C,name="starpu_memory_nodes_get_count")
  697. use iso_c_binding, only: c_int
  698. integer(c_int) :: fstarpu_memory_nodes_get_count
  699. end function fstarpu_memory_nodes_get_count
  700. ! enum starpu_node_kind starpu_node_get_kind(unsigned node);
  701. ! void starpu_data_set_wt_mask(starpu_data_handle_t handle, uint32_t wt_mask);
  702. ! void starpu_data_set_sequential_consistency_flag(starpu_data_handle_t handle, unsigned flag);
  703. ! unsigned starpu_data_get_sequential_consistency_flag(starpu_data_handle_t handle);
  704. ! unsigned starpu_data_get_default_sequential_consistency_flag(void);
  705. ! void starpu_data_set_default_sequential_consistency_flag(unsigned flag);
  706. ! void starpu_data_query_status(starpu_data_handle_t handle, int memory_node, int *is_allocated, int *is_valid, int *is_requested);
  707. ! void starpu_data_set_reduction_methods(starpu_data_handle_t handle, struct starpu_codelet *redux_cl, struct starpu_codelet *init_cl);
  708. subroutine fstarpu_data_set_reduction_methods (dh,redux_cl,init_cl) bind(C,name="starpu_data_set_reduction_methods")
  709. use iso_c_binding, only: c_ptr
  710. type(c_ptr), value, intent(in) :: dh
  711. type(c_ptr), value, intent(in) :: redux_cl
  712. type(c_ptr), value, intent(in) :: init_cl
  713. end subroutine fstarpu_data_set_reduction_methods
  714. ! struct starpu_data_interface_ops* starpu_data_get_interface_ops(starpu_data_handle_t handle);
  715. ! unsigned starpu_data_test_if_allocated_on_node(starpu_data_handle_t handle, unsigned memory_node);
  716. function fstarpu_data_test_if_allocated_on_node(dh,mem_node) bind(C,name="starpu_data_test_if_allocated_on_node")
  717. use iso_c_binding, only: c_ptr, c_int
  718. integer(c_int) :: fstarpu_data_test_if_allocated_on_node
  719. type(c_ptr), value, intent(in) :: dh
  720. integer(c_int), value, intent(in) :: mem_node
  721. end function fstarpu_data_test_if_allocated_on_node
  722. ! void starpu_memchunk_tidy(unsigned memory_node);
  723. subroutine fstarpu_memchunk_tidy (mem_node) bind(c,name="starpu_memchunk_tidy")
  724. use iso_c_binding, only: c_int
  725. integer(c_int), value, intent(in) :: mem_node
  726. end subroutine fstarpu_memchunk_tidy
  727. ! == starpu_task_util.h ==
  728. subroutine fstarpu_insert_task(arglist) bind(C)
  729. use iso_c_binding, only: c_ptr
  730. type(c_ptr), dimension(:), intent(in) :: arglist
  731. end subroutine fstarpu_insert_task
  732. subroutine fstarpu_unpack_arg(cl_arg,bufferlist) bind(C)
  733. use iso_c_binding, only: c_ptr
  734. type(c_ptr), value, intent(in) :: cl_arg
  735. type(c_ptr), dimension(:), intent(in) :: bufferlist
  736. end subroutine fstarpu_unpack_arg
  737. ! == starpu_sched_ctx.h ==
  738. ! starpu_sched_ctx_create: see fstarpu_sched_ctx_create
  739. function fstarpu_sched_ctx_create(workers_array,nworkers,ctx_name) bind(C)
  740. use iso_c_binding, only: c_int, c_char
  741. integer(c_int) :: fstarpu_sched_ctx_create
  742. integer(c_int), intent(in) :: workers_array(*)
  743. integer(c_int), value, intent(in) :: nworkers
  744. character(c_char), intent(in) :: ctx_name
  745. end function fstarpu_sched_ctx_create
  746. ! 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);
  747. ! void starpu_sched_ctx_register_close_callback(unsigned sched_ctx_id, void (*close_callback)(unsigned sched_ctx_id, void* args), void *args);
  748. ! void starpu_sched_ctx_add_workers(int *workerids_ctx, int nworkers_ctx, unsigned sched_ctx_id);
  749. ! void starpu_sched_ctx_remove_workers(int *workerids_ctx, int nworkers_ctx, unsigned sched_ctx_id);
  750. ! starpu_sched_ctx_display_workers: see fstarpu_sched_ctx_display_workers
  751. subroutine fstarpu_sched_ctx_display_workers (ctx) bind(C)
  752. use iso_c_binding, only: c_int
  753. integer(c_int), value, intent(in) :: ctx
  754. end subroutine fstarpu_sched_ctx_display_workers
  755. ! void starpu_sched_ctx_delete(unsigned sched_ctx_id);
  756. subroutine fstarpu_sched_ctx_delete (ctx) bind(C,name="starpu_sched_ctx_delete")
  757. use iso_c_binding, only: c_int
  758. integer(c_int), value, intent(in) :: ctx
  759. end subroutine fstarpu_sched_ctx_delete
  760. ! void starpu_sched_ctx_set_inheritor(unsigned sched_ctx_id, unsigned inheritor);
  761. ! unsigned starpu_sched_ctx_get_inheritor(unsigned sched_ctx_id);
  762. ! unsigned starpu_sched_ctx_get_hierarchy_level(unsigned sched_ctx_id);
  763. ! void starpu_sched_ctx_set_context(unsigned *sched_ctx_id);
  764. subroutine fstarpu_sched_ctx_set_context (ctx_ptr) bind(C,name="starpu_sched_ctx_set_context")
  765. use iso_c_binding, only: c_ptr
  766. type(c_ptr), value, intent(in) :: ctx_ptr
  767. end subroutine fstarpu_sched_ctx_set_context
  768. ! unsigned starpu_sched_ctx_get_context(void);
  769. function fstarpu_sched_ctx_get_context () bind(C,name="starpu_sched_ctx_get_context")
  770. use iso_c_binding, only: c_int
  771. integer(c_int) :: fstarpu_sched_ctx_get_context
  772. end function fstarpu_sched_ctx_get_context
  773. ! == starpu_fxt.h ==
  774. ! void starpu_fxt_options_init(struct starpu_fxt_options *options);
  775. ! void starpu_fxt_generate_trace(struct starpu_fxt_options *options);
  776. ! void starpu_fxt_autostart_profiling(int autostart);
  777. subroutine fstarpu_fxt_autostart_profiling (autostart) bind(c,name="starpu_fxt_autostart_profiling")
  778. use iso_c_binding, only: c_int
  779. integer(c_int), value, intent(in) :: autostart
  780. end subroutine fstarpu_fxt_autostart_profiling
  781. ! void starpu_fxt_start_profiling(void);
  782. subroutine fstarpu_fxt_start_profiling () bind(c,name="starpu_fxt_start_profiling")
  783. use iso_c_binding
  784. end subroutine fstarpu_fxt_start_profiling
  785. ! void starpu_fxt_stop_profiling(void);
  786. subroutine fstarpu_fxt_stop_profiling () bind(c,name="starpu_fxt_stop_profiling")
  787. use iso_c_binding
  788. end subroutine fstarpu_fxt_stop_profiling
  789. ! void starpu_fxt_write_data_trace(char *filename_in);
  790. subroutine fstarpu_fxt_write_data_trace (filename) bind(c,name="starpu_fxt_write_data_trace")
  791. use iso_c_binding, only: c_char
  792. character(c_char), intent(in) :: filename
  793. end subroutine fstarpu_fxt_write_data_trace
  794. ! void starpu_fxt_trace_user_event(unsigned long code);
  795. subroutine fstarpu_trace_user_event (code) bind(c,name="starpu_trace_user_event")
  796. use iso_c_binding, only: c_long
  797. integer(c_long), value, intent(in) :: code
  798. end subroutine fstarpu_trace_user_event
  799. end interface
  800. contains
  801. function or_cptrs(op1,op2)
  802. type(c_ptr) :: or_cptrs
  803. type(c_ptr),intent(in) :: op1,op2
  804. integer(c_intptr_t) :: i_op1,i_op2
  805. i_op1 = transfer(op1,0_c_intptr_t)
  806. i_op2 = transfer(op2,0_c_intptr_t)
  807. or_cptrs = transfer(ior(i_op1,i_op2), C_NULL_PTR)
  808. end function
  809. function ip_to_p(i) bind(C)
  810. use iso_c_binding, only: c_ptr,c_intptr_t,C_NULL_PTR
  811. type(c_ptr) :: ip_to_p
  812. integer(c_intptr_t), value, intent(in) :: i
  813. ip_to_p = transfer(i,C_NULL_PTR)
  814. end function ip_to_p
  815. function sz_to_p(sz) bind(C)
  816. use iso_c_binding, only: c_ptr,c_size_t,c_intptr_t
  817. type(c_ptr) :: sz_to_p
  818. integer(c_size_t), value, intent(in) :: sz
  819. sz_to_p = ip_to_p(int(sz,kind=c_intptr_t))
  820. end function sz_to_p
  821. function fstarpu_init (conf) bind(C)
  822. use iso_c_binding
  823. integer(c_int) :: fstarpu_init
  824. type(c_ptr), value, intent(in) :: conf
  825. integer(4) :: FSTARPU_SZ_INT4_dummy
  826. integer(8) :: FSTARPU_SZ_INT8_dummy
  827. real(4) :: FSTARPU_SZ_REAL4_dummy
  828. real(8) :: FSTARPU_SZ_REAL8_dummy
  829. ! Note: Referencing global C constants from Fortran has
  830. ! been found unreliable on some architectures, notably
  831. ! on Darwin. The get_integer/get_pointer_constant
  832. ! scheme is a workaround to that issue.
  833. interface
  834. ! These functions are not exported to the end user
  835. function fstarpu_get_constant(s) bind(C)
  836. use iso_c_binding, only: c_ptr,c_char
  837. type(c_ptr) :: fstarpu_get_constant ! C function returns an intptr_t
  838. character(kind=c_char) :: s
  839. end function fstarpu_get_constant
  840. function fstarpu_init_internal (conf) bind(C,name="starpu_init")
  841. use iso_c_binding, only: c_ptr,c_int
  842. integer(c_int) :: fstarpu_init_internal
  843. type(c_ptr), value :: conf
  844. end function fstarpu_init_internal
  845. end interface
  846. ! Initialize Fortran constants from C peers
  847. FSTARPU_R = fstarpu_get_constant(C_CHAR_"FSTARPU_R"//C_NULL_CHAR)
  848. FSTARPU_W = fstarpu_get_constant(C_CHAR_"FSTARPU_W"//C_NULL_CHAR)
  849. FSTARPU_RW = fstarpu_get_constant(C_CHAR_"FSTARPU_RW"//C_NULL_CHAR)
  850. FSTARPU_SCRATCH = fstarpu_get_constant(C_CHAR_"FSTARPU_SCRATCH"//C_NULL_CHAR)
  851. FSTARPU_REDUX = fstarpu_get_constant(C_CHAR_"FSTARPU_REDUX"//C_NULL_CHAR)
  852. FSTARPU_COMMUTE = fstarpu_get_constant(C_CHAR_"FSTARPU_COMMUTE"//C_NULL_CHAR)
  853. FSTARPU_SSEND = fstarpu_get_constant(C_CHAR_"FSTARPU_SSEND"//C_NULL_CHAR)
  854. FSTARPU_LOCALITY = fstarpu_get_constant(C_CHAR_"FSTARPU_LOCALITY"//C_NULL_CHAR)
  855. FSTARPU_VALUE = fstarpu_get_constant(C_CHAR_"FSTARPU_VALUE"//C_NULL_CHAR)
  856. FSTARPU_SCHED_CTX = fstarpu_get_constant(C_CHAR_"FSTARPU_SCHED_CTX"//C_NULL_CHAR)
  857. FSTARPU_CPU_WORKER = fstarpu_get_constant(C_CHAR_"FSTARPU_CPU_WORKER"//C_NULL_CHAR)
  858. FSTARPU_CUDA_WORKER = fstarpu_get_constant(C_CHAR_"FSTARPU_CUDA_WORKER"//C_NULL_CHAR)
  859. FSTARPU_OPENCL_WORKER = fstarpu_get_constant(C_CHAR_"FSTARPU_OPENCL_WORKER"//C_NULL_CHAR)
  860. FSTARPU_MIC_WORKER = fstarpu_get_constant(C_CHAR_"FSTARPU_MIC_WORKER"//C_NULL_CHAR)
  861. FSTARPU_SCC_WORKER = fstarpu_get_constant(C_CHAR_"FSTARPU_SCC_WORKER"//C_NULL_CHAR)
  862. FSTARPU_ANY_WORKER = fstarpu_get_constant(C_CHAR_"FSTARPU_ANY_WORKER"//C_NULL_CHAR)
  863. ! Initialize size constants as 'c_ptr'
  864. FSTARPU_SZ_INT4 = sz_to_p(c_sizeof(FSTARPU_SZ_INT4_dummy))
  865. FSTARPU_SZ_INT8 = sz_to_p(c_sizeof(FSTARPU_SZ_INT8_dummy))
  866. FSTARPU_SZ_REAL4 = sz_to_p(c_sizeof(FSTARPU_SZ_REAL4_dummy))
  867. FSTARPU_SZ_REAL8 = sz_to_p(c_sizeof(FSTARPU_SZ_REAL8_dummy))
  868. ! Initialize StarPU
  869. if (c_associated(conf)) then
  870. fstarpu_init = fstarpu_init_internal(conf)
  871. else
  872. fstarpu_init = fstarpu_init_internal(C_NULL_PTR)
  873. end if
  874. end function fstarpu_init
  875. function fstarpu_csizet_to_cptr(i) bind(C)
  876. use iso_c_binding
  877. type(c_ptr) :: fstarpu_csizet_to_cptr
  878. integer(c_size_t) :: i
  879. fstarpu_csizet_to_cptr = transfer(int(i,kind=c_intptr_t),C_NULL_PTR)
  880. end function fstarpu_csizet_to_cptr
  881. function fstarpu_int_to_cptr(i) bind(C)
  882. use iso_c_binding
  883. type(c_ptr) :: fstarpu_int_to_cptr
  884. integer :: i
  885. fstarpu_int_to_cptr = transfer(int(i,kind=c_intptr_t),C_NULL_PTR)
  886. end function fstarpu_int_to_cptr
  887. end module fstarpu_mod