Skip to content

Commit

Permalink
Implement NUOPC Verbosity bits that allow activation of StateLog() on
Browse files Browse the repository at this point in the history
Import- and ExportState on enter/exit of I/R/F methods.
  • Loading branch information
theurich committed Jan 18, 2024
1 parent e98800b commit 2804212
Show file tree
Hide file tree
Showing 9 changed files with 159 additions and 122 deletions.
8 changes: 5 additions & 3 deletions src/addon/NUOPC/doc/NUOPC_ConnectorComponent_metadata.tex
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
{\bf bit 1}: Intro/Extro with memory info.\newline
{\bf bit 2}: Intro/Extro with garbage collection info.\newline
{\bf bit 3}: Intro/Extro with local VM info.\newline
{\bf bit 4}: Intro/Extro with ImportState info.\newline
{\bf bit 5}: Intro/Extro with ExportState info.\newline
{\bf bit 8}: Log FieldTransferPolicy.\newline
{\bf bit 9}: Log bond level info.\newline
{\bf bit 10}: Log CplList construction.\newline
Expand All @@ -23,9 +25,9 @@
{\bf bit 15}: Log info about RouteHandle release.
& 0, 1, 2, ... \newline
"off" = 0 (default), \newline
"low": Some verbosity. \newline
"high": More verbosity. \newline
"max": All lower 16 bits set.\\ \hline
"low": some verbosity, bits: 0, 13\newline
"high": more verbosity, bits: 0, 4, 5, 8, 9, 10, 11, 12, 13, 14, 15\newline
"max": all lower 16 bits\\ \hline
{\tt Profiling} & String value, converted into an integer, and interpreted as a bit field. The lower 16 bits (0-15) are reserved to control profiling of the generic component implementation. Higher bits are available for user level profiling control. \newline
{\bf bit 0}: Top level profiling of {\em Initialize} phases.\newline
{\bf bit 1}: Specialization point profiling of {\em Initialize} phases.\newline
Expand Down
6 changes: 4 additions & 2 deletions src/addon/NUOPC/doc/NUOPC_DriverComponent_metadata.tex
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
{\bf bit 1}: Intro/Extro with memory info.\newline
{\bf bit 2}: Intro/Extro with garbage collection info.\newline
{\bf bit 3}: Intro/Extro with local VM info.\newline
{\bf bit 4}: Log hierarchy protocol details.\newline
{\bf bit 4}: Intro/Extro with ImportState info.\newline
{\bf bit 5}: Intro/Extro with ExportState info.\newline
{\bf bit 6}: Log hierarchy protocol details.\newline
{\bf bit 8}: Log Initialize phase with $>>>$, $<<<$, and currTime.\newline
{\bf bit 9}: Log Run phase with $>>>$, $<<<$, and currTime.\newline
{\bf bit 10}: Log Finalize phase with $>>>$, $<<<$, and currTime.\newline
Expand All @@ -28,7 +30,7 @@
& 0, 1, 2, ... \newline
"off" = 0 (default), \newline
"low": some verbosity, bits: 0, 8, 9, 10, 13\newline
"high": more verbosity, bits: 0, 4, 8, 9, 10, 11, 12, 13, 14\newline
"high": more verbosity, bits: 0, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14\newline
"max": all lower 16 bits\\ \hline
{\tt Profiling} & String value, converted into an integer, and interpreted as a bit field. The lower 16 bits (0-15) are reserved to control profiling of the generic component implementation. Higher bits are available for user level profiling control. \newline
{\bf bit 0}: Top level profiling of {\em Initialize} phases.\newline
Expand Down
10 changes: 5 additions & 5 deletions src/addon/NUOPC/doc/NUOPC_MediatorComponent_metadata.tex
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
{\bf bit 1}: Intro/Extro with memory info.\newline
{\bf bit 2}: Intro/Extro with garbage collection info.\newline
{\bf bit 3}: Intro/Extro with local VM info.\newline
{\bf bit 4}: Intro/Extro with ImportState info.\newline
{\bf bit 5}: Intro/Extro with ExportState info.\newline
{\bf bit 8}: Log Initialize phase with $>>>$, $<<<$, and currTime.\newline
{\bf bit 9}: Log Run phase with $>>>$, $<<<$, and currTime.\newline
{\bf bit 10}: Log Finalize phase with $>>>$, $<<<$, and currTime.\newline
{\bf bit 11}: Log info about data dependency during initialize resolution.\newline
{\bf bit 12}: Log run sequence execution.\newline
{\bf bit 13}: Log Component creation.\newline
{\bf bit 14}: Log State creation.
{\bf bit 12}: Log run sequence execution.
& 0, 1, 2, ... \newline
"off" = 0 (default), \newline
"low": some verbosity, \newline
"high": more verbosity, \newline
"low": some verbosity, bits: 0, 8, 9, 10, 13\newline
"high": more verbosity, bits: 0, 4, 5, 8, 9, 10, 11, 12, 13, 14\newline
"max": all lower 16 bits\\ \hline
{\tt Profiling} & String value, converted into an integer, and interpreted as a bit field. The lower 16 bits (0-15) are reserved to control profiling of the generic component implementation. Higher bits are available for user level profiling control. \newline
{\bf bit 0}: Top level profiling of {\em Initialize} phases.\newline
Expand Down
10 changes: 5 additions & 5 deletions src/addon/NUOPC/doc/NUOPC_ModelComponent_metadata.tex
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@
{\bf bit 1}: Intro/Extro with memory info.\newline
{\bf bit 2}: Intro/Extro with garbage collection info.\newline
{\bf bit 3}: Intro/Extro with local VM info.\newline
{\bf bit 4}: Intro/Extro with ImportState info.\newline
{\bf bit 5}: Intro/Extro with ExportState info.\newline
{\bf bit 8}: Log Initialize phase with $>>>$, $<<<$, and currTime.\newline
{\bf bit 9}: Log Run phase with $>>>$, $<<<$, and currTime.\newline
{\bf bit 10}: Log Finalize phase with $>>>$, $<<<$, and currTime.\newline
{\bf bit 11}: Log info about data dependency during initialize resolution.\newline
{\bf bit 12}: Log run sequence execution.\newline
{\bf bit 13}: Log Component creation.\newline
{\bf bit 14}: Log State creation.
{\bf bit 12}: Log run sequence execution.
& 0, 1, 2, ... \newline
"off" = 0 (default), \newline
"low": some verbosity, \newline
"high": more verbosity, \newline
"low": some verbosity, bits: 0, 8, 9, 10, 13\newline
"high": more verbosity, bits: 0, 4, 5, 8, 9, 10, 11, 12, 13, 14\newline
"max": all lower 16 bits\\ \hline
{\tt Profiling} & String value, converted into an integer, and interpreted as a bit field. The lower 16 bits (0-15) are reserved to control profiling of the generic component implementation. Higher bits are available for user level profiling control. \newline
{\bf bit 0}: Top level profiling of {\em Initialize} phases.\newline
Expand Down
34 changes: 32 additions & 2 deletions src/addon/NUOPC/src/NUOPC_Base.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3172,11 +3172,12 @@ function NUOPC_IsUpdatedState(state, fieldName, count, rc)
!BOPI
! !IROUTINE: NUOPC_LogIntro - Log entering a method
! !INTERFACE:
subroutine NUOPC_LogIntro(name, rName, verbosity, rc)
subroutine NUOPC_LogIntro(name, rName, verbosity, importState, exportState, rc)
! !ARGUMENTS:
character(len=*), intent(in) :: name
character(len=*), intent(in) :: rName
integer, intent(in) :: verbosity
type(ESMF_State), intent(in) :: importState, exportState
integer, intent(out) :: rc
! !DESCRIPTION:
! Write information into Log on entering a method, according to the verbosity
Expand All @@ -3190,6 +3191,10 @@ subroutine NUOPC_LogIntro(name, rName, verbosity, rc)
! Routine name.
! \item[verbosity]
! Bit field corresponding to verbosity aspects.
! \item[importState]
! The importState of the component using this method.
! \item[exportState]
! The exportState of the component using this method.
! \item[rc]
! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
! \end{description}
Expand Down Expand Up @@ -3251,6 +3256,16 @@ subroutine NUOPC_LogIntro(name, rName, verbosity, rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=trim(name)//":"//FILENAME)) return ! bail out
endif
if (btest(verbosity,4)) then
call ESMF_StateLog(importState, trim(name)//": "//rName//" intro:", rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=trim(name)//":"//FILENAME)) return ! bail out
endif
if (btest(verbosity,5)) then
call ESMF_StateLog(exportState, trim(name)//": "//rName//" intro:", rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=trim(name)//":"//FILENAME)) return ! bail out
endif
! return successfully
rc = ESMF_SUCCESS
end subroutine
Expand All @@ -3260,11 +3275,12 @@ subroutine NUOPC_LogIntro(name, rName, verbosity, rc)
!BOPI
! !IROUTINE: NUOPC_LogExtro - Log exiting a method
! !INTERFACE:
subroutine NUOPC_LogExtro(name, rName, verbosity, rc)
subroutine NUOPC_LogExtro(name, rName, verbosity, importState, exportState, rc)
! !ARGUMENTS:
character(len=*), intent(in) :: name
character(len=*), intent(in) :: rName
integer, intent(in) :: verbosity
type(ESMF_State), intent(in) :: importState, exportState
integer, intent(out) :: rc
! !DESCRIPTION:
! Write information into Log on exiting a method, according to the verbosity
Expand All @@ -3278,6 +3294,10 @@ subroutine NUOPC_LogExtro(name, rName, verbosity, rc)
! Routine name.
! \item[verbosity]
! Bit field corresponding to verbosity aspects.
! \item[importState]
! The importState of the component using this method.
! \item[exportState]
! The exportState of the component using this method.
! \item[rc]
! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
! \end{description}
Expand All @@ -3286,6 +3306,16 @@ subroutine NUOPC_LogExtro(name, rName, verbosity, rc)
!-----------------------------------------------------------------------------
! local variables
integer :: indentCount
if (btest(verbosity,4)) then
call ESMF_StateLog(importState, trim(name)//": "//rName//" intro:", rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=trim(name)//":"//FILENAME)) return ! bail out
endif
if (btest(verbosity,5)) then
call ESMF_StateLog(exportState, trim(name)//": "//rName//" intro:", rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, file=trim(name)//":"//FILENAME)) return ! bail out
endif
if (btest(verbosity,2)) then
call ESMF_VMLogGarbageInfo(trim(name)//": "//rName//" extro:", rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
Expand Down
14 changes: 7 additions & 7 deletions src/addon/NUOPC/src/NUOPC_Comp.F90
Original file line number Diff line number Diff line change
Expand Up @@ -2994,16 +2994,16 @@ subroutine NUOPC_GridCompGet(comp, name, verbosity, profiling, diagnostic, rc)
! set component kind specific verbosity levels
if (trim(valueString)=="Driver") then
max = 65535 ! all 16 lower bits set
high = 32529 ! bits 0, 4, 8, 9, 10, 11, 12, 13, 14
low = 9985 ! bits 0, 8, 9, 10, 13
high = 32625 ! bits 0, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14
low = 9985 ! bits 0, 8, 9, 10, 13
else if (trim(valueString)=="Model") then
max = 65535 ! all 16 lower bits set
high = 32513 ! bits 0, 8, 9, 10, 11, 12, 13, 14
low = 9985 ! bits 0, 8, 9, 10, 13
high = 32561 ! bits 0, 4, 5, 8, 9, 10, 11, 12, 13, 14
low = 9985 ! bits 0, 8, 9, 10, 13
else if (trim(valueString)=="Mediator") then
max = 65535 ! all 16 lower bits set
high = 32513 ! bits 0, 8, 9, 10, 11, 12, 13, 14
low = 9985 ! bits 0, 8, 9, 10, 13
high = 32561 ! bits 0, 4, 5, 8, 9, 10, 11, 12, 13, 14
low = 9985 ! bits 0, 8, 9, 10, 13
endif
! query the component for Verbosity
call NUOPC_CompAttributeGet(comp, name="Verbosity", value=valueString, &
Expand Down Expand Up @@ -3098,7 +3098,7 @@ subroutine NUOPC_CplCompGet(comp, name, verbosity, profiling, diagnostic, rc)
verbosity = 0
! set specific verbosity levels
max = 65535 ! all 16 lower bits set
high = 65281 ! bits 0, 8, 9, 10, 11, 12, 13, 14, 15
high = 65329 ! bits 0, 4, 5, 8, 9, 10, 11, 12, 13, 14, 15
low = 8193 ! bits 0, 13
! query the component for Verbosity
call NUOPC_CompAttributeGet(comp, name="Verbosity", value=valueString, &
Expand Down
Loading

0 comments on commit 2804212

Please sign in to comment.