Skip to content

Commit

Permalink
replace esmf_logmsg_error with calls to shr_abort
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Jan 23, 2025
1 parent 4b636c6 commit 8a2a3c2
Show file tree
Hide file tree
Showing 14 changed files with 196 additions and 420 deletions.
71 changes: 28 additions & 43 deletions cesm/driver/esm_time_mod.F90
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module esm_time_mod

use shr_kind_mod , only : cx=>shr_kind_cx, cs=>shr_kind_cs, cl=>shr_kind_cl, r8=>shr_kind_r8
use shr_sys_mod , only : shr_sys_abort
use ESMF , only : ESMF_GridComp, ESMF_GridCompGet, ESMF_GridCompSet
use ESMF , only : ESMF_Clock, ESMF_ClockCreate, ESMF_ClockGet, ESMF_ClockSet
use ESMF , only : ESMF_ClockAdvance
Expand All @@ -9,7 +10,7 @@ module esm_time_mod
use ESMF , only : ESMF_CALKIND_NOLEAP, ESMF_CALKIND_GREGORIAN
use ESMF , only : ESMF_Time, ESMF_TimeGet, ESMF_TimeSet
use ESMF , only : ESMF_TimeInterval, ESMF_TimeIntervalSet, ESMF_TimeIntervalGet
use ESMF , only : ESMF_SUCCESS, ESMF_LogWrite, ESMF_LOGMSG_INFO, ESMF_FAILURE, ESMF_LOGMSG_ERROR
use ESMF , only : ESMF_SUCCESS, ESMF_LogWrite, ESMF_LOGMSG_INFO, ESMF_FAILURE
use ESMF , only : ESMF_VM, ESMF_VMGet, ESMF_VMBroadcast
use ESMF , only : ESMF_VMAllReduce, ESMF_REDUCE_MAX, ESMF_ClockGetAlarm
use ESMF , only : ESMF_LOGMSG_INFO, ESMF_FAILURE, ESMF_GridCompIsPetLocal
Expand Down Expand Up @@ -140,26 +141,20 @@ subroutine esm_time_clockinit(ensemble_driver, instance_driver, logunit, maintas
write(logunit,*) " read rpointer file = "//trim(restart_pfile)
inquire( file=trim(restart_pfile), exist=exists)
if (.not. exists) then
rc = ESMF_FAILURE
call ESMF_LogWrite(trim(subname)//' ERROR rpointer file '//trim(restart_pfile)//' not found', &
ESMF_LOGMSG_ERROR, line=__LINE__, file=__FILE__)
return
call shr_sys_abort(trim(subname)//' ERROR rpointer file '//trim(restart_pfile)//' not found',&
line=__LINE__, file=__FILE__)
endif
call ESMF_LogWrite(trim(subname)//" read rpointer file = "//trim(restart_pfile), &
ESMF_LOGMSG_INFO)
open(newunit=unitn, file=restart_pfile, form='FORMATTED', status='old',iostat=ierr)
if (ierr < 0) then
rc = ESMF_FAILURE
call ESMF_LogWrite(trim(subname)//' ERROR rpointer file open returns error', &
ESMF_LOGMSG_ERROR, line=__LINE__, file=__FILE__)
return
call shr_sys_abort(trim(subname)//' ERROR rpointer file open returns error', &
line=__LINE__, file=__FILE__)
end if
read(unitn,'(a)', iostat=ierr) restart_file
if (ierr < 0) then
rc = ESMF_FAILURE
call ESMF_LogWrite(trim(subname)//' ERROR rpointer file read returns error', &
ESMF_LOGMSG_INFO, line=__LINE__, file=__FILE__)
return
call shr_sys_abort(trim(subname)//' ERROR rpointer file read returns error', &
line=__LINE__, file=__FILE__)
end if
close(unitn)
if (maintask) then
Expand Down Expand Up @@ -372,68 +367,58 @@ subroutine esm_time_read_restart(restart_file, start_ymd, start_tod, curr_ymd, c
rc = ESMF_SUCCESS
status = nf90_open(restart_file, NF90_NOWRITE, ncid)
if (status /= nf90_NoErr) then
call ESMF_LogWrite(trim(subname)//' ERROR: nf90_open: '//trim(restart_file), ESMF_LOGMSG_ERROR)
rc = ESMF_FAILURE
return
call shr_sys_abort(trim(subname)//' ERROR: nf90_open: '//trim(restart_file),&
file=__FILE__, line=__LINE__)
endif

status = nf90_inq_varid(ncid, 'start_ymd', varid)
if (status /= nf90_NoErr) then
call ESMF_LogWrite(trim(subname)//' ERROR: nf90_inq_varid start_ymd', ESMF_LOGMSG_ERROR)
rc = ESMF_FAILURE
return
call shr_sys_abort(trim(subname)//' ERROR: nf90_inq_varid start_ymd', &
file=__FILE__, line=__LINE__)
end if
status = nf90_get_var(ncid, varid, start_ymd)
if (status /= nf90_NoErr) then
call ESMF_LogWrite(trim(subname)//' ERROR: nf90_get_var start_ymd', ESMF_LOGMSG_ERROR)
rc = ESMF_FAILURE
return
call shr_sys_abort(trim(subname)//' ERROR: nf90_get_var start_ymd', &
file=__FILE__, line=__LINE__)
end if

status = nf90_inq_varid(ncid, 'start_tod', varid)
if (status /= nf90_NoErr) then
call ESMF_LogWrite(trim(subname)//' ERROR: nf90_inq_varid start_tod', ESMF_LOGMSG_ERROR)
rc = ESMF_FAILURE
return
call shr_sys_abort(trim(subname)//' ERROR: nf90_inq_varid start_tod', &
file=__FILE__, line=__LINE__)
end if
status = nf90_get_var(ncid, varid, start_tod)
if (status /= nf90_NoErr) then
call ESMF_LogWrite(trim(subname)//' ERROR: nf90_get_var start_tod', ESMF_LOGMSG_ERROR)
rc = ESMF_FAILURE
return
call shr_sys_abort(trim(subname)//' ERROR: nf90_get_var start_tod', &
file=__FILE__, line=__LINE__)
end if

status = nf90_inq_varid(ncid, 'curr_ymd', varid)
if (status /= nf90_NoErr) then
call ESMF_LogWrite(trim(subname)//' ERROR: nf90_inq_varid curr_ymd', ESMF_LOGMSG_ERROR)
rc = ESMF_FAILURE
return
call shr_sys_abort(trim(subname)//' ERROR: nf90_inq_varid curr_ymd', &
file=__FILE__, line=__LINE__)
end if
status = nf90_get_var(ncid, varid, curr_ymd)
if (status /= nf90_NoErr) then
call ESMF_LogWrite(trim(subname)//' ERROR: nf90_get_var curr_ymd', ESMF_LOGMSG_ERROR)
rc = ESMF_FAILURE
return
call shr_sys_abort(trim(subname)//' ERROR: nf90_get_var curr_ymd', &
file=__FILE__, line=__LINE__)
end if

status = nf90_inq_varid(ncid, 'curr_tod', varid)
if (status /= nf90_NoErr) then
call ESMF_LogWrite(trim(subname)//' ERROR: nf90_inq_varid curr_tod', ESMF_LOGMSG_ERROR)
rc = ESMF_FAILURE
return
call shr_sys_abort(trim(subname)//' ERROR: nf90_inq_varid curr_tod', &
file=__FILE__, line=__LINE__)
end if
status = nf90_get_var(ncid, varid, curr_tod)
if (status /= nf90_NoErr) then
call ESMF_LogWrite(trim(subname)//' ERROR: nf90_get_var curr_tod', ESMF_LOGMSG_ERROR)
rc = ESMF_FAILURE
return
call shr_sys_abort(trim(subname)//' ERROR: nf90_get_var curr_tod', &
file=__FILE__, line=__LINE__)
end if

status = nf90_close(ncid)
if (status /= nf90_NoErr) then
call ESMF_LogWrite(trim(subname)//' ERROR: nf90_close', ESMF_LOGMSG_ERROR)
rc = ESMF_FAILURE
return
call shr_sys_abort(trim(subname)//' ERROR: nf90_close', &
file=__FILE__, line=__LINE__)
end if

write(tmpstr,*) trim(subname)//" read start_ymd = ",start_ymd
Expand Down
53 changes: 10 additions & 43 deletions cime_config/testdefs/testlist_drv.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,44 +42,11 @@
</options>
</test>

<!-- ======================================= -->
<!-- X compsets -->
<!-- ======================================= -->

<test compset="X" grid="f19_g17" name="SMS">
<machines>
<machine name="derecho" compiler="gnu" category="aux_cmeps"/>
<machine name="izumi" compiler="intel" category="aux_cmeps"/>
</machines>
<options>
<option name="wallclock"> 00:20:00 </option>
</options>
</test>
<test compset="X" grid="f19_g17" name="ERS_Ln9">
<machines>
<machine name="derecho" compiler="intel" category="aux_cmeps"/>
<machine name="izumi" compiler="intel" category="aux_cmeps"/>
</machines>
<options>
<option name="wallclock"> 00:40:00 </option>
</options>
</test>

<test compset="X" grid="f19_g17" name="ERS_D_Ln9" testmods="drv/aoflux_ogrid">
<machines>
<machine name="derecho" compiler="intel" category="aux_cmeps"/>
</machines>
<options>
<option name="wallclock"> 00:40:00 </option>
<option name="comment">The default aoflux_grid is now xgrid; include a debug test with different atm/ocn grids with aoflux_grid=ogrid to make sure that option continues to work.</option>
</options>
</test>

<!-- ======================================= -->
<!-- B compsets -->
<!-- ======================================= -->

<test compset="B1850MOM" grid="f09_t061" name="ERR_Ld5" testmods="allactive/defaultio">
<test compset="BMT1850" grid="ne30pg3_t232" name="ERR_Ld5" testmods="allactive/defaultio">
<machines>
<machine name="derecho" compiler="intel" category="aux_cmeps"/>
<machine name="izumi" compiler="intel" category="aux_cmeps"/>
Expand All @@ -88,7 +55,7 @@
<option name="wallclock"> 00:40:00 </option>
</options>
</test>
<test compset="BLT1850_v0c" grid="ne30pg3_t232" name="ERS_Ld5" testmods="allactive/defaultio">
<test compset="BLT1850" grid="ne30pg3_t232" name="ERS_Ld5" testmods="allactive/defaultio">
<machines>
<machine name="derecho" compiler="intel" category="aux_cmeps"/>
<machine name="izumi" compiler="intel" category="aux_cmeps"/>
Expand All @@ -102,7 +69,7 @@
<!-- C compsets -->
<!-- ======================================= -->

<test compset="CMOM" grid="T62_g17" name="ERS_Ld5">
<test compset="C" grid="T62_g17" name="ERS_Ld5">
<machines>
<machine name="derecho" compiler="gnu" category="aux_cmeps"/>
<machine name="izumi" compiler="intel" category="aux_cmeps"/>
Expand All @@ -111,7 +78,7 @@
<option name="wallclock"> 00:40:00 </option>
</options>
</test>
<test compset="CMOM_JRA" grid="T62_t061" name="SMS_Ld5">
<test compset="C_JRA" grid="T62_t232" name="SMS_Ld5">
<machines>
<machine name="derecho" compiler="intel" category="aux_cmeps"/>
<machine name="izumi" compiler="intel" category="aux_cmeps"/>
Expand All @@ -120,7 +87,7 @@
<option name="wallclock"> 00:40:00 </option>
</options>
</test>
<test compset="CMOM" grid="T62_t061" name="ERS_Ld5">
<test compset="C" grid="T62_t232" name="ERS_Ld5">
<machines>
<machine name="derecho" compiler="intel" category="aux_cmeps"/>
<machine name="izumi" compiler="intel" category="aux_cmeps"/>
Expand All @@ -134,7 +101,7 @@
<!-- G compsets -->
<!-- ======================================= -->

<test compset="GMOM_JRA" grid="T62_g17" name="ERS_Ld5">
<test compset="G_JRA" grid="T62_g17" name="ERS_Ld5">
<machines>
<machine name="derecho" compiler="nvhpc" category="aux_cmeps"/>
<machine name="izumi" compiler="intel" category="aux_cmeps"/>
Expand All @@ -143,7 +110,7 @@
<option name="wallclock"> 00:10:00 </option>
</options>
</test>
<test compset="GMOM" grid="T62_t061" name="SMS_Ld5">
<test compset="G" grid="T62_t232" name="SMS_Ld5">
<machines>
<machine name="derecho" compiler="gnu" category="aux_cmeps"/>
<machine name="izumi" compiler="intel" category="aux_cmeps"/>
Expand All @@ -152,7 +119,7 @@
<option name="wallclock"> 00:10:00 </option>
</options>
</test>
<test compset="GMOM" grid="T62_t061" name="ERS_Ld5">
<test compset="G" grid="T62_t232" name="ERS_Ld5">
<machines>
<machine name="derecho" compiler="intel" category="aux_cmeps"/>
<machine name="izumi" compiler="intel" category="aux_cmeps"/>
Expand Down Expand Up @@ -210,7 +177,7 @@
<!-- I compsets -->
<!-- ======================================= -->

<test compset="I2000Clm51Bgc" grid="f19_g17" name="ERS_Ld5" testmods="clm/default">
<test compset="I2000Clm60Bgc" grid="f19_g17" name="ERS_Ld5" testmods="clm/default">
<machines>
<machine name="derecho" compiler="intel" category="aux_cmeps"/>
<machine name="izumi" compiler="intel" category="aux_cmeps"/>
Expand Down Expand Up @@ -292,7 +259,7 @@
</machines>
</test>

<test name="ERS_Ld5" grid="ne30pg3_t061" compset="B1850MOM" testmods="allactive/defaultio--drv/asyncio1node">
<test name="ERS_Ld5" grid="ne30pg3_t232" compset="BLT1850" testmods="allactive/defaultio--drv/asyncio1node">
<machines>
<machine name="derecho" compiler="gnu" category="prealpha">
<options>
Expand Down
Loading

0 comments on commit 8a2a3c2

Please sign in to comment.