nf_sched_ctx_cl.f90 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. ! StarPU --- Runtime system for heterogeneous multicore architectures.
  2. !
  3. ! Copyright (C) 2017 CNRS
  4. ! Copyright (C) 2016 Inria
  5. !
  6. ! StarPU is free software; you can redistribute it and/or modify
  7. ! it under the terms of the GNU Lesser General Public License as published by
  8. ! the Free Software Foundation; either version 2.1 of the License, or (at
  9. ! your option) any later version.
  10. !
  11. ! StarPU is distributed in the hope that it will be useful, but
  12. ! WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. !
  15. ! See the GNU Lesser General Public License in COPYING.LGPL for more details.
  16. !
  17. module nf_sched_ctx_cl
  18. contains
  19. recursive subroutine cl_cpu_func_sched_ctx (buffers, cl_args) bind(C)
  20. use iso_c_binding ! C interfacing module
  21. use fstarpu_mod ! StarPU interfacing module
  22. implicit none
  23. interface
  24. function sleep(s) bind(C)
  25. use iso_c_binding
  26. integer(c_int) :: sleep
  27. integer(c_int), value, intent(in) :: s
  28. end function
  29. end interface
  30. type(c_ptr), value, intent(in) :: buffers, cl_args ! cl_args is unused
  31. integer(c_int),target :: id
  32. integer(c_int) :: worker_id
  33. integer(c_int) :: ret
  34. call fstarpu_unpack_arg(cl_args,(/ c_loc(id) /))
  35. ! ret = sleep(1)
  36. worker_id = fstarpu_worker_get_id()
  37. write(*,*) "task:", id, ", worker_id:", worker_id
  38. end subroutine cl_cpu_func_sched_ctx
  39. end module nf_sched_ctx_cl