From b1eefc22eb369abe2ab46cde7e3c3bed163e563d Mon Sep 17 00:00:00 2001 From: ckoven Date: Fri, 14 Aug 2020 09:49:06 -0600 Subject: [PATCH] added timing calls to all subroutines in clmfates_interfaceMod.F90 --- src/utils/clmfates_interfaceMod.F90 | 106 ++++++++++++++++++++++++++-- 1 file changed, 102 insertions(+), 4 deletions(-) diff --git a/src/utils/clmfates_interfaceMod.F90 b/src/utils/clmfates_interfaceMod.F90 index 0b044f930b..e0215c416b 100644 --- a/src/utils/clmfates_interfaceMod.F90 +++ b/src/utils/clmfates_interfaceMod.F90 @@ -147,7 +147,7 @@ module CLMFatesInterfaceMod use dynHarvestMod , only : dynHarvest_interp_resolve_harvesttypes use FatesConstantsMod , only : hlm_harvest_area_fraction use FatesConstantsMod , only : hlm_harvest_carbon - + use perf_mod , only : t_startf, t_stopf implicit none type, public :: f2hmap_type @@ -265,6 +265,9 @@ subroutine CLMFatesGlobals() integer :: pass_cohort_age_tracking integer :: pass_biogeog + + call t_startf('fates_globals') + if (use_fates) then verbose_output = .false. @@ -401,6 +404,8 @@ subroutine CLMFatesGlobals() ! it will return some nominal dimension sizes of 1 call SetFatesGlobalElements(use_fates) + + call t_stopf('fates_globals') return end subroutine CLMFatesGlobals @@ -458,6 +463,8 @@ subroutine init(this, bounds_proc ) ! 1) allocate the vectors ! 2) add the history variables defined in clm_inst to the history machinery + + call t_startf('fates_init') ! Parameter Routines call param_derived%Init( numpft_fates ) @@ -618,6 +625,8 @@ subroutine init(this, bounds_proc ) ! Fire data to send to FATES call create_fates_fire_data_method( this%fates_fire_data_method ) + call t_stopf('fates_init') + end subroutine init ! =================================================================================== @@ -637,6 +646,8 @@ subroutine check_hlm_active(this, nc, bounds_clump) ! local variables integer :: c + call t_startf('fates_check_hlm_active') + do c = bounds_clump%begc,bounds_clump%endc ! FATES ACTIVE BUT HLM IS NOT @@ -654,6 +665,8 @@ subroutine check_hlm_active(this, nc, bounds_clump) end if end do + call t_stopf('fates_check_hlm_active') + end subroutine check_hlm_active ! ------------------------------------------------------------------------------------ @@ -712,6 +725,9 @@ subroutine dynamics_driv(this, nc, bounds_clump, & ! and it keeps all the boundaries in one location ! --------------------------------------------------------------------------------- + + call t_startf('fates_dynamics_daily_driver') + begg = bounds_clump%begg; endg = bounds_clump%endg ! Set the FATES global time and date variables @@ -878,6 +894,7 @@ subroutine dynamics_driv(this, nc, bounds_clump, & bounds_clump%endg end if + call t_stopf('fates_dynamics_daily_driver') return end subroutine dynamics_driv @@ -906,6 +923,8 @@ subroutine wrap_update_hlmfates_dyn(this, nc, bounds_clump, & integer :: s ! site index integer :: c ! column index + call t_startf('fates_wrap_update_hlmfates_dyn') + associate( & tlai => canopystate_inst%tlai_patch , & elai => canopystate_inst%elai_patch , & @@ -1036,6 +1055,9 @@ subroutine wrap_update_hlmfates_dyn(this, nc, bounds_clump, & end do end associate + + call t_stopf('fates_wrap_update_hlmfates_dyn') + end subroutine wrap_update_hlmfates_dyn ! ==================================================================================== @@ -1096,6 +1118,7 @@ subroutine restart( this, bounds_proc, ncid, flag, waterdiagnosticbulk_inst, & logical, save :: initialized = .false. + call t_startf('fates_restart') nclumps = get_proc_clumps() @@ -1338,6 +1361,8 @@ subroutine restart( this, bounds_proc, ncid, flag, waterdiagnosticbulk_inst, & !$OMP END PARALLEL DO end if + + call t_stopf('fates_restart') return end subroutine restart @@ -1367,6 +1392,7 @@ subroutine init_coldstart(this, waterstatebulk_inst, waterdiagnosticbulk_inst, & integer :: s integer :: c + call t_startf('fates_initcoldstart') ! Set the FATES global time and date variables call GetAndSetTime @@ -1455,6 +1481,8 @@ subroutine init_coldstart(this, waterstatebulk_inst, waterdiagnosticbulk_inst, & end do !$OMP END PARALLEL DO + call t_stopf('fates_initcoldstart') + end subroutine init_coldstart ! ====================================================================================== @@ -1493,6 +1521,8 @@ subroutine wrap_sunfrac(this,nc,atm2lnd_inst,canopystate_inst) type(ed_patch_type), pointer :: cpatch ! c"urrent" patch INTERF-TODO: SHOULD ! BE HIDDEN AS A FATES PRIVATE + call t_startf('fates_wrapsunfrac') + associate( forc_solad => atm2lnd_inst%forc_solad_grc, & forc_solai => atm2lnd_inst%forc_solai_grc, & fsun => canopystate_inst%fsun_patch, & @@ -1546,6 +1576,8 @@ subroutine wrap_sunfrac(this,nc,atm2lnd_inst,canopystate_inst) end associate + call t_stopf('fates_wrapsunfrac') + end subroutine wrap_sunfrac ! =================================================================================== @@ -1569,6 +1601,8 @@ subroutine prep_canopyfluxes(this, nc, fn, filterp, photosyns_inst) ! parameters integer,parameter :: rsmax0 = 2.e4_r8 + call t_startf('fates_prepcanfluxes') + do s = 1, this%fates(nc)%nsites ! filter flag == 1 means that this patch has not been called for photosynthesis this%fates(nc)%bc_in(s)%filter_photo_pa(:) = 1 @@ -1580,6 +1614,9 @@ subroutine prep_canopyfluxes(this, nc, fn, filterp, photosyns_inst) end if end do + + call t_stopf('fates_prepcanfluxes') + end subroutine prep_canopyfluxes ! ==================================================================================== @@ -1622,6 +1659,8 @@ subroutine wrap_btran(this,nc,fn,filterc,soilstate_inst, & integer :: p integer :: nlevsoil + call t_startf('fates_wrapbtran') + associate(& sucsat => soilstate_inst%sucsat_col , & ! Input: [real(r8) (:,:) ] minimum soil suction (mm) watsat => soilstate_inst%watsat_col , & ! Input: [real(r8) (:,:) ] volumetric soil water at saturation (porosity) @@ -1751,6 +1790,8 @@ subroutine wrap_btran(this,nc,fn,filterc,soilstate_inst, & end do end associate + call t_stopf('fates_wrapbtran') + end subroutine wrap_btran ! ==================================================================================== @@ -1765,7 +1806,6 @@ subroutine wrap_photosynthesis(this, nc, bounds, fn, filterp, & use clm_varcon , only : rgas, tfrz, namep use clm_varctl , only : iulog use pftconMod , only : pftcon - use perf_mod , only : t_startf, t_stopf use PatchType , only : patch use quadraticMod , only : quadratic use EDTypesMod , only : dinc_ed @@ -1793,7 +1833,8 @@ subroutine wrap_photosynthesis(this, nc, bounds, fn, filterp, & integer :: s,c,p,ifp,j,icp real(r8) :: dtime - call t_startf('edpsn') + call t_startf('fates_psn') + associate(& t_soisno => temperature_inst%t_soisno_col , & t_veg => temperature_inst%t_veg_patch , & @@ -1878,7 +1919,8 @@ subroutine wrap_photosynthesis(this, nc, bounds, fn, filterp, & end do end associate - call t_stopf('edpsn') + + call t_stopf('fates_psn') end subroutine wrap_photosynthesis @@ -1895,6 +1937,7 @@ subroutine wrap_accumulatefluxes(this, nc, fn, filterp) integer :: s,c,p,ifp,icp real(r8) :: dtime + call t_startf('fates_wrapaccfluxes') ! Run a check on the filter do icp = 1,fn @@ -1921,6 +1964,8 @@ subroutine wrap_accumulatefluxes(this, nc, fn, filterp) this%fates(nc)%sites, & dtime) + call t_stopf('fates_wrapaccfluxes') + end subroutine wrap_accumulatefluxes ! ====================================================================================== @@ -1943,6 +1988,8 @@ subroutine wrap_canopy_radiation(this, bounds_clump, nc, & ! locals integer :: s,c,p,ifp,icp + call t_startf('fates_wrapcanopyradiation') + associate(& albgrd_col => surfalb_inst%albgrd_col , & !in albgri_col => surfalb_inst%albgri_col , & !in @@ -2007,6 +2054,8 @@ subroutine wrap_canopy_radiation(this, bounds_clump, nc, & end associate + call t_stopf('fates_wrapcanopyradiation') + end subroutine wrap_canopy_radiation ! ====================================================================================== @@ -2026,6 +2075,8 @@ subroutine wrap_bgc_summary(this, nc, soilbiogeochem_carbonflux_inst, & real(r8) :: dtime integer :: s,c + call t_startf('fates_wrapbgcsummary') + associate(& hr => soilbiogeochem_carbonflux_inst%hr_col, & ! (gC/m2/s) total heterotrophic respiration totsomc => soilbiogeochem_carbonstate_inst%totsomc_col, & ! (gC/m2) total soil organic matter carbon @@ -2049,6 +2100,9 @@ subroutine wrap_bgc_summary(this, nc, soilbiogeochem_carbonflux_inst, & dtime) end associate + + call t_stopf('fates_wrapbgcsummary') + end subroutine wrap_bgc_summary ! ====================================================================================== @@ -2069,6 +2123,8 @@ subroutine TransferZ0mDisp(this, bounds_clump, z0m_patch, displa_patch) integer :: ifp ! Fates patch index integer :: p ! CLM patch index + call t_startf('fates_transferz0disp') + SHR_ASSERT_FL((ubound(z0m_patch, 1) == bounds_clump%endp), sourcefile, __LINE__) SHR_ASSERT_FL((ubound(displa_patch, 1) == bounds_clump%endp), sourcefile, __LINE__) @@ -2087,6 +2143,8 @@ subroutine TransferZ0mDisp(this, bounds_clump, z0m_patch, displa_patch) end do end do + call t_stopf('fates_transferz0disp') + return end subroutine TransferZ0mDisp @@ -2121,8 +2179,12 @@ subroutine InterpFileInputs(this, bounds) character(len=*), parameter :: subname = 'InterpFileInputs' !----------------------------------------------------------------------- + call t_startf('fates_interpfileinputs') + call this%fates_fire_data_method%CNFireInterp(bounds) + call t_stopf('fates_interpfileinputs') + end subroutine InterpFileInputs !----------------------------------------------------------------------- @@ -2145,8 +2207,12 @@ subroutine Init2(this, bounds, NLFilename) character(len=*), parameter :: subname = 'Init2' !----------------------------------------------------------------------- + call t_startf('fates_init2') + call this%fates_fire_data_method%CNFireInit(bounds, NLFilename) + call t_stopf('fates_init2') + end subroutine Init2 !----------------------------------------------------------------------- @@ -2166,8 +2232,12 @@ subroutine InitAccBuffer(this, bounds) character(len=*), parameter :: subname = 'InitAccBuffer' !----------------------------------------------------------------------- + call t_startf('fates_initaccbuff') + call this%fates_fire_data_method%InitAccBuffer( bounds ) + call t_stopf('fates_initaccbuff') + end subroutine InitAccBuffer @@ -2188,8 +2258,12 @@ subroutine InitAccVars(this, bounds) character(len=*), parameter :: subname = 'InitAccVars' !----------------------------------------------------------------------- + call t_startf('fates_initaccvars') + call this%fates_fire_data_method%InitAccVars( bounds ) + call t_stopf('fates_initaccvars') + end subroutine InitAccVars !----------------------------------------------------------------------- @@ -2209,8 +2283,12 @@ subroutine UpdateAccVars(this, bounds) character(len=*), parameter :: subname = 'UpdateAccVars' !----------------------------------------------------------------------- + call t_startf('fates_updateaccvars') + call this%fates_fire_data_method%UpdateAccVars( bounds ) + call t_stopf('fates_updateaccvars') + end subroutine UpdateAccVars ! ====================================================================================== @@ -2252,6 +2330,8 @@ subroutine init_history_io(this,bounds_proc) type(fates_bounds_type) :: fates_bounds type(fates_bounds_type) :: fates_clump + call t_startf('fates_inithistoryio') + ! This routine initializes the types of output variables ! not the variables themselves, just the types ! --------------------------------------------------------------------------------- @@ -2386,6 +2466,9 @@ subroutine init_history_io(this,bounds_proc) end associate end do + + call t_stopf('fates_inithistoryio') + end subroutine init_history_io ! ====================================================================================== @@ -2403,6 +2486,7 @@ subroutine init_soil_depths(this, nc) integer :: nlevsoil integer :: nlevdecomp + call t_startf('fates_initsoildepths') do s = 1, this%fates(nc)%nsites c = this%f2hmap(nc)%fcolumn(s) @@ -2437,6 +2521,8 @@ subroutine init_soil_depths(this, nc) end do + call t_stopf('fates_initsoildepths') + return end subroutine init_soil_depths @@ -2463,6 +2549,8 @@ subroutine ComputeRootSoilFlux(this, bounds_clump, num_filterc, filterc, & if( .not. use_fates_planthydro ) return + call t_startf('fates_rootsoilflux') + nc = bounds_clump%clump_index ! Perform a check that the number of columns submitted to fates for @@ -2495,6 +2583,8 @@ subroutine ComputeRootSoilFlux(this, bounds_clump, num_filterc, filterc, & end do + + call t_stopf('fates_rootsoilflux') end subroutine ComputeRootSoilFlux @@ -2560,6 +2650,7 @@ subroutine wrap_hydraulics_drive(this, bounds_clump, nc, & if ( .not.use_fates_planthydro ) return + call t_startf('fates_wraphydrodriv') dtime = get_step_size_real() @@ -2634,6 +2725,7 @@ subroutine wrap_hydraulics_drive(this, bounds_clump, nc, & this%fates(nc)%bc_in, & dtime) + call t_stopf('fates_wraphydrodriv') return end subroutine wrap_hydraulics_drive @@ -2656,6 +2748,8 @@ subroutine hlm_bounds_to_fates_bounds(hlm, fates) type(bounds_type), intent(in) :: hlm type(fates_bounds_type), intent(out) :: fates + call t_startf('fates_hlm2fatesbnds') + fates%cohort_begin = hlm%begcohort fates%cohort_end = hlm%endcohort @@ -2725,6 +2819,7 @@ subroutine hlm_bounds_to_fates_bounds(hlm, fates) fates%elage_begin = 1 fates%elage_end = num_elements * nlevage + call t_stopf('fates_hlm2fatesbnds') end subroutine hlm_bounds_to_fates_bounds @@ -2757,6 +2852,7 @@ subroutine GetAndSetTime() real(r8) :: model_day real(r8) :: day_of_year + call t_startf('fates_getandsettime') ! Get the current date and determine the set the start of the current year call get_curr_date(current_year,current_month,current_day,current_tod) @@ -2783,6 +2879,8 @@ subroutine GetAndSetTime() model_day, floor(day_of_year), & days_per_year, 1.0_r8/dble(days_per_year)) + call t_stopf('fates_getandsettime') + end subroutine GetAndSetTime end module CLMFatesInterfaceMod