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

ESMF logging and tracing updates around RouteHandle setup #901

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from all 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
56 changes: 47 additions & 9 deletions fv3_cap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -784,8 +784,7 @@ subroutine InitializeAdvertise(gcomp, rc)
endif
endif

call ESMF_LogWrite('bf FieldBundleRegridStore', ESMF_LOGMSG_INFO, rc=rc)
write(msgString,"(A,I2.2,',',I2.2,A)") "calling into wrtFB(",j,i, ") FieldBundleRegridStore()...."
write(msgString,"(A,I2.2,',',I2.2,A)") "RH creation for wrtFB(",j,i, ") ...."//trim(fcstItemNameList(j))
call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc)

if (i==1) then
Expand All @@ -795,11 +794,25 @@ subroutine InitializeAdvertise(gcomp, rc)

if (rh_file_exist .and. use_saved_routehandles) then
if(mype==0) print *,'in fv3cap init, routehandle file ',trim(rh_filename), ' exists'

write(msgString,*) "Calling into ESMF_RouteHandleCreate(from file)...", trim(rh_filename)
call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc)

call ESMF_TraceRegionEnter("ESMF_RouteHandleCreate(from file)", rc=rc)
routehandle(j,1) = ESMF_RouteHandleCreate(fileName=trim(rh_filename), rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
call ESMF_TraceRegionExit("ESMF_RouteHandleCreate(from file)", rc=rc)

write(msgString,*) "... returned from ESMF_RouteHandleCreate(from file)."
call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc)

else
! this is a Store() for the first wrtComp -> must do the Store()
if (fieldbundle_uses_redist) then

write(msgString,*) "Calling into FieldBundleRedistStore..."
call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc)

call ESMF_TraceRegionEnter("ESMF_FieldBundleRedistStore()", rc=rc)
call ESMF_FieldBundleRedistStore(fcstFB(j), wrtFB(j,1), &
routehandle=routehandle(j,1), &
Expand All @@ -810,9 +823,15 @@ subroutine InitializeAdvertise(gcomp, rc)
! call ESMF_Finalize(endflag=ESMF_END_ABORT)
endif
call ESMF_TraceRegionExit("ESMF_FieldBundleRedistStore()", rc=rc)
call ESMF_LogWrite('af FieldBundleRedistStore', ESMF_LOGMSG_INFO, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return

write(msgString,*) "... returned from FieldBundleRedistStore."
call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc)

else

write(msgString,*) "Calling into FieldBundleRegridStore..."
call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc)

call ESMF_TraceRegionEnter("ESMF_FieldBundleRegridStore()", rc=rc)
call ESMF_FieldBundleRegridStore(fcstFB(j), wrtFB(j,1), &
regridMethod=regridmethod, routehandle=routehandle(j,1), &
Expand All @@ -823,14 +842,26 @@ subroutine InitializeAdvertise(gcomp, rc)
call ESMF_Finalize(endflag=ESMF_END_ABORT)
endif
call ESMF_TraceRegionExit("ESMF_FieldBundleRegridStore()", rc=rc)
call ESMF_LogWrite('af FieldBundleRegridStore', ESMF_LOGMSG_INFO, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return

write(msgString,*) "... returned from FieldBundleRegridStore."
call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc)

endif

if (use_saved_routehandles) then

write(msgString,*) "Calling into ESMF_RouteHandleWrite...", trim(rh_filename)
call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc)

call ESMF_TraceRegionEnter("ESMF_RouteHandleWrite()", rc=rc)
call ESMF_RouteHandleWrite(routehandle(j,1), fileName=trim(rh_filename), rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
call ESMF_TraceRegionExit("ESMF_RouteHandleWrite()", rc=rc)
if(mype==0) print *,'in fv3cap init, saved routehandle file ',trim(rh_filename)

write(msgString,*) "... returned from ESMF_RouteHandleWrite."
call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc)

endif

endif
Expand All @@ -841,15 +872,22 @@ subroutine InitializeAdvertise(gcomp, rc)
else
targetPetList(1:num_pes_fcst) = fcstPetList(:)
targetPetList(num_pes_fcst+1:) = petList(:)
call ESMF_TraceRegionEnter("ESMF_RouteHandleCreate() in lieu of ESMF_FieldBundleRegridStore()", rc=rc)

write(msgString,*) "Calling into ESMF_RouteHandleCreate(from RH)..."
call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc)

call ESMF_TraceRegionEnter("ESMF_RouteHandleCreate(from RH) in lieu of ESMF_FieldBundleRegridStore()", rc=rc)
routehandle(j,i) = ESMF_RouteHandleCreate(routehandle(j,1), &
originPetList=originPetList, &
targetPetList=targetPetList, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, line=__LINE__, file=__FILE__)) return
call ESMF_TraceRegionExit("ESMF_RouteHandleCreate() in lieu of ESMF_FieldBundleRegridStore()", rc=rc)
call ESMF_TraceRegionExit("ESMF_RouteHandleCreate(from RH) in lieu of ESMF_FieldBundleRegridStore()", rc=rc)

write(msgString,*) "... returned from ESMF_RouteHandleCreate(from RH)."
call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc)

endif
write(msgString,"(A,I2.2,',',I2.2,A)") "... returned from wrtFB(",j,i, ") FieldBundleRegridStore()."
write(msgString,"(A,I2.2,',',I2.2,A)") "... returned from RH creation for wrtFB(",j,i, ")."
call ESMF_LogWrite(msgString, ESMF_LOGMSG_INFO, rc=rc)
endif
enddo ! j=1, FBcount
Expand Down
Loading