Skip to content

Commit

Permalink
measure wall time per time step and per grid point-step
Browse files Browse the repository at this point in the history
  • Loading branch information
fjansson committed May 6, 2022
1 parent b5b20b4 commit ca69cb1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/modglobal.f90
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ module modglobal
real :: courant = -1
real :: peclet = 0.15
integer(kind=longint) :: dt_lim


integer(kind=longint) :: ntimesteps = 0
real :: walltime_stepping
integer :: rk3step = 0

integer :: iexpnr = 0 !< * number of the experiment
Expand Down
14 changes: 11 additions & 3 deletions src/program.f90
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ program DALES
!!----------------------------------------------------------------
!! 0.0 USE STATEMENTS FOR CORE MODULES
!!----------------------------------------------------------------
use modglobal, only : rk3step,timeleft
use modmpi, only : initmpicomm
use modglobal, only : rk3step,timeleft,ntimesteps,walltime_stepping,imax,jmax,kmax
use modmpi, only : initmpicomm,myid
use modstartup, only : startup, writerestartfiles,testwctime,exitmodules
use modtimedep, only : timedep
use modboundary, only : boundary, grwdamp! JvdD ,tqaver
Expand Down Expand Up @@ -154,7 +154,7 @@ program DALES
use modchem, only : initchem,twostep
use modcanopy, only : initcanopy, canopy, exitcanopy
use modadvection, only : advection

use mpi, only : MPI_Wtime

implicit none

Expand Down Expand Up @@ -205,6 +205,7 @@ program DALES
!------------------------------------------------------
call testwctime

walltime_stepping = MPI_Wtime()
do while (timeleft>0 .or. rk3step < 3)
! Calculate new timestep, and reset tendencies to 0.
call tstep_update
Expand Down Expand Up @@ -312,6 +313,13 @@ program DALES
! END OF TIME LOOP
!-------------------------------------------------------

if (myid==0) then
walltime_stepping = MPI_Wtime() - walltime_stepping
write(6,*)'wall time stepping =', walltime_stepping, ' s'
write(6,*)'time steps =', ntimesteps
write(6,*)'wall time / time step =', walltime_stepping / ntimesteps, ' s'
write(6,*)'wall time / grid point step =', walltime_stepping / ntimesteps / (imax*jmax*kmax) * 1e6, ' us'
end if

!--------------------------------------------------------
! 4 FINALIZE ADD ONS AND THE MAIN PROGRAM
Expand Down
3 changes: 2 additions & 1 deletion src/tstep.f90
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ end subroutine tstep_update
subroutine tstep_integrate


use modglobal, only : rdt,rk3step,e12min
use modglobal, only : rdt,rk3step,e12min,ntimesteps
use modfields, only : u0,um,up,v0,vm,vp,w0,wm,wp,&
thl0,thlm,thlp,qt0,qtm,qtp,&
e120,e12m,e12p,sv0,svm,svp
Expand Down Expand Up @@ -210,6 +210,7 @@ subroutine tstep_integrate
e12m = max(e12min,e12m + rk3coef * e12p)
e120 = e12m

ntimesteps = ntimesteps + 1
end if
end subroutine tstep_integrate
end module tstep

0 comments on commit ca69cb1

Please sign in to comment.