nbody_generated.jl 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. if length(ARGS) != 6
  2. println("Usage: julia nbody_generated.jl start_nbr step_nbr stop_nbr nbr_simulations nbr_slices nbr_tests")
  3. quit()
  4. end
  5. if parse(Int64, ARGS[1]) % parse(Int64, ARGS[5]) != 0
  6. println("The number of slices must divide the number of planets.")
  7. quit()
  8. end
  9. include("../../src/Wrapper/Julia/starpu_include.jl")
  10. using StarPU
  11. @debugprint "starpu_init"
  12. starpu_init(extern_task_path = "../build/generated_tasks_nbody.so")
  13. perfmodel = StarpuPerfmodel(
  14. perf_type = STARPU_HISTORY_BASED,
  15. symbol = "history_perf"
  16. )
  17. # Normal starpu codelets
  18. claccst = StarpuCodelet(
  19. cpu_func = "nbody_acc",
  20. gpu_func = "CUDA_nbody_acc",
  21. modes = [STARPU_R, STARPU_RW, STARPU_R, STARPU_R, STARPU_R],
  22. perfmodel = perfmodel
  23. )
  24. clupdtst = StarpuCodelet(
  25. cpu_func = "nbody_updt",
  26. gpu_func = "CUDA_nbody_updt",
  27. modes = [STARPU_RW, STARPU_RW, STARPU_R, STARPU_R],
  28. perfmodel = perfmodel
  29. )
  30. # CPU_only codelets
  31. clacccpu = StarpuCodelet(
  32. cpu_func = "nbody_acc",
  33. modes = [STARPU_R, STARPU_RW, STARPU_R, STARPU_R, STARPU_R],
  34. perfmodel = perfmodel
  35. )
  36. clupdtcpu = StarpuCodelet(
  37. cpu_func = "nbody_updt",
  38. modes = [STARPU_RW, STARPU_RW, STARPU_R,STARPU_R],
  39. perfmodel = perfmodel
  40. )
  41. # GPU_only codelets
  42. claccgpu = StarpuCodelet(
  43. gpu_func = "CUDA_nbody_acc",
  44. modes = [STARPU_R, STARPU_RW, STARPU_R, STARPU_R, STARPU_R],
  45. perfmodel = perfmodel
  46. )
  47. clupdtgpu = StarpuCodelet(
  48. gpu_func = "CUDA_nbody_updt",
  49. modes = [STARPU_RW, STARPU_RW, STARPU_R,STARPU_R],
  50. perfmodel = perfmodel
  51. )
  52. include("nbody_def.jl")
  53. display_times(map((x -> parse(Int64, x)), ARGS)...)
  54. @debugprint "starpu_shutdown"
  55. starpu_shutdown()