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

Added log entries for stage start/finish in MAPL.GENERIC #1009

Closed
Closed
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Added log entries for stage start/finish in MAPL.GENERIC

### Changed

### Fixed
Expand Down
19 changes: 16 additions & 3 deletions base/MAPL_Generic.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1743,6 +1743,8 @@ subroutine MAPL_GenericWrapper ( GC, IMPORT, EXPORT, CLOCK, RC)
character(len=12), target :: timers_run(2) = &
[character(len=12):: 'GenRunTot','--GenRunMine']
character(len=12) :: sbrtn
character(len=ESMF_MAXSTR) :: stage_description
class(Logger), pointer :: lgr => null()


!=============================================================================
Expand All @@ -1761,6 +1763,8 @@ subroutine MAPL_GenericWrapper ( GC, IMPORT, EXPORT, CLOCK, RC)
_VERIFY(STATUS)
Iam = trim(COMP_NAME) // trim(Iam)

lgr => logging%get_logger('MAPL.GENERIC')

call ESMF_VmGetCurrent(VM)
! Retrieve the pointer to the internal state. It comes in a wrapper.
! ------------------------------------------------------------------
Expand Down Expand Up @@ -1807,6 +1811,7 @@ subroutine MAPL_GenericWrapper ( GC, IMPORT, EXPORT, CLOCK, RC)
NULLIFY(timers)
sbrtn = 'WriteRestart'
endif MethodBlock
stage_description = ''''//trim(sbrtn)//''' stage of the gridded component '''//trim(COMP_NAME)//''''
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. I did not know that triple/quad quotes would do this.


! TIMERS on
call t_p%start(trim(state%compname),__RC__)
Expand All @@ -1831,13 +1836,14 @@ subroutine MAPL_GenericWrapper ( GC, IMPORT, EXPORT, CLOCK, RC)
end IF
#endif


call lgr%info('Started the %a', trim(stage_description))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
call lgr%info('Started the %a', trim(stage_description))
call lgr%info('Started the %a', stage_description)

call func_ptr (GC, &
importState=IMPORT, &
exportState=EXPORT, &
clock=CLOCK, PHASE=PHASE_, &
userRC=userRC, RC=STATUS )
_ASSERT(userRC==ESMF_SUCCESS .and. STATUS==ESMF_SUCCESS,'needs informative message')
_ASSERT(userRC==ESMF_SUCCESS .and. STATUS==ESMF_SUCCESS,'Error during the '//trim(stage_description))
call lgr%info('Finished the %a', trim(stage_description))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
call lgr%info('Finished the %a', trim(stage_description))
call lgr%info('Finished the %a', stage_description)


! TIMERS off
if (associated(timers)) then
Expand Down Expand Up @@ -4548,6 +4554,7 @@ recursive integer function MAPL_AddChildFromMeta(META, NAME, GRID, &
class(AbstractFrameworkComponent), pointer :: tmp_framework
character(len=ESMF_MAXSTR), allocatable :: TMPNL(:)
character(len=ESMF_MAXSTR) :: FNAME, PNAME
character(len=ESMF_MAXSTR) :: stage_description
type(ESMF_GridComp) :: pGC
type(ESMF_Context_Flag) :: contextFlag
class(BaseProfiler), pointer :: t_p
Expand Down Expand Up @@ -4669,11 +4676,17 @@ recursive integer function MAPL_AddChildFromMeta(META, NAME, GRID, &

t_p => get_global_time_profiler()

stage_description = '''SetServices'' stage of the gridded component '''//trim(FNAME)//''''

call t_p%start(trim(NAME),__RC__)
call CHILD_META%t_profiler%start(__RC__)
call CHILD_META%t_profiler%start('SetService',__RC__)
gridcomp => META%GET_CHILD_GRIDCOMP(I)
call ESMF_GridCompSetServices ( gridcomp, SS, RC=status )
call lgr%info("Started the %a", trim(stage_description))
call ESMF_GridCompSetServices ( gridcomp, SS, userRC=SS_STATUS, RC=status )
_VERIFY(STATUS)
_VERIFY(SS_STATUS)
call lgr%info("Finished the %a", trim(stage_description))
call CHILD_META%t_profiler%stop('SetService',__RC__)
call CHILD_META%t_profiler%stop(__RC__)
call t_p%stop(trim(NAME),__RC__)
Expand Down