From 9b2c7d73de1771b3978a10a572a921ea0a23bfa5 Mon Sep 17 00:00:00 2001 From: David A Minton Date: Tue, 25 Apr 2023 20:42:58 -0400 Subject: [PATCH] Removed timers and rearranged some calls to improve speed --- src/swiftest/swiftest_coarray.f90 | 3 +-- src/swiftest/swiftest_driver.f90 | 18 ------------------ src/swiftest/swiftest_io.f90 | 13 +------------ 3 files changed, 2 insertions(+), 32 deletions(-) diff --git a/src/swiftest/swiftest_coarray.f90 b/src/swiftest/swiftest_coarray.f90 index 9d5650cc2..fe523f64f 100644 --- a/src/swiftest/swiftest_coarray.f90 +++ b/src/swiftest/swiftest_coarray.f90 @@ -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) diff --git a/src/swiftest/swiftest_driver.f90 b/src/swiftest/swiftest_driver.f90 index c40c67495..e15bbc383 100644 --- a/src/swiftest/swiftest_driver.f90 +++ b/src/swiftest/swiftest_driver.f90 @@ -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) @@ -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 @@ -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 @@ -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 diff --git a/src/swiftest/swiftest_io.f90 b/src/swiftest/swiftest_io.f90 index 4d9ed3f35..33bb2897c 100644 --- a/src/swiftest/swiftest_io.f90 +++ b/src/swiftest/swiftest_io.f90 @@ -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 @@ -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 @@ -427,7 +417,7 @@ 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 @@ -435,7 +425,6 @@ module subroutine swiftest_io_dump_storage(self, param) 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