-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.f90
36 lines (28 loc) · 1.03 KB
/
main.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
! =========================================================
! port of N-BodyMethods/Nbody of DPC++ Intel oneAPI sample
! code to Fortran
! The code performs N-body gravity simulation with a
! specified large number of particles
! attempt to use OpenMP directives to offload to Intel GPUs
! =========================================================
program Nbody
! two arguments are used for user-specified input
! first argument sets the number of particles and
! the second argument sets the number of steps
use simulation, only: GSimulation
character(10) :: n_arg, nstep_arg
integer :: n, nstep
type(GSimulation) :: sim
call sim%Init()
if (command_argument_count() > 0) then
call get_command_argument(1, n_arg)
read (n_arg, *) n
call sim%SetNumberofParticles(n)
end if
if (command_argument_count() > 1) then
call get_command_argument(2, nstep_arg)
read (nstep_arg, *) nstep
call sim%SetNumberOfSteps(nstep)
end if
call sim%Start()
end program