starpu_init_shutdown.jl 805 B

123456789101112131415161718192021222324252627282930313233343536
  1. export starpu_init
  2. """
  3. Must be called before any other starpu function. Field extern_task_path is the
  4. shared library path which will be used to find StarpuCodelet
  5. cpu and gpu function names
  6. """
  7. function starpu_init(; extern_task_path = "")
  8. if (!isempty(extern_task_path))
  9. global starpu_tasks_library_handle = Libdl.dlopen(extern_task_path)
  10. else
  11. global starpu_tasks_library_handle = Libdl.dlopen("libjlstarpu_c_wrapper.so")
  12. end
  13. output = @starpucall jlstarpu_init Cint ()
  14. starpu_enter_new_block()
  15. return output
  16. end
  17. export starpu_shutdown
  18. """
  19. Must be called at the end of the program
  20. """
  21. function starpu_shutdown()
  22. starpu_exit_block()
  23. @starpucall starpu_shutdown Void ()
  24. jlstarpu_free_allocated_structures()
  25. return nothing
  26. end