diff --git a/src/swiftest/swiftest_driver.f90 b/src/swiftest/swiftest_driver.f90 index be55dbd6b..c40c67495 100644 --- a/src/swiftest/swiftest_driver.f90 +++ b/src/swiftest/swiftest_driver.f90 @@ -31,6 +31,7 @@ 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) @@ -105,7 +106,7 @@ program swiftest_driver if (param%lcoarray .and. (this_image() < num_images())) sync images(this_image() + 1) ! Distribute test particles to the various images - call nbody_system%coarray_distribute(param) + if (param%lcoarray) call nbody_system%coarray_distribute(param) #endif ! If this is a new run, compute energy initial conditions (if energy tracking is turned on) and write the initial conditions to file. @@ -132,7 +133,9 @@ 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 @@ -145,11 +148,17 @@ 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 @@ -166,7 +175,16 @@ program swiftest_driver if (param%lenergy) call nbody_system%conservation_report(param, lterminal=.true.) #ifdef COARRAY end if ! (this_image() == 1) - call nbody_system%coarray_balance(param) + 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 be96af345..4d9ed3f35 100644 --- a/src/swiftest/swiftest_io.f90 +++ b/src/swiftest/swiftest_io.f90 @@ -228,16 +228,15 @@ module subroutine swiftest_io_display_run_information(self, param, integration_t character(len=64) :: pbarmessage character(*), parameter :: symbacompactfmt = '(";NPLM",ES22.15,$)' #ifdef COARRAY - character(*), parameter :: statusfmt = '("Image: ",I4, "; Time = ", ES12.5, "; fraction done = ", F6.3, ' // & + character(*), parameter :: co_statusfmt = '("Image: ",I4, "; Time = ", ES12.5, "; fraction done = ", F6.3, ' // & '"; Number of active pl, tp = ", I6, ", ", I6)' - character(*), parameter :: symbastatfmt = '("Image: ",I4, "; Image: Time = ", ES12.5, "; fraction done = ", F6.3, ' // & + character(*), parameter :: co_symbastatfmt = '("Image: ",I4, "; Image: Time = ", ES12.5, "; fraction done = ", F6.3, ' // & '"; Number of active pl, plm, tp = ", I6, ", ", I6, ", ", I6)' -#else +#endif character(*), parameter :: statusfmt = '("Time = ", ES12.5, "; fraction done = ", F6.3, ' // & '"; Number of active pl, tp = ", I6, ", ", I6)' character(*), parameter :: symbastatfmt = '("Time = ", ES12.5, "; fraction done = ", F6.3, ' // & '"; Number of active pl, plm, tp = ", I6, ", ", I6, ", ", I6)' -#endif character(*), parameter :: pbarfmt = '("Time = ", ES12.5," of ",ES12.5)' ! The following will syncronize the images so that they report in order, and only write to file one at at ime @@ -292,15 +291,23 @@ module subroutine swiftest_io_display_run_information(self, param, integration_t if (self%pl%nplm > 0) then #ifdef COARRAY - write(param%display_unit, symbastatfmt) this_image(),self%t, tfrac, self%pl%nbody, self%pl%nplm, self%tp%nbody -#else - write(param%display_unit, symbastatfmt) self%t, tfrac, self%pl%nbody, self%pl%nplm, self%tp%nbody + if (param%lcoarray) then + write(param%display_unit, co_symbastatfmt) this_image(),self%t, tfrac, self%pl%nbody, self%pl%nplm, self%tp%nbody + else +#endif + write(param%display_unit, symbastatfmt) self%t, tfrac, self%pl%nbody, self%pl%nplm, self%tp%nbody +#ifdef COARRAY + end if #endif else #ifdef COARRAY - write(param%display_unit, statusfmt) this_image(),self%t, tfrac, self%pl%nbody, self%tp%nbody -#else - write(param%display_unit, statusfmt) self%t, tfrac, self%pl%nbody, self%tp%nbody + if (param%lcoarray) then + write(param%display_unit, co_statusfmt) this_image(),self%t, tfrac, self%pl%nbody, self%tp%nbody + else +#endif + write(param%display_unit, statusfmt) self%t, tfrac, self%pl%nbody, self%tp%nbody +#ifdef COARRAY + end if #endif end if @@ -3086,7 +3093,11 @@ module subroutine swiftest_io_set_display_param(self, display_style) self%log_output = .false. case ('COMPACT', 'PROGRESS') #ifdef COARRAY - write(SWIFTEST_LOG_FILE,'("swiftest_coimage",I0.3,".log")') this_image() + if (self%lcoarray) then + write(SWIFTEST_LOG_FILE,'("swiftest_coimage",I0.3,".log")') this_image() + else + write(SWIFTEST_LOG_FILE,'("swiftest.log")') + end if #endif inquire(file=SWIFTEST_LOG_FILE, exist=fileExists) if (self%lrestart.and.fileExists) then