Commit f012a2cf authored by bjb's avatar bjb
Browse files

New getm_timers module

parent 06adaeb7
......@@ -8,7 +8,8 @@ MODULES=-module $(MODDIR)
EXTRAS = -w95 -e95
EXTRAS = -w95
DEBUG_FLAGS = -g -C -check -fpe0 -traceback
PROF_FLAGS = -qp -p -O0
#PROF_FLAGS = -qp -p -O0
PROF_FLAGS = -p -O2
PROD_FLAGS = -O3 -i-static
DEFINES += -DREAL_4B=real\(4\)
endif
......@@ -118,6 +118,9 @@
#define _ONE_ 1.0d0
#endif
! Rare use of long integers (e.g. timers):
#define LONGINT INTEGER(KIND=8)
! The width of the HALO zones
#define HALO 2
......
!$Id: bottom_friction.F90,v 1.7 2006-03-01 15:54:07 kbk Exp $
!$Id: bottom_friction.F90,v 1.8 2009-08-18 10:24:43 bjb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -36,6 +36,7 @@
use parameters, only: kappa,avmmol
use domain, only: imin,imax,jmin,jmax,au,av,min_depth
use variables_2d
use getm_timers, only: tic, toc, TIM_BOTTFRICT
IMPLICIT NONE
!
! !INPUT PARAMETERS:
......@@ -61,6 +62,8 @@
write(debug,*) 'bottom_friction() # ',Ncall
#endif
CALL tic(TIM_BOTTFRICT)
#ifdef DEBUG
if(Ncall .eq. 1) then
STDERR 'bottom_friction(): checking for 0 depth values'
......@@ -211,6 +214,8 @@
rv=rvv*sqrt(uloc**2+vloc**2)
end where
CALL toc(TIM_BOTTFRICT)
#ifdef DEBUG
write(debug,*) 'Leaving bottom_friction()'
write(debug,*)
......
!$Id: depth_update.F90,v 1.9 2006-03-01 15:54:07 kbk Exp $
!$Id: depth_update.F90,v 1.10 2009-08-18 10:24:43 bjb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -25,6 +25,7 @@
use domain, only: imin,imax,jmin,jmax,H,HU,HV,min_depth,crit_depth
use domain, only: az,au,av,dry_z,dry_u,dry_v
use variables_2d, only: D,z,zo,DU,zu,DV,zv
use getm_timers, only: tic, toc, TIM_DPTHUPDATE
IMPLICIT NONE
!
! !INPUT PARAMETERS:
......@@ -47,6 +48,7 @@
Ncall = Ncall+1
write(debug,*) 'depth_update() # ',Ncall
#endif
CALL tic(TIM_DPTHUPDATE)
#undef USE_MASK
......@@ -122,6 +124,7 @@
end do
#endif
CALL toc(TIM_DPTHUPDATE)
#ifdef DEBUG
write(debug,*) 'Leaving depth_update()'
write(debug,*)
......
!$Id: m2d.F90,v 1.31 2009-05-15 07:00:16 bjb Exp $
!$Id: m2d.F90,v 1.32 2009-08-18 10:24:43 bjb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -265,6 +265,7 @@
!
! !INTERFACE:
subroutine integrate_2d(runtype,loop,tausx,tausy,airp)
use getm_timers, only: tic, toc, TIM_INTEGR2D
IMPLICIT NONE
!
! !INPUT PARAMETERS:
......@@ -308,7 +309,6 @@
Ncall = Ncall+1
write(debug,*) 'integrate_2d() # ',Ncall
#endif
if (mod(loop-1,MM) .eq. 0) then ! MacroMicro time step
#ifndef NO_BOTTFRIC
call bottom_friction(runtype)
......@@ -323,21 +323,27 @@
if (Am .gt. _ZERO_ .or. An_method .gt. 0) then
call uv_diffusion(Am,An_method,An,AnX) ! Has to be called after uv_advect.
end if
call tic(TIM_INTEGR2D)
call mirror_bdy_2d(UEx,U_TAG)
call mirror_bdy_2d(VEx,V_TAG)
call toc(TIM_INTEGR2D)
#endif
#endif
call momentum(loop,tausx,tausy,airp)
if (runtype .gt. 1) then
call tic(TIM_INTEGR2D)
Uint=Uint+U
Vint=Vint+V
call toc(TIM_INTEGR2D)
end if
if (have_boundaries) call update_2d_bdy(loop,bdyramp_2d)
call sealevel()
call depth_update()
if(residual .gt. 0 .and. loop .ge. residual) then
call tic(TIM_INTEGR2D)
call do_residual(0)
call toc(TIM_INTEGR2D)
end if
#ifdef DEBUG
......
!$Id: momentum.F90,v 1.12 2006-03-01 15:54:07 kbk Exp $
!$Id: momentum.F90,v 1.13 2009-08-18 10:24:43 bjb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -17,6 +17,9 @@
!
! !USES:
use domain, only: imin,imax,jmin,jmax
! For timer here: Only clock what is not taken at "next" level.
use getm_timers, only: tic, toc, TIM_MOMENTUM
IMPLICIT NONE
!
! !INPUT PARAMETERS:
......@@ -42,6 +45,7 @@
Ncall = Ncall+1
write(debug,*) 'Momentum() # ',Ncall
#endif
CALL tic(TIM_MOMENTUM)
if(ufirst) then
call umomentum(tausx,airp)
......@@ -53,6 +57,11 @@
ufirst = .true.
end if
CALL toc(TIM_MOMENTUM)
#ifdef DEBUG
write(debug,*) 'Leaving momentum()'
write(debug,*)
#endif
return
end subroutine momentum
!EOC
......@@ -123,6 +132,7 @@
#endif
use m2d, only: dtm
use variables_2d, only: D,z,UEx,U,DU,fV,SlUx,SlRu,ru,fU,DV
use getm_timers, only: tic, toc, TIM_MOMENTUMH
use halo_zones, only : update_2d_halo,wait_halo,U_TAG
IMPLICIT NONE
!
......@@ -177,8 +187,10 @@
#endif
! now u is calculated
CALL tic(TIM_MOMENTUMH)
call update_2d_halo(U,U,au,imin,jmin,imax,jmax,U_TAG)
call wait_halo(U_TAG)
CALL toc(TIM_MOMENTUMH)
call mirror_bdy_2d(U,U_TAG)
! Semi-implicit treatment of Coriolis force for V-momentum eq.
......@@ -281,6 +293,7 @@
#endif
use m2d, only: dtm
use variables_2d, only: D,z,VEx,V,DV,fU,SlVx,SlRv,rv,fV,DU
use getm_timers, only: tic, toc, TIM_MOMENTUMH
use halo_zones, only : update_2d_halo,wait_halo,V_TAG
IMPLICIT NONE
!
......@@ -336,8 +349,10 @@
#endif
! now v is calculated
CALL tic(TIM_MOMENTUMH)
call update_2d_halo(V,V,av,imin,jmin,imax,jmax,V_TAG)
call wait_halo(V_TAG)
CALL toc(TIM_MOMENTUMH)
call mirror_bdy_2d(V,V_TAG)
! Semi-implicit treatment of Coriolis force for U-momentum eq.
......
!$Id: sealevel.F90,v 1.17 2008-12-09 01:04:38 kb Exp $
!$Id: sealevel.F90,v 1.18 2009-08-18 10:24:43 bjb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -29,6 +29,7 @@
#endif
use m2d, only: dtm
use variables_2d, only: z,zo,U,V,fwf
use getm_timers, only: tic, toc, TIM_SEALEVEL, TIM_SEALEVELH
use halo_zones, only : update_2d_halo,wait_halo,z_TAG
#ifdef USE_BREAKS
use halo_zones, only : nprocs,set_flag,u_TAG,v_TAG
......@@ -62,6 +63,7 @@
Ncall = Ncall+1
write(debug,*) 'sealevel() # ',Ncall
#endif
call tic(TIM_SEALEVEL)
zo = z
......@@ -130,10 +132,12 @@
if(break_flag .ne. 0) then
z=zo
call tic(TIM_SEALEVELH)
call update_2d_halo(U,U,au,imin,jmin,imax,jmax,u_TAG)
call wait_halo(u_TAG)
call update_2d_halo(V,V,av,imin,jmin,imax,jmax,v_TAG)
call wait_halo(v_TAG)
call toc(TIM_SEALEVELH)
end if
end do !end do while(break_flag>0)
......@@ -146,10 +150,12 @@
z(i,3)=z(i,2)
end do
#endif
call tic(TIM_SEALEVELH)
call update_2d_halo(z,z,az,imin,jmin,imax,jmax,z_TAG)
call wait_halo(z_TAG)
call toc(TIM_SEALEVELH)
call toc(TIM_SEALEVEL)
#ifdef DEBUG
write(debug,*) 'Leaving sealevel()'
write(debug,*)
......
!$Id: uv_advect.F90,v 1.10 2006-03-01 15:54:07 kbk Exp $
!$Id: uv_advect.F90,v 1.11 2009-08-18 10:24:44 bjb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -152,6 +152,7 @@
use domain, only: dx,dy,ard1
#endif
use variables_2d, only: U,DU,UEx,V,DV,VEx,PP
use getm_timers, only: tic, toc, TIM_UVADVECT
IMPLICIT NONE
!
! !INPUT PARAMETERS:
......@@ -173,6 +174,7 @@
Ncall = Ncall+1
write(debug,*) 'uv_advect() # ',Ncall
#endif
CALL tic(TIM_UVADVECT)
! Upstream for dx(U^2/D)
do j=jmin,jmax ! PP defined on T-points
......@@ -274,6 +276,7 @@
end do
#endif
CALL toc(TIM_UVADVECT)
#ifdef DEBUG
write(debug,*) 'Leaving uv_advect()'
write(debug,*)
......
!$Id: uv_depths.F90,v 1.12 2006-03-01 15:54:07 kbk Exp $
!$Id: uv_depths.F90,v 1.13 2009-08-18 10:24:44 bjb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -47,6 +47,7 @@
use exceptions
use domain, only: imin,imax,jmin,jmax,az,au,av,H,HU,HV
use variables_2d, only: DU,DV
use getm_timers, only: tic,toc,TIM_UVDEPTHS
IMPLICIT NONE
!
! !INPUT PARAMETERS:
......@@ -71,6 +72,7 @@
Ncall = Ncall+1
write(0,*) 'uv_depths() # ',Ncall
#endif
CALL tic(TIM_UVDEPTHS)
do j=jmin-HALO,jmax+HALO
do i=imin-HALO,imax+HALO-1
......@@ -112,6 +114,7 @@
end do
end do
CALL toc(TIM_UVDEPTHS)
#ifdef DEBUG
write(0,*) 'Leaving uv_depths()'
write(0,*)
......
!$Id: uv_diffusion.F90,v 1.11 2009-05-15 07:00:16 bjb Exp $
!$Id: uv_diffusion.F90,v 1.12 2009-08-18 10:24:44 bjb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -163,6 +163,7 @@
use domain, only: dx,dy,ard1
#endif
use variables_2d, only: D,U,DU,UEx,V,DV,VEx,PP
use getm_timers, only: tic,toc,TIM_UVDIFFUS
IMPLICIT NONE
!
! !INPUT PARAMETERS:
......@@ -187,6 +188,7 @@
Ncall = Ncall+1
write(debug,*) 'uv_diffusion() # ',Ncall
#endif
CALL tic(TIM_UVDIFFUS)
! Central for dx(2*Am*dx(U/DU))
do j=jmin,jmax
......@@ -286,6 +288,7 @@
end do
#endif
CALL toc(TIM_UVDIFFUS)
#ifdef DEBUG
write(debug,*) 'Leaving uv_diffusion()'
write(debug,*)
......
!$Id: bottom_friction_3d.F90,v 1.11 2009-04-22 10:00:40 lars Exp $
!$Id: bottom_friction_3d.F90,v 1.12 2009-08-18 10:24:44 bjb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -49,6 +49,7 @@
use domain, only: imin,imax,jmin,jmax,kmax,au,av,min_depth
use variables_2d, only: zub,zvb,zub0,zvb0
use variables_3d, only: kumin,kvmin,uu,vv,huo,hun,hvo,hvn,rru,rrv
use getm_timers, only: tic, toc, TIM_BOTTFRICT3D
IMPLICIT NONE
!
! !INPUT PARAMETERS:
......@@ -76,6 +77,7 @@
Ncall = Ncall+1
write(debug,*) 'bottom_friction_3d() # ',Ncall
#endif
call tic(TIM_BOTTFRICT3D)
#if 0
if(first) then
......@@ -175,8 +177,7 @@
enddo
#endif
call toc(TIM_BOTTFRICT3D)
#ifdef DEBUG
write(debug,*) 'Leaving bottom_friction_3d()'
write(debug,*)
......
!$Id: coordinates.F90,v 1.15 2007-06-29 10:55:42 kbk Exp $
!$Id: coordinates.F90,v 1.16 2009-08-18 10:24:44 bjb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -73,6 +73,7 @@
use domain, only: imin,imax,jmin,jmax,kmax
use variables_3d, only: kvmin,hvo,hvn
#endif
use getm_timers, only: tic, toc,TIM_COORDS
IMPLICIT NONE
!
! !INPUT PARAMETERS:
......@@ -96,6 +97,7 @@
Ncall = Ncall+1
write(debug,*) 'coordinates() # ',Ncall
#endif
call tic(TIM_COORDS)
if (first) then
select case (cord_type)
......@@ -144,6 +146,7 @@ STDERR 'coordinates(): adaptive_coordinates not coded yet'
end do
#endif
call toc(TIM_COORDS)
#ifdef DEBUG
write(debug,*) 'Leaving coordinates()'
write(debug,*)
......
!$Id: eqstate.F90,v 1.11 2007-08-02 09:46:21 hb Exp $
!$Id: eqstate.F90,v 1.12 2009-08-18 10:24:44 bjb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -105,6 +105,7 @@
! !USES:
use domain, only: imin,imax,jmin,jmax,kmax,az
use variables_3d, only: T,S,rho,buoy
use getm_timers, only: tic, toc, TIM_EQSTATE
IMPLICIT NONE
!
! !INPUT PARAMETERS:
......@@ -126,6 +127,7 @@
Ncall = Ncall+1
write(debug,*) 'do_eqstate() # ',Ncall
#endif
call tic(TIM_EQSTATE)
#define BUOYANCY
select case (eqstate_method)
......@@ -209,6 +211,7 @@
x=-g/rho_0
buoy=x*(rho-rho_0)
call toc(TIM_EQSTATE)
#ifdef DEBUG
write(debug,*) 'leaving do_eqstate()'
write(debug,*)
......
!$Id: gotm.F90,v 1.17 2008-03-27 08:51:23 hb Exp $
!$Id: gotm.F90,v 1.18 2009-08-18 10:24:44 bjb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -60,6 +60,7 @@
use turbulence, only: do_turbulence,cde
use turbulence, only: tke1d => tke, eps1d => eps, L1d => L
use turbulence, only: num1d => num, nuh1d => nuh
use getm_timers, only: tic, toc, TIM_GOTM, TIM_GOTMTURB, TIM_GOTMH
IMPLICIT NONE
!
! !INPUT PARAMETERS:
......@@ -86,6 +87,7 @@
Ncall = Ncall+1
write(debug,*) 'gotm() # ',Ncall
#endif
call tic(TIM_GOTM)
xP = _ZERO_
do j=jmin,jmax
......@@ -134,8 +136,13 @@
#endif
end do
#else
! If we do tic/toc for do_turbulence, then we can
! easily get into the millions of system_clock calls,
! as the call is deeply in loops
!call tic(TIM_GOTMTURB)
call do_turbulence(kmax,dt,D(i,j),u_taus,u_taub,z0s,z0b,h, &
NN1d,SS1d,xP)
!call toc(TIM_GOTMTURB)
#endif
tke(i,j,:) = tke1d
eps(i,j,:) = eps1d
......@@ -146,14 +153,17 @@
end if
end do
end do
call tic(TIM_GOTMH)
call update_3d_halo(num,num,az,imin,jmin,imax,jmax,kmax,H_TAG)
call wait_halo(H_TAG)
#ifndef NO_BAROCLINIC
call update_3d_halo(nuh,nuh,az,imin,jmin,imax,jmax,kmax,H_TAG)
call wait_halo(H_TAG)
#endif
call toc(TIM_GOTMH)
call toc(TIM_GOTM)
#ifdef DEBUG
write(debug,*) 'Leaving gotm()'
write(debug,*)
......
!$Id: internal_pressure.F90,v 1.21 2009-05-05 07:39:47 kb Exp $
!$Id: internal_pressure.F90,v 1.22 2009-08-18 10:24:44 bjb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -186,6 +186,7 @@
! $j=3$.
!
! !USES:
use getm_timers, only: tic, toc, TIM_INTPRESS
IMPLICIT NONE
!
! !INPUT PARAMETERS:
......@@ -205,7 +206,7 @@
Ncall = Ncall+1
write(debug,*) 'do_internal_pressure() # ',Ncall
#endif
call tic(TIM_INTPRESS)
zz = _ZERO_
idpdx = _ZERO_
idpdy = _ZERO_
......@@ -263,7 +264,7 @@
end do
#endif
call toc(TIM_INTPRESS)
#ifdef DEBUG
write(debug,*) 'Leaving do_internal_pressure()'
write(debug,*)
......
!$Id: m3d.F90,v 1.43 2009-02-18 13:38:14 hb Exp $
!$Id: m3d.F90,v 1.44 2009-08-18 10:24:44 bjb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -289,6 +289,7 @@
!
! !INTERFACE:
subroutine integrate_3d(runtype,n)
use getm_timers, only: tic, toc, TIM_INTEGR3D
IMPLICIT NONE
!
! !INPUT PARAMETERS:
......@@ -391,15 +392,21 @@
call bottom_friction_3d()
end if
#endif
call tic(TIM_INTEGR3D)
SS = _ZERO_
call toc(TIM_INTEGR3D)
#ifndef NO_BAROCLINIC
call tic(TIM_INTEGR3D)
NN = _ZERO_
call toc(TIM_INTEGR3D)
if (runtype .eq. 4) call do_internal_pressure()
#endif
call tic(TIM_INTEGR3D)
huo=hun
hvo=hvn
ip_fac=_ONE_
if (ip_ramp .gt. 0) ip_fac=min( _ONE_ , n*_ONE_/ip_ramp)
call toc(TIM_INTEGR3D)
#ifdef STRUCTURE_FRICTION
call structure_friction_3d
#endif
......@@ -449,6 +456,7 @@
! operates on individual fields and not as is the case now - on both
! T and S.
#ifndef NO_BAROCLINIC
call tic(TIM_INTEGR3D)
if (bdy3d) call do_bdy_3d(0,T)
if (calc_temp) then
call update_3d_halo(T,T,az,imin,jmin,imax,jmax,kmax,D_TAG)
......@@ -460,6 +468,7 @@
call wait_halo(D_TAG)
call mirror_bdy_3d(S,D_TAG)
end if
call toc(TIM_INTEGR3D)
#endif
end if
#endif
......@@ -473,7 +482,9 @@
#endif
#ifdef GETM_BIO
call tic(TIM_INTEGR3D)
if (bio_calc) call do_getm_bio(dt)
call toc(TIM_INTEGR3D)
#endif
UEx=_ZERO_ ; VEx=_ZERO_
......@@ -494,7 +505,9 @@
call slow_terms()
#endif
call tic(TIM_INTEGR3D)
call stop_macro()
call toc(TIM_INTEGR3D)
#ifdef DEBUG
write(debug,*) 'Leaving integrate_3d()'
......
!$Id: salinity.F90,v 1.27 2007-09-21 08:34:32 kbk Exp $
!$Id: salinity.F90,v 1.28 2009-08-18 10:24:44 bjb Exp $
#include "cppdefs.h"
!-----------------------------------------------------------------------
!BOP
......@@ -376,6 +376,7 @@ salt_field_no=1
use domain, only: dx,dy,ard1
#endif
use parameters, only: avmols
use getm_timers, only: tic, toc, TIM_SALT
IMPLICIT NONE
!
! !INPUT PARAMETERS:
......@@ -409,6 +410,7 @@ salt_field_no=1
Ncall = Ncall+1
write(debug,*) 'do_salinity() # ',Ncall
#endif
call tic(TIM_SALT)
do j=jmin,jmax
do i=imin,imax
......@@ -432,10 +434,14 @@ salt_field_no=1
delyv=dy
area_inv=ard1
#endif
! Note: do_advection_3d is timed separately, so we
! stop the present counter
call toc(TIM_SALT)
call do_advection_3d(dt,S,uu,vv,ww,hun,hvn,ho,hn, &
delxu,delxv,delyu,delyv,area_inv,az,au,av, &
salt_hor_adv,salt_ver_adv,salt_adv_split,salt_AH)
call tic(TIM_SALT)
#ifdef PECS_TEST
S(imin:imin,jmin:jmax,1:kmax)=10.
S(imax:imax,jmin:jmax,1:kmax)=10.
......@@ -546,6 +552,7 @@ salt_field_no=1
end if
end if
call toc(TIM_SALT)
#ifdef DEBUG
write(debug,*) 'Leaving do_salinity()'
write(debug,*)
......