Commit 1179ea98 authored by Bjarne Buchmann's avatar Bjarne Buchmann
Browse files

More/updated timers for halo/communication

parent e8eb559b
......@@ -211,7 +211,7 @@
!
!
! !USES:
use getm_timers, only: tic, toc, TIM_ADVECT3DTOT
use getm_timers, only: tic, toc, TIM_ADVECT3DTOT, TIM_ADVECT3DH
IMPLICIT NONE
!
! !INPUT PARAMETERS:
......@@ -262,16 +262,20 @@
case (0)
call u_split_adv(dt,f,uu,hun,delxu,delyu,area_inv,au,a2,&
hor_adv,az,AH)
call tic(TIM_ADVECT3DH)
call update_3d_halo(f,f,az,&
imin,jmin,imax,jmax,kmax,D_TAG)
call wait_halo(D_TAG)
call toc(TIM_ADVECT3DH)
#ifndef SLICE_MODEL
call v_split_adv(dt,f,vv,hvn,delxv,delyv,area_inv,av,a2,&
hor_adv,az,AH)
call tic(TIM_ADVECT3DH)
call update_3d_halo(f,f,az,&
imin,jmin,imax,jmax,kmax,D_TAG)
call wait_halo(D_TAG)
call toc(TIM_ADVECT3DH)
#endif
if (kmax.gt.1) then
......@@ -284,16 +288,20 @@
case (1)
call u_split_adv(dt,f,uu,hun,delxu,delyu,area_inv,au,a1,&
hor_adv,az,AH)
call tic(TIM_ADVECT3DH)
call update_3d_halo(f,f,az, &
imin,jmin,imax,jmax,kmax,D_TAG)
call wait_halo(D_TAG)
call toc(TIM_ADVECT3DH)
#ifndef SLICE_MODEL
call v_split_adv(dt,f,vv,hvn,delxv,delyv,area_inv,av,a1,&
hor_adv,az,AH)
call tic(TIM_ADVECT3DH)
call update_3d_halo(f,f,az, &
imin,jmin,imax,jmax,kmax,D_TAG)
call wait_halo(D_TAG)
call toc(TIM_ADVECT3DH)
#endif
if (kmax.gt.1) then
......@@ -302,24 +310,30 @@
#else
call w_split_adv(dt,f,ww,az,a2,ver_adv)
#endif
call tic(TIM_ADVECT3DH)
call update_3d_halo(f,f,az, &
imin,jmin,imax,jmax,kmax,D_TAG)
call wait_halo(D_TAG)
call toc(TIM_ADVECT3DH)
end if
#ifndef SLICE_MODEL
call v_split_adv(dt,f,vv,hvn,delxv,delyv,area_inv,av,a1,&
hor_adv,az,AH)
call tic(TIM_ADVECT3DH)
call update_3d_halo(f,f,az, &
imin,jmin,imax,jmax,kmax,D_TAG)
call wait_halo(D_TAG)
call toc(TIM_ADVECT3DH)
#endif
call u_split_adv(dt,f,uu,hun,delxu,delyu,area_inv,au,a1,&
hor_adv,az,AH)
call tic(TIM_ADVECT3DH)
call update_3d_halo(f,f,az, &
imin,jmin,imax,jmax,kmax,D_TAG)
call wait_halo(D_TAG)
call toc(TIM_ADVECT3DH)
case (2)
select case (hor_adv)
......
......@@ -304,6 +304,9 @@
! !INTERFACE:
subroutine integrate_3d(runtype,n)
use getm_timers, only: tic, toc, TIM_INTEGR3D
#ifndef NO_BAROCLINIC
use getm_timers, only: TIM_TEMPH, TIM_SALTH
#endif
IMPLICIT NONE
!
! !INPUT PARAMETERS:
......@@ -479,13 +482,17 @@
call tic(TIM_INTEGR3D)
if (bdy3d) call do_bdy_3d(0,T)
if (calc_temp) then
call tic(TIM_TEMPH)
call update_3d_halo(T,T,az,imin,jmin,imax,jmax,kmax,D_TAG)
call wait_halo(D_TAG)
call toc(TIM_TEMPH)
call mirror_bdy_3d(T,D_TAG)
end if
if (calc_salt) then
call tic(TIM_SALTH)
call update_3d_halo(S,S,az,imin,jmin,imax,jmax,kmax,D_TAG)
call wait_halo(D_TAG)
call toc(TIM_SALTH)
call mirror_bdy_3d(S,D_TAG)
end if
call toc(TIM_INTEGR3D)
......
......@@ -7,7 +7,7 @@ include ../Rules.make
LIB = $(LIBDIR)/libfutils${buildtype}.a
MODSRC = exceptions.F90 parallel.F90 parameters.F90 time.F90 \
getm_timers.F90 grid_interpol.F90
grid_interpol.F90
LIBSRC = ver_interpol.F90 kbk_interpol.F90 tridiagonal.F90 pos.F90 \
cnv_2d.F90 cnv_3d.F90 eta_mask.F90 col_interpol.F90 \
......@@ -18,9 +18,9 @@ LIBSRC = ver_interpol.F90 kbk_interpol.F90 tridiagonal.F90 pos.F90 \
SRC = $(MODSRC) $(LIBSRC)
ifeq ($(parallel),false)
MOD =
MOD = ${LIB}(getm_timers.o)
else
MOD = ${LIB}(halo_mpi.o) ${LIB}(read_par_setup.o)
MOD = ${LIB}(getm_timers.o) ${LIB}(halo_mpi.o) ${LIB}(read_par_setup.o)
endif
MOD += \
......
......@@ -17,7 +17,7 @@
!
! !PUBLIC MEMBER FUNCTIONS:
public :: init_getm_timers
public :: write_getm_timers
public :: write_getm_timers,write_getm_timers_active
public :: tic, toc
! !PUBLIC DATA MEMBERS:
! The indices order the output.
......@@ -55,7 +55,9 @@
integer, parameter :: TIM_SLOWADV = 50 ! 3d slow_advection
integer, parameter :: TIM_SLOWDIFF = 51 ! 3d slow_diffusion
integer, parameter :: TIM_TEMP = 52 ! 3d do_temperature
integer, parameter :: TIM_TEMPH = 53 ! 3d temperature halo (presently in m3d/do_integrate_3d)
integer, parameter :: TIM_SALT = 54 ! 3d do_salinity
integer, parameter :: TIM_SALTH = 55 ! 3d salinity halo (presently in m3d/do_integrate_3d)
integer, parameter :: TIM_COORDS = 56 ! 3d coordinates
integer, parameter :: TIM_INTPRESS = 58 ! 3d do_internal_pressure
integer, parameter :: TIM_STARTMCR = 60 ! 3d start_macro
......@@ -73,8 +75,12 @@
integer, parameter :: TIM_OUTPUT = 92 ! output
! These catch stuff that are *also* measured somewhere else:
integer, parameter :: TIM_ADVECT3DTOT = 100 ! advection_3d (uv+tracers)
integer, parameter :: TIM_ADVECT3DH = 101 ! advection_3d halo-part only
integer, parameter :: TIM_CHECK3DF = 102 ! check_3d_fields
integer, parameter :: TIM_MIXANALYSIS = 103 ! (numerical) mixing analysis
integer, parameter :: TIM_HALO2D = 110 ! do halo 2d (initialize comm)
integer, parameter :: TIM_HALO3D = 111 ! do halo 3d (initialize comm)
integer, parameter :: TIM_HALOWAIT = 112 ! wait_halo (2d+3d both)
! This is test timers for temporary coding purposes:
! Note: All timers with index 170+ (test_timer_first) are
! considered test timers, so dont implement your timers here
......@@ -169,6 +175,9 @@
#ifdef GETM_PARALLEL
timernames(TIM_MOMENTUMH) = ' momentum-halo'
timernames(TIM_SEALEVELH) = ' sealevel-halo'
timernames(TIM_HALO2D) = ' sum do_halo_2d'
timernames(TIM_HALOWAIT) = ' sum wait_halo'
#endif
#ifndef NO_3D
......@@ -188,7 +197,9 @@
timernames(TIM_SLOWADV) = 'slow_advection'
timernames(TIM_SLOWDIFF) = 'slow_diffusion'
timernames(TIM_TEMP) = 'do_temperature'
timernames(TIM_TEMPH) = ' temperature-halo'
timernames(TIM_SALT) = 'do_salinity'
timernames(TIM_SALTH) = ' salinity-halo'
timernames(TIM_COORDS) = 'coordinates'
timernames(TIM_INTPRESS) = 'do_internal_pressure'
timernames(TIM_STARTMCR) = 'start_macro'
......@@ -203,12 +214,13 @@
! We only really want to display halo-stuff if we compile for parallel:
#ifdef GETM_PARALLEL
timernames(TIM_GOTMH) = ' gotm-halo'
timernames(TIM_SEALEVELH) = ' sealevel-halo'
timernames(TIM_UVADV3DH) = ' uv_advect_3d-halo'
timernames(TIM_UUMOMENTUMH) = ' uu_momentum_3d-halo'
timernames(TIM_VVMOMENTUMH) = ' vv_momentum_3d-halo'
timernames(TIM_WWMOMENTUMH) = ' ww_momentum_3d-halo'
timernames(TIM_STRESSES3DH) = ' stresses_3d-halo'
timernames(TIM_ADVECT3DH) = ' do_advection_3d halo'
timernames(TIM_HALO3D) = ' sum do_halo_3d'
#endif
#ifdef STRUCTURE_FRICTION
......@@ -227,7 +239,6 @@
timernames(TIM_TEST08) = ' test-08'
timernames(TIM_TEST09) = ' test-09'
#ifdef DEBUG
write(debug,*) 'Leaving init_timers()'
write(debug,*)
......@@ -316,6 +327,8 @@
LEVEL2 ' Timings may be slightly incorrect'
end if
timertics(timerindex) = 0
#ifdef DEBUG
write(debug,*) 'Leaving toc()'
write(debug,*)
......@@ -401,6 +414,59 @@
end subroutine write_getm_timers
!EOC
!-----------------------------------------------------------------------
!BOP
!
! !IROUTINE: write_getm_timers_active - write which timeres are ON
!
! !INTERFACE:
subroutine write_getm_timers_active()
IMPLICIT NONE
!
! !DESCRIPTION:
! Write IDs of active timers.
! This is mostly useful for debugging and location of where certain
! timers are set or should be set.
!
! !REVISION HISTORY:
! Original author(s): Bjarne Buchmann
!
! !LOCAL VARIABLES:
integer :: i,nactive
integer :: active_counters(max_timers)
!EOP
!-------------------------------------------------------------------------
!BOC
#ifndef NO_TIMERS
#ifdef DEBUG
integer, save :: Ncall = 0
Ncall = Ncall+1
write(debug,*) 'write_getm_timers_active() # ',Ncall
#endif
nactive=0
! Go over each timer and mark it if it is active
do i=1,max_timers
if (timertics(i).ne.0) then
! Inactive timers have been set to "zero" tic value.
nactive=nactive+1
active_counters(nactive)=i
end if
end do
if (nactive>0) then
LEVEL2 'Active timers:',active_counters(1:nactive)
else
LEVEL2 'Active timers: none'
end if
#ifdef DEBUG
write(debug,*) 'Leaving write_getm_timers_active()'
write(debug,*)
#endif
#endif
return
end subroutine write_getm_timers_active
!EOC
!-----------------------------------------------------------------------
end module getm_timers
......
......@@ -689,6 +689,7 @@
!
! !INTERFACE:
subroutine update_2d_halo_mpi(f1,f2,imin,jmin,imax,jmax,tag,mirror)
use getm_timers, only: tic, toc, TIM_HALO2D
IMPLICIT NONE
!
! !DESCRIPTION:
......@@ -715,6 +716,7 @@
FATAL 'Last action was not WAITING - not ready for sending (2D)'
call MPI_ABORT(active_comm,-1,ierr)
end if
call tic(TIM_HALO2D)
il=imin;ih=imax;jl=jmin;jh=jmax
if ( present(mirror) ) do_mirror = mirror
......@@ -876,6 +878,7 @@ STDERR 'TWOD_SENDRECV'
last_action = SENDING
call toc(TIM_HALO2D)
return
end subroutine update_2d_halo_mpi
!EOC
......@@ -887,6 +890,7 @@ STDERR 'TWOD_SENDRECV'
!
! !INTERFACE:
SUBROUTINE update_3d_halo_mpi(f1,f2,imin,jmin,imax,jmax,kmax,tag)
use getm_timers, only: tic, toc, TIM_HALO3D
IMPLICIT NONE
!
! !DESCRIPTION:
......@@ -911,6 +915,7 @@ STDERR 'TWOD_SENDRECV'
FATAL 'Last action was not WAITING - not ready for sending (3D)'
call MPI_ABORT(active_comm,-1,ierr)
end if
call tic(TIM_HALO3D)
il=imin;ih=imax;jl=jmin;jh=jmax
select case (comm_method)
case(ONE_PROCESS)
......@@ -1066,6 +1071,7 @@ STDERR 'TWOD_NONBLOCKING'
end if
#endif
last_action = SENDING
call toc(TIM_HALO3D)
return
end subroutine update_3d_halo_mpi
!EOC
......@@ -1077,6 +1083,7 @@ STDERR 'TWOD_NONBLOCKING'
!
! !INTERFACE:
SUBROUTINE wait_halo_mpi(tag)
use getm_timers, only: tic, toc, TIM_HALOWAIT
IMPLICIT NONE
!
! !DESCRIPTION:
......@@ -1096,6 +1103,7 @@ STDERR 'TWOD_NONBLOCKING'
FATAL 'Last action was not sending - nothing to wait for'
call MPI_ABORT(active_comm,-1,ierr)
end if
call tic(TIM_HALOWAIT)
select case (comm_method)
case(ONE_PROCESS)
case(ONED_SENDRECV)
......@@ -1113,6 +1121,7 @@ STDERR 'TWOD_NONBLOCKING'
stop 'wait_mpi'
end select
last_action = WAITING
call toc(TIM_HALOWAIT)
return
end subroutine wait_halo_mpi
!EOC
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment