Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Removed timers and rearranged some calls to improve speed
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Apr 26, 2023
1 parent 012e05c commit 9b2c7d7
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 32 deletions.
3 changes: 1 addition & 2 deletions src/swiftest/swiftest_coarray.f90
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ module subroutine swiftest_coarray_balance_system(nbody_system, param)
class(swiftest_nbody_system), intent(inout) :: nbody_system !! Swiftest nbody system
class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters
! Internals
integer(I4B), codimension[:], allocatable :: ntp
integer(I4B), codimension[*], save :: ntp
integer(I4B) :: img,ntp_min, ntp_max

allocate(ntp[*])
ntp = nbody_system%tp%nbody
sync all
ntp_min = huge(1)
Expand Down
18 changes: 0 additions & 18 deletions src/swiftest/swiftest_driver.f90
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ program swiftest_driver
integer(I4B) :: nout !! Current output step
integer(I4B) :: istep !! Current value of istep (used for time stretching)
type(walltimer) :: integration_timer !! Object used for computing elapsed wall time
type(walltimer) :: t1, t2, t3, t4

call swiftest_io_get_args(integrator, param_file_name, display_style)

Expand Down Expand Up @@ -133,9 +132,7 @@ program swiftest_driver
nbody_system%t = t0 + iloop * dt

!> Evaluate any discards or collisional outcomes
call t1%start()
call nbody_system%discard(param)
call t1%stop()

!> If the loop counter is at the output cadence value, append the data file with a single frame
if (istep_out > 0) then
Expand All @@ -148,17 +145,11 @@ program swiftest_driver
istep = floor(istep_out * fstep_out**nout, kind=I4B)
end if

call t2%start()
call system_history%take_snapshot(param,nbody_system)
call t2%stop()

if (idump == dump_cadence) then
idump = 0
call t3%start()
call nbody_system%dump(param, system_history)
call t3%stop()
call t3%report(message="Dump", unit=display_unit)
call t3%reset()
end if
#ifdef COARRAY
if (this_image() == 1 .or. param%log_output) then
Expand All @@ -175,16 +166,7 @@ program swiftest_driver
if (param%lenergy) call nbody_system%conservation_report(param, lterminal=.true.)
#ifdef COARRAY
end if ! (this_image() == 1)
call t4%start()
if (param%lcoarray) call nbody_system%coarray_balance(param)
call t4%stop()

call t1%report(message="Discard", unit=display_unit)
call t2%report(message="Snapshot", unit=display_unit)
call t4%report(message="Balance", unit=display_unit)
call t1%reset()
call t2%reset()
call t4%reset()
#endif
end if
end if
Expand Down
13 changes: 1 addition & 12 deletions src/swiftest/swiftest_io.f90
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,6 @@ module subroutine swiftest_io_display_run_information(self, param, integration_t
! The following will syncronize the images so that they report in order, and only write to file one at at ime


#ifdef COARRAY
! The following line lets us read in the input files one image at a time
if (param%lcoarray .and. (this_image() /= 1)) sync images(this_image() - 1)
#endif
phase_val = 1
if (present(phase)) then
if (phase == "first") then
Expand Down Expand Up @@ -322,12 +318,6 @@ module subroutine swiftest_io_display_run_information(self, param, integration_t
#ifdef COARRAY
end if ! this_image() == num_images()
if (param%log_output) flush(param%display_unit)

! Allow the other images to report
if (param%lcoarray .and. (this_image() < num_images())) sync images(this_image() + 1)

! Wait for everyone to catch up
sync all
#endif

return
Expand Down Expand Up @@ -427,15 +417,14 @@ module subroutine swiftest_io_dump_storage(self, param)
#ifdef COARRAY
integer(I4B) :: img, tslot
integer(I4B), dimension(self%iframe) :: ntp_tot
integer(I4B), codimension[:], allocatable :: ntp
integer(I4B), codimension[*], save :: ntp
#endif

if (self%iframe == 0) return
call self%make_index_map()
associate(nc => self%nc)
#ifdef COARRAY
! Get the sum of all test particles across snapshots from all images
allocate(ntp[*])
ntp_tot(:) = 0
do i = 1, self%iframe
if (allocated(self%frame(i)%item)) then
Expand Down

0 comments on commit 9b2c7d7

Please sign in to comment.