nbody_generated.jl 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. # StarPU --- Runtime system for heterogeneous multicore architectures.
  2. #
  3. # Copyright (C) 2020 Université de Bordeaux, CNRS (LaBRI UMR 5800), 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. #
  16. if length(ARGS) != 6
  17. println("Usage: julia nbody_generated.jl start_nbr step_nbr stop_nbr nbr_simulations nbr_slices nbr_tests")
  18. quit()
  19. end
  20. if parse(Int64, ARGS[1]) % parse(Int64, ARGS[5]) != 0
  21. println("The number of slices must divide the number of planets.")
  22. quit()
  23. end
  24. include("../../src/Wrapper/Julia/starpu_include.jl")
  25. using StarPU
  26. @debugprint "starpu_init"
  27. starpu_init(extern_task_path = "../build/generated_tasks_nbody.so")
  28. perfmodel = StarpuPerfmodel(
  29. perf_type = STARPU_HISTORY_BASED,
  30. symbol = "history_perf"
  31. )
  32. # Normal starpu codelets
  33. claccst = StarpuCodelet(
  34. cpu_func = "nbody_acc",
  35. gpu_func = "CUDA_nbody_acc",
  36. modes = [STARPU_R, STARPU_RW, STARPU_R, STARPU_R, STARPU_R],
  37. perfmodel = perfmodel
  38. )
  39. clupdtst = StarpuCodelet(
  40. cpu_func = "nbody_updt",
  41. gpu_func = "CUDA_nbody_updt",
  42. modes = [STARPU_RW, STARPU_RW, STARPU_R, STARPU_R],
  43. perfmodel = perfmodel
  44. )
  45. # CPU_only codelets
  46. clacccpu = StarpuCodelet(
  47. cpu_func = "nbody_acc",
  48. modes = [STARPU_R, STARPU_RW, STARPU_R, STARPU_R, STARPU_R],
  49. perfmodel = perfmodel
  50. )
  51. clupdtcpu = StarpuCodelet(
  52. cpu_func = "nbody_updt",
  53. modes = [STARPU_RW, STARPU_RW, STARPU_R,STARPU_R],
  54. perfmodel = perfmodel
  55. )
  56. # GPU_only codelets
  57. claccgpu = StarpuCodelet(
  58. gpu_func = "CUDA_nbody_acc",
  59. modes = [STARPU_R, STARPU_RW, STARPU_R, STARPU_R, STARPU_R],
  60. perfmodel = perfmodel
  61. )
  62. clupdtgpu = StarpuCodelet(
  63. gpu_func = "CUDA_nbody_updt",
  64. modes = [STARPU_RW, STARPU_RW, STARPU_R,STARPU_R],
  65. perfmodel = perfmodel
  66. )
  67. include("nbody_def.jl")
  68. display_times(map((x -> parse(Int64, x)), ARGS)...)
  69. @debugprint "starpu_shutdown"
  70. starpu_shutdown()