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

Commit

Permalink
Merge branch 'debug'
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Mar 20, 2023
2 parents dafd36c + 7cb3c0c commit 3554088
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/swiftest/swiftest_driver.f90
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ program swiftest_driver
call nbody_system%dump(param)
end if

call integration_timer%report(message="Integration steps:", unit=display_unit, nsubsteps=istep_out)
call integration_timer%report(message="Integration steps:", unit=display_unit)
call nbody_system%display_run_information(param, integration_timer)
call integration_timer%reset()
if (param%lenergy) call nbody_system%conservation_report(param, lterminal=.true.)
Expand Down
2 changes: 0 additions & 2 deletions src/swiftest/swiftest_io.f90
Original file line number Diff line number Diff line change
Expand Up @@ -1267,8 +1267,6 @@ module subroutine swiftest_io_netcdf_read_hdr_system(self, nc, param)
call netcdf_io_check( nf90_get_var(nc%id, nc%Gmass_varid, Gmtemp, start=[1,tslot], count=[idmax,1]), "netcdf_io_read_hdr_system nf90_getvar Gmass_varid" )
where(Gmtemp(:) /= Gmtemp(:)) Gmtemp(:) = 0.0_DP
plmmask(:) = plmask(:) .and. Gmtemp(:) > param%GMTINY
else
plmmask(:) = plmask(:)
end if

status = nf90_inq_varid(nc%id, nc%npl_varname, nc%npl_varid)
Expand Down
21 changes: 9 additions & 12 deletions src/walltime/walltime_implementations.f90
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module subroutine walltime_stop(self)
end subroutine walltime_stop


module subroutine walltime_report(self, message, unit, nsubsteps)
module subroutine walltime_report(self, message, unit)
!! author: David A. Minton
!!
!! Prints the elapsed time information to the terminal
Expand All @@ -47,9 +47,7 @@ module subroutine walltime_report(self, message, unit, nsubsteps)
class(walltimer), intent(inout) :: self !! Walltimer object
character(len=*), intent(in) :: message !! Message to prepend to the wall time terminal output
integer(I4B), intent(in) :: unit !! Output file unit for report text to be directed
integer(I4B), optional, intent(in) :: nsubsteps !! Number of substeps used to compute the time per step
! Internals
character(len=*), parameter :: nosubstepfmt = '" Total wall time: ", es12.5, "; Interval wall time: ", es12.5 '
character(len=*), parameter :: substepfmt = '" Total wall time: ", es12.5, "; Interval wall time: ", es12.5, ";' //&
' Interval wall time/step: ", es12.5'
character(len=STRMAX) :: fmt
Expand All @@ -62,17 +60,14 @@ module subroutine walltime_report(self, message, unit, nsubsteps)

call system_clock(count_now)
count_delta_main = count_now - self%count_start_main
count_delta_step = count_now - self%count_start_step
self%wall_main = count_delta_main / (self%count_rate * 1.0_DP)

count_delta_step = self%count_stop_step - self%count_start_step
self%wall_step = count_delta_step / (self%count_rate * 1.0_DP)
if (present(nsubsteps)) then
self%wall_per_substep = self%wall_step / nsubsteps
fmt = '("' // adjustl(message) // '",' // substepfmt // ')'
write(unit,trim(adjustl(fmt))) self%wall_main, self%wall_step, self%wall_per_substep
else
fmt = '("' // adjustl(message) // '",' // nosubstepfmt // ')'
write(unit,trim(adjustl(fmt))) self%wall_main, self%wall_step
end if
self%wall_per_substep = self%wall_step / self%nsubsteps

fmt = '("' // adjustl(message) // '",' // substepfmt // ')'
write(unit,trim(adjustl(fmt))) self%wall_main, self%wall_step, self%wall_per_substep

return
end subroutine walltime_report
Expand All @@ -90,6 +85,7 @@ module subroutine walltime_reset(self)
self%is_paused = .false.
self%wall_step = 0.0_DP
self%wall_per_substep = 0.0_DP
self%nsubsteps = 0

return
end subroutine walltime_reset
Expand Down Expand Up @@ -136,6 +132,7 @@ module subroutine walltime_start(self)
else ! Start a new step timer
call system_clock(self%count_start_step)
end if
self%nsubsteps = self%nsubsteps + 1

return
end subroutine walltime_start
Expand Down
4 changes: 2 additions & 2 deletions src/walltime/walltime_module.f90
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ module walltime
integer(I8B) :: count_start_step !! Value of the clock ticker at the start of a timed step
integer(I8B) :: count_stop_step !! Value of the clock ticker at the end of a timed step
integer(I8B) :: count_pause !! Value of the clock ticker at the end of a timed step
integer(I4B) :: nsubsteps !! Number of substeps in an interval (number of times the timer is turned off and back on again)
real(DP) :: wall_step !! Value of the step elapsed time
real(DP) :: wall_main !! Value of the main clock elapsed time
real(DP) :: wall_per_substep !! Value of time per substep
Expand All @@ -44,12 +45,11 @@ module walltime


interface
module subroutine walltime_report(self, message, unit, nsubsteps)
module subroutine walltime_report(self, message, unit)
implicit none
class(walltimer), intent(inout) :: self !! Walltimer object
character(len=*), intent(in) :: message !! Message to prepend to the wall time terminal output
integer(I4B), intent(in) :: unit !! Output file unit for report text to be directed
integer(I4B), optional, intent(in) :: nsubsteps !! Number of substeps used to compute the time per step
end subroutine walltime_report

module subroutine walltime_reset(self)
Expand Down

0 comments on commit 3554088

Please sign in to comment.