subroutine ESMF_VMEpochEnter(keywordEnforcer, vm, epoch, keepAlloc, throttle, rc)
!
! !ARGUMENTS:
type(ESMF_KeywordEnforcer), optional:: keywordEnforcer ! must use keywords below
type(ESMF_VM), intent(in), optional :: vm
type(ESMF_VMEpoch_Flag), intent(in), optional :: epoch
logical, intent(in), optional :: keepAlloc
integer, intent(in), optional :: throttle
integer, intent(out), optional :: rc
!
! !DESCRIPTION:
! Enter a specific VM epoch. VM epochs change low level communication behavior
! which can have significant performance implications. It is an error to call
! {\tt ESMF\_VMEpochEnter()} again before exiting a previous epoch with
! {\tt ESMF\_VMEpochExit()}.
!
! The arguments are:
! \begin{description}
! \item[{[vm]}]
! {\tt ESMF\_VM} object. Defaults to the current VM.
! \item[{[epoch]}]
! The epoch to be entered. See section \ref{const:vmepoch_flag} for a
! complete list of options. Defaults to {\tt ESMF\_VMEPOCH\_NONE}.
! \item[{[keepAlloc]}]
! For {\tt .true.}, keep internal allocations to be reused by consecutive
! epoch phases. For {\tt .false.}, deallocate all internal buffers not
! actively used.
! The flag only affects the local PET. Defaults to {\tt .true.}.
! \item[{[throttle]}]
! Maximum number of outstanding communication calls beween any two PETs.
! Lower numbers reduce memory pressure at the expense of the level of
! asynchronizity achievable. Defaults to 10.
! \item[{[rc]}]
! Return code; equals {\tt ESMF\_SUCCESS} if there are no errors.
! \end{description}
!
!EOP
!------------------------------------------------------------------------------
integer :: localrc ! local return code
type(ESMF_VM) :: vm_opt
type(ESMF_VMEpoch_Flag) :: epoch_opt
type(ESMF_Logical) :: keepAlloc_opt ! helper variable
! initialize return code; assume routine not implemented
localrc = ESMF_RC_NOT_IMPL
if (present(rc)) rc = ESMF_RC_NOT_IMPL
! deal with optional arguments
if (present(vm)) then
vm_opt = vm
else
call ESMF_VMGetCurrent(vm_opt, rc=localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
endif
keepAlloc_opt = ESMF_TRUE ! default
if (present(keepAlloc)) keepAlloc_opt = keepAlloc
if (present(epoch)) then
epoch_opt = epoch
else
epoch_opt = ESMF_VMEPOCH_NONE
endif
! Check init status of arguments
ESMF_INIT_CHECK_DEEP(ESMF_VMGetInit, vm_opt, rc)
! Call into the C++ interface
call c_ESMC_VMEpochEnter(vm_opt, epoch_opt, keepAlloc_opt, throttle, &
localrc)
if (ESMF_LogFoundError(localrc, ESMF_ERR_PASSTHRU, &
ESMF_CONTEXT, rcToReturn=rc)) return
! return successfully
if (present(rc)) rc = ESMF_SUCCESS
end subroutine ESMF_VMEpochEnter