Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add run time info and upp #678

Merged
merged 15 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[submodule "atmos_cubed_sphere"]
path = atmos_cubed_sphere
url = https://github.com/NOAA-GFDL/GFDL_atmos_cubed_sphere
branch = dev/emc
#url = https://github.com/NOAA-GFDL/GFDL_atmos_cubed_sphere
#branch = dev/emc
url = https://github.com/junwang-noaa/GFDL_atmos_cubed_sphere
branch = missingvalue
[submodule "ccpp/framework"]
path = ccpp/framework
url = https://github.com/NCAR/ccpp-framework
Expand Down
2 changes: 1 addition & 1 deletion atmos_cubed_sphere
46 changes: 34 additions & 12 deletions fv3_cap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,15 @@ module fv3atm_cap_mod
logical, allocatable :: is_moving_FB(:)

logical :: profile_memory = .true.
logical :: lprint = .false.

integer :: mype = -1
integer :: dbug = 0
integer :: frestart(999) = -1

real(kind=8) :: timers, timere
real(kind=8) :: timep1rs, timep1re
real(kind=8) :: timep2rs, timep2re
!-----------------------------------------------------------------------

contains
Expand Down Expand Up @@ -211,8 +215,6 @@ subroutine InitializeAdvertise(gcomp, rc)
logical :: use_saved_routehandles, rh_file_exist
logical :: fieldbundle_is_restart = .false.

integer :: sloc
type(ESMF_StaggerLoc) :: staggerloc
junwang-noaa marked this conversation as resolved.
Show resolved Hide resolved
!
!------------------------------------------------------------------------
!
Expand Down Expand Up @@ -347,6 +349,7 @@ subroutine InitializeAdvertise(gcomp, rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return

first_kdt = 1
if( mype == 0) lprint = .true.
!
!#######################################################################
! set up fcst grid component
Expand Down Expand Up @@ -486,6 +489,7 @@ subroutine InitializeAdvertise(gcomp, rc)
enddo
k = k + wrttasks_per_group_from_parent
last_wrttask(i) = k - 1
if( mype == lead_wrttask(i) ) lprint = .true.
! if(mype==0)print *,'af wrtComp(i)=',i,'k=',k

! prepare name of the wrtComp(i)
Expand Down Expand Up @@ -636,12 +640,7 @@ subroutine InitializeAdvertise(gcomp, rc)
dstGrid(j,i) = grid
! loop over all the mirror fields and set the balanced mirror Grid
do ii=1, fieldCount
call ESMF_InfoGetFromHost(fieldList(ii), info=info, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
call ESMF_InfoGet(info, key="staggerloc", value=sloc, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
staggerloc = sloc ! convert integer into StaggerLoc_Flag
call ESMF_FieldEmptySet(fieldList(ii), grid=grid, staggerloc=staggerloc, rc=rc)
junwang-noaa marked this conversation as resolved.
Show resolved Hide resolved
call ESMF_FieldEmptySet(fieldList(ii), grid=grid, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
enddo
! clean-up
Expand Down Expand Up @@ -970,8 +969,7 @@ subroutine InitializeAdvertise(gcomp, rc)

if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__, rcToReturn=rc)) return

if(mype==0) print *,'in fv3_cap, aft import, export fields in atmos'
if(mype==0) print *,'in fv3_cap, init time=',MPI_Wtime()-timeis
if(lprint) print *,'in fv3_cap, init time=',MPI_Wtime()-timeis,mype
!-----------------------------------------------------------------------
!
end subroutine InitializeAdvertise
Expand All @@ -988,7 +986,10 @@ subroutine InitializeRealize(gcomp, rc)
type(ESMF_State) :: importState, exportState
integer :: urc

real(8) :: MPI_Wtime, timeirs

rc = ESMF_SUCCESS
timeirs = MPI_Wtime()

! query for importState and exportState
call NUOPC_ModelGet(gcomp, driverClock=clock, importState=importState, exportState=exportState, rc=rc)
Expand All @@ -1003,6 +1004,11 @@ subroutine InitializeRealize(gcomp, rc)

if (ESMF_LogFoundError(rcToCheck=urc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__, rcToReturn=rc)) return

timers = 0.
timere = 0.
junwang-noaa marked this conversation as resolved.
Show resolved Hide resolved

if(lprint) print *,'in fv3_cap, initirealz time=',MPI_Wtime()-timeirs,mype

end subroutine InitializeRealize

!-----------------------------------------------------------------------------
Expand All @@ -1011,10 +1017,13 @@ subroutine ModelAdvance(gcomp, rc)

type(ESMF_GridComp) :: gcomp
integer, intent(out) :: rc
real(kind=8) :: MPI_Wtime

!-----------------------------------------------------------------------------

rc = ESMF_SUCCESS
timers = MPI_Wtime()
if(lprint) print *,'in FV3 cap, time between fv3 run step=', timers-timere,mype
junwang-noaa marked this conversation as resolved.
Show resolved Hide resolved

if (profile_memory) call ESMF_VMLogMemInfo("Entering FV3 ModelAdvance: ")

Expand All @@ -1026,6 +1035,9 @@ subroutine ModelAdvance(gcomp, rc)

if (profile_memory) call ESMF_VMLogMemInfo("Leaving FV3 ModelAdvance: ")

timere = MPI_Wtime()
if(lprint) print *,'in FV3 cap, time in fv3 run step=', timere-timers, mype
junwang-noaa marked this conversation as resolved.
Show resolved Hide resolved

end subroutine ModelAdvance

!-----------------------------------------------------------------------------
Expand All @@ -1040,10 +1052,13 @@ subroutine ModelAdvance_phase1(gcomp, rc)
logical :: fcstpe
character(len=*),parameter :: subname='(fv3_cap:ModelAdvance_phase1)'
character(240) :: msgString
real(kind=8) :: MPI_Wtime

!-----------------------------------------------------------------------------

rc = ESMF_SUCCESS
timep1rs = MPI_Wtime()
if(lprint) print *,'in fv3_cap,modeladvance phase1 time ', timep1rs-timep2re,mype
junwang-noaa marked this conversation as resolved.
Show resolved Hide resolved

if(profile_memory) call ESMF_VMLogMemInfo("Entering FV3 ModelAdvance_phase1: ")

Expand Down Expand Up @@ -1073,6 +1088,8 @@ subroutine ModelAdvance_phase1(gcomp, rc)
call diagnose_cplFields(gcomp, clock, fcstpe, cplprint_flag, dbug, 'import')
endif

timep1re = MPI_Wtime()
if(lprint) print *,'in fv3_cap,modeladvance phase1 time ', timep1re-timep1rs,mype
if (profile_memory) call ESMF_VMLogMemInfo("Leaving FV3 ModelAdvance_phase1: ")

end subroutine ModelAdvance_phase1
Expand All @@ -1098,9 +1115,12 @@ subroutine ModelAdvance_phase2(gcomp, rc)

type(ESMF_Clock) :: clock, clock_out

real(kind=8) :: MPI_Wtime

!-----------------------------------------------------------------------------

rc = ESMF_SUCCESS
timep2rs = MPI_Wtime()

if(profile_memory) call ESMF_VMLogMemInfo("Entering FV3 ModelAdvance_phase2: ")

Expand Down Expand Up @@ -1199,6 +1219,8 @@ subroutine ModelAdvance_phase2(gcomp, rc)
call diagnose_cplFields(gcomp, clock_out, fcstpe, cplprint_flag, dbug, 'export')
end if

timep2re = MPI_Wtime()
if(lprint) print *,'in fv3_cap,modeladvance phase2 time ', timep2re-timep2rs, mype
if(profile_memory) call ESMF_VMLogMemInfo("Leaving FV3 ModelAdvance_phase2: ")

end subroutine ModelAdvance_phase2
Expand Down Expand Up @@ -1373,8 +1395,8 @@ subroutine ModelFinalize(gcomp, rc)
!-----------------------------------------------------------------------------
!*** finialize forecast

timeffs = MPI_Wtime()
rc = ESMF_SUCCESS
timeffs = MPI_Wtime()
!
call ESMF_GridCompGet(gcomp,vm=vm,rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
Expand Down Expand Up @@ -1407,7 +1429,7 @@ subroutine ModelFinalize(gcomp, rc)
call ESMF_GridCompDestroy(fcstComp, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
!
if(mype==0)print *,' wrt grid comp destroy time=',MPI_Wtime()-timeffs
if(lprint)print *,'in fv3_cap, finalize time=',MPI_Wtime()-timeffs, mype

end subroutine ModelFinalize
!
Expand Down
2 changes: 1 addition & 1 deletion io/module_wrt_grid_comp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2158,7 +2158,7 @@ subroutine wrt_run(wrt_comp, imp_state_write, exp_state_write,clock,rc)
endif
call mpi_bcast(kchunk3d(grid_id),1,mpi_integer,0,wrt_mpi_comm,rc)
endif
if (wrt_int_state%mype == 0) then
if (lprnt) then
print *,'ichunk2d,jchunk2d',ichunk2d(grid_id),jchunk2d(grid_id)
print *,'ichunk3d,jchunk3d,kchunk3d',ichunk3d(grid_id),jchunk3d(grid_id),kchunk3d(grid_id)
endif
Expand Down