From c3e57f4c027e622a53aacd39ebd449eeb551ae62 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Thu, 18 May 2023 16:01:59 -0600 Subject: [PATCH 01/15] make this an input that can be toggled in user_nl_cpl --- cime_config/namelist_definition_drv.xml | 11 +++++++++++ mediator/med_methods_mod.F90 | 21 +++++++++++++++++---- mediator/med_phases_prep_atm_mod.F90 | 2 +- mediator/med_phases_prep_glc_mod.F90 | 2 +- mediator/med_phases_prep_ice_mod.F90 | 2 +- mediator/med_phases_prep_lnd_mod.F90 | 2 +- mediator/med_phases_prep_ocn_mod.F90 | 2 +- mediator/med_phases_prep_rof_mod.F90 | 2 +- mediator/med_phases_prep_wav_mod.F90 | 2 +- 9 files changed, 35 insertions(+), 11 deletions(-) diff --git a/cime_config/namelist_definition_drv.xml b/cime_config/namelist_definition_drv.xml index bfe991383..43623b195 100644 --- a/cime_config/namelist_definition_drv.xml +++ b/cime_config/namelist_definition_drv.xml @@ -716,6 +716,17 @@ $ESMF_VERBOSITY_LEVEL + + logical + performance + MED_attributes + + Check for NaN values in fields returned from mediator to components + + + .false. + + integer control diff --git a/mediator/med_methods_mod.F90 b/mediator/med_methods_mod.F90 index faecf47a6..739db9b54 100644 --- a/mediator/med_methods_mod.F90 +++ b/mediator/med_methods_mod.F90 @@ -2506,11 +2506,12 @@ subroutine med_methods_FB_getmesh(FB, mesh, rc) end subroutine med_methods_FB_getmesh !----------------------------------------------------------------------------- - subroutine med_methods_FB_check_for_nans(FB, rc) - - use ESMF, only : ESMF_FieldBundle, ESMF_Field, ESMF_FieldBundleGet, ESMF_FieldGet + subroutine med_methods_FB_check_for_nans(gcomp, FB, rc) + use ESMF, only : ESMF_FieldBundle, ESMF_Field, ESMF_FieldBundleGet, ESMF_FieldGet, ESMF_GridComp + use NUOPC, only : NUOPC_CompAttributeGet ! input/output variables + type(ESMF_GridComp) , intent(in) :: gcomp type(ESMF_FieldBundle) , intent(in) :: FB integer , intent(inout) :: rc @@ -2526,11 +2527,23 @@ subroutine med_methods_FB_check_for_nans(FB, rc) character(len=CS) :: nancount_char character(len=CL) :: msg_error logical :: nanfound + logical, save :: checkfornans + logical, save :: firstcall=.true. + character(len=CL) :: cvalue character(len=*), parameter :: subname='(med_methods_FB_check_for_nans)' ! ---------------------------------------------- rc = ESMF_SUCCESS -#ifndef CESMCOUPLED +#ifdef CESMCOUPLED + if (firstcall) then + call NUOPC_CompAttributeGet(gcomp, name="check_for_nans", value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue, *) checkfornans + firstcall = .false. + endif + if(.not. checkfornans) return + +#else ! For now only CESM uses shr_infnan_isnan - so until other models provide this RETURN #endif diff --git a/mediator/med_phases_prep_atm_mod.F90 b/mediator/med_phases_prep_atm_mod.F90 index bccf8e07c..8de571d0d 100644 --- a/mediator/med_phases_prep_atm_mod.F90 +++ b/mediator/med_phases_prep_atm_mod.F90 @@ -245,7 +245,7 @@ subroutine med_phases_prep_atm(gcomp, rc) end if ! Check for nans in fields export to atm - call FB_check_for_nans(is_local%wrap%FBExp(compatm), rc=rc) + call FB_check_for_nans(gcomp, is_local%wrap%FBExp(compatm), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (dbug_flag > 5) then diff --git a/mediator/med_phases_prep_glc_mod.F90 b/mediator/med_phases_prep_glc_mod.F90 index 97049d5b9..cd09abc3d 100644 --- a/mediator/med_phases_prep_glc_mod.F90 +++ b/mediator/med_phases_prep_glc_mod.F90 @@ -709,7 +709,7 @@ subroutine med_phases_prep_glc_avg(gcomp, rc) ! Check for nans in fields export to atm do ns = 1,is_local%wrap%num_icesheets - call FB_check_for_nans(is_local%wrap%FBExp(compglc(ns)), rc=rc) + call FB_check_for_nans(gcomp, is_local%wrap%FBExp(compglc(ns)), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end do diff --git a/mediator/med_phases_prep_ice_mod.F90 b/mediator/med_phases_prep_ice_mod.F90 index 1e0496b3d..e234eb987 100644 --- a/mediator/med_phases_prep_ice_mod.F90 +++ b/mediator/med_phases_prep_ice_mod.F90 @@ -151,7 +151,7 @@ subroutine med_phases_prep_ice(gcomp, rc) end if ! Check for nans in fields export to atm - call FB_check_for_nans(is_local%wrap%FBExp(compice), rc=rc) + call FB_check_for_nans(gcomp, is_local%wrap%FBExp(compice), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (dbug_flag > 5) then diff --git a/mediator/med_phases_prep_lnd_mod.F90 b/mediator/med_phases_prep_lnd_mod.F90 index b73412937..26722b4f8 100644 --- a/mediator/med_phases_prep_lnd_mod.F90 +++ b/mediator/med_phases_prep_lnd_mod.F90 @@ -129,7 +129,7 @@ subroutine med_phases_prep_lnd(gcomp, rc) first_call = .false. ! Check for nans in fields export to atm - call FB_check_for_nans(is_local%wrap%FBExp(complnd), rc=rc) + call FB_check_for_nans(gcomp, is_local%wrap%FBExp(complnd), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (dbug_flag > 5) then diff --git a/mediator/med_phases_prep_ocn_mod.F90 b/mediator/med_phases_prep_ocn_mod.F90 index de989ac49..7628bd61a 100644 --- a/mediator/med_phases_prep_ocn_mod.F90 +++ b/mediator/med_phases_prep_ocn_mod.F90 @@ -297,7 +297,7 @@ subroutine med_phases_prep_ocn_avg(gcomp, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Check for nans in fields export to atm - call FB_check_for_nans(is_local%wrap%FBExp(compocn), rc=rc) + call FB_check_for_nans(gcomp, is_local%wrap%FBExp(compocn), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! zero accumulator diff --git a/mediator/med_phases_prep_rof_mod.F90 b/mediator/med_phases_prep_rof_mod.F90 index cf0ad0f4e..b866cc00b 100644 --- a/mediator/med_phases_prep_rof_mod.F90 +++ b/mediator/med_phases_prep_rof_mod.F90 @@ -378,7 +378,7 @@ subroutine med_phases_prep_rof(gcomp, rc) if (chkerr(rc,__LINE__,u_FILE_u)) return ! Check for nans in fields export to atm - call FB_check_for_nans(is_local%wrap%FBExp(comprof), rc=rc) + call FB_check_for_nans(gcomp, is_local%wrap%FBExp(comprof), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (dbug_flag > 1) then diff --git a/mediator/med_phases_prep_wav_mod.F90 b/mediator/med_phases_prep_wav_mod.F90 index 3028303bc..526ecb204 100644 --- a/mediator/med_phases_prep_wav_mod.F90 +++ b/mediator/med_phases_prep_wav_mod.F90 @@ -178,7 +178,7 @@ subroutine med_phases_prep_wav_avg(gcomp, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Check for nans in fields export to atm - call FB_check_for_nans(is_local%wrap%FBExp(compwav), rc=rc) + call FB_check_for_nans(gcomp, is_local%wrap%FBExp(compwav), rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! zero accumulator From d84c9b3151c25fe8c34059d84e29918bf5abc0ca Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Thu, 18 May 2023 16:05:48 -0600 Subject: [PATCH 02/15] expand description --- cime_config/namelist_definition_drv.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cime_config/namelist_definition_drv.xml b/cime_config/namelist_definition_drv.xml index 43623b195..a676c49ba 100644 --- a/cime_config/namelist_definition_drv.xml +++ b/cime_config/namelist_definition_drv.xml @@ -721,7 +721,7 @@ performance MED_attributes - Check for NaN values in fields returned from mediator to components + Check for NaN values in fields returned from mediator to components. This has a small performance impact. .false. From a753571a110dcb59f3b16d28d4868599bc7ef3ad Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Fri, 19 May 2023 08:39:08 -0600 Subject: [PATCH 03/15] make default .true. add log message --- cime_config/namelist_definition_drv.xml | 2 +- mediator/med_methods_mod.F90 | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/cime_config/namelist_definition_drv.xml b/cime_config/namelist_definition_drv.xml index a676c49ba..dec6868f1 100644 --- a/cime_config/namelist_definition_drv.xml +++ b/cime_config/namelist_definition_drv.xml @@ -724,7 +724,7 @@ Check for NaN values in fields returned from mediator to components. This has a small performance impact. - .false. + .true. diff --git a/mediator/med_methods_mod.F90 b/mediator/med_methods_mod.F90 index 739db9b54..b4e9c2050 100644 --- a/mediator/med_methods_mod.F90 +++ b/mediator/med_methods_mod.F90 @@ -2507,7 +2507,7 @@ end subroutine med_methods_FB_getmesh !----------------------------------------------------------------------------- subroutine med_methods_FB_check_for_nans(gcomp, FB, rc) - + use med_internalstate_mod, only : maintask, logunit use ESMF, only : ESMF_FieldBundle, ESMF_Field, ESMF_FieldBundleGet, ESMF_FieldGet, ESMF_GridComp use NUOPC, only : NUOPC_CompAttributeGet ! input/output variables @@ -2538,16 +2538,23 @@ subroutine med_methods_FB_check_for_nans(gcomp, FB, rc) if (firstcall) then call NUOPC_CompAttributeGet(gcomp, name="check_for_nans", value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue, *) checkfornans + read(cvalue, *) checkfornans firstcall = .false. + if(maintask) then + write(logunit,*) ' check_for_nans is ',checkfornans + if(checkfornans) then + write(logunit,*) ' Fields will be checked for NaN values when passed from mediator to component' + else + write(logunit,*) ' Fields will NOT be checked for NaN values when passed from mediator to component' + endif + endif endif if(.not. checkfornans) return - #else ! For now only CESM uses shr_infnan_isnan - so until other models provide this RETURN #endif - + call ESMF_FieldBundleGet(FB, fieldCount=fieldCount, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return From 0ff2afeedb44c40c2e1b2d6ec2b3ff3f3c5b11ae Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Fri, 19 May 2023 09:16:22 -0600 Subject: [PATCH 04/15] resolve circular dependancy --- mediator/med_methods_mod.F90 | 5 +++-- mediator/med_phases_prep_atm_mod.F90 | 4 ++-- mediator/med_phases_prep_glc_mod.F90 | 2 +- mediator/med_phases_prep_ice_mod.F90 | 2 +- mediator/med_phases_prep_lnd_mod.F90 | 4 ++-- mediator/med_phases_prep_ocn_mod.F90 | 2 +- mediator/med_phases_prep_rof_mod.F90 | 2 +- mediator/med_phases_prep_wav_mod.F90 | 2 +- 8 files changed, 12 insertions(+), 11 deletions(-) diff --git a/mediator/med_methods_mod.F90 b/mediator/med_methods_mod.F90 index b4e9c2050..95c87d7b3 100644 --- a/mediator/med_methods_mod.F90 +++ b/mediator/med_methods_mod.F90 @@ -2506,13 +2506,14 @@ subroutine med_methods_FB_getmesh(FB, mesh, rc) end subroutine med_methods_FB_getmesh !----------------------------------------------------------------------------- - subroutine med_methods_FB_check_for_nans(gcomp, FB, rc) - use med_internalstate_mod, only : maintask, logunit + subroutine med_methods_FB_check_for_nans(gcomp, FB, maintask, logunit, rc) use ESMF, only : ESMF_FieldBundle, ESMF_Field, ESMF_FieldBundleGet, ESMF_FieldGet, ESMF_GridComp use NUOPC, only : NUOPC_CompAttributeGet ! input/output variables type(ESMF_GridComp) , intent(in) :: gcomp type(ESMF_FieldBundle) , intent(in) :: FB + logical , intent(in) :: maintask + integer , intent(in) :: logunit integer , intent(inout) :: rc ! local variables diff --git a/mediator/med_phases_prep_atm_mod.F90 b/mediator/med_phases_prep_atm_mod.F90 index 8de571d0d..a58becf9a 100644 --- a/mediator/med_phases_prep_atm_mod.F90 +++ b/mediator/med_phases_prep_atm_mod.F90 @@ -17,7 +17,7 @@ module med_phases_prep_atm_mod use med_methods_mod , only : FB_check_for_nans => med_methods_FB_check_for_nans use med_merge_mod , only : med_merge_auto use med_map_mod , only : med_map_field_packed - use med_internalstate_mod , only : InternalState, maintask + use med_internalstate_mod , only : InternalState, maintask, logunit use med_internalstate_mod , only : compatm, compocn, compice, compname, coupling_mode use esmFlds , only : med_fldlist_GetfldListTo, med_fldlist_type use perf_mod , only : t_startf, t_stopf @@ -245,7 +245,7 @@ subroutine med_phases_prep_atm(gcomp, rc) end if ! Check for nans in fields export to atm - call FB_check_for_nans(gcomp, is_local%wrap%FBExp(compatm), rc=rc) + call FB_check_for_nans(gcomp, is_local%wrap%FBExp(compatm), maintask, logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (dbug_flag > 5) then diff --git a/mediator/med_phases_prep_glc_mod.F90 b/mediator/med_phases_prep_glc_mod.F90 index cd09abc3d..4ee84448e 100644 --- a/mediator/med_phases_prep_glc_mod.F90 +++ b/mediator/med_phases_prep_glc_mod.F90 @@ -709,7 +709,7 @@ subroutine med_phases_prep_glc_avg(gcomp, rc) ! Check for nans in fields export to atm do ns = 1,is_local%wrap%num_icesheets - call FB_check_for_nans(gcomp, is_local%wrap%FBExp(compglc(ns)), rc=rc) + call FB_check_for_nans(gcomp, is_local%wrap%FBExp(compglc(ns)), maintask, logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end do diff --git a/mediator/med_phases_prep_ice_mod.F90 b/mediator/med_phases_prep_ice_mod.F90 index e234eb987..da56458c7 100644 --- a/mediator/med_phases_prep_ice_mod.F90 +++ b/mediator/med_phases_prep_ice_mod.F90 @@ -151,7 +151,7 @@ subroutine med_phases_prep_ice(gcomp, rc) end if ! Check for nans in fields export to atm - call FB_check_for_nans(gcomp, is_local%wrap%FBExp(compice), rc=rc) + call FB_check_for_nans(gcomp, is_local%wrap%FBExp(compice), maintask, logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (dbug_flag > 5) then diff --git a/mediator/med_phases_prep_lnd_mod.F90 b/mediator/med_phases_prep_lnd_mod.F90 index 26722b4f8..1bab6c794 100644 --- a/mediator/med_phases_prep_lnd_mod.F90 +++ b/mediator/med_phases_prep_lnd_mod.F90 @@ -33,7 +33,7 @@ subroutine med_phases_prep_lnd(gcomp, rc) use med_utils_mod , only : chkerr => med_utils_ChkErr use med_constants_mod , only : dbug_flag => med_constants_dbug_flag use med_internalstate_mod , only : complnd, compatm - use med_internalstate_mod , only : InternalState, maintask + use med_internalstate_mod , only : InternalState, maintask, logunit use med_merge_mod , only : med_merge_auto use perf_mod , only : t_startf, t_stopf @@ -129,7 +129,7 @@ subroutine med_phases_prep_lnd(gcomp, rc) first_call = .false. ! Check for nans in fields export to atm - call FB_check_for_nans(gcomp, is_local%wrap%FBExp(complnd), rc=rc) + call FB_check_for_nans(gcomp, is_local%wrap%FBExp(complnd), maintask, logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (dbug_flag > 5) then diff --git a/mediator/med_phases_prep_ocn_mod.F90 b/mediator/med_phases_prep_ocn_mod.F90 index 7628bd61a..b9a3a485e 100644 --- a/mediator/med_phases_prep_ocn_mod.F90 +++ b/mediator/med_phases_prep_ocn_mod.F90 @@ -297,7 +297,7 @@ subroutine med_phases_prep_ocn_avg(gcomp, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Check for nans in fields export to atm - call FB_check_for_nans(gcomp, is_local%wrap%FBExp(compocn), rc=rc) + call FB_check_for_nans(gcomp, is_local%wrap%FBExp(compocn), maintask, logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! zero accumulator diff --git a/mediator/med_phases_prep_rof_mod.F90 b/mediator/med_phases_prep_rof_mod.F90 index b866cc00b..e2853c51c 100644 --- a/mediator/med_phases_prep_rof_mod.F90 +++ b/mediator/med_phases_prep_rof_mod.F90 @@ -378,7 +378,7 @@ subroutine med_phases_prep_rof(gcomp, rc) if (chkerr(rc,__LINE__,u_FILE_u)) return ! Check for nans in fields export to atm - call FB_check_for_nans(gcomp, is_local%wrap%FBExp(comprof), rc=rc) + call FB_check_for_nans(gcomp, is_local%wrap%FBExp(comprof), maintask, logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (dbug_flag > 1) then diff --git a/mediator/med_phases_prep_wav_mod.F90 b/mediator/med_phases_prep_wav_mod.F90 index 526ecb204..200e4bc62 100644 --- a/mediator/med_phases_prep_wav_mod.F90 +++ b/mediator/med_phases_prep_wav_mod.F90 @@ -178,7 +178,7 @@ subroutine med_phases_prep_wav_avg(gcomp, rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! Check for nans in fields export to atm - call FB_check_for_nans(gcomp, is_local%wrap%FBExp(compwav), rc=rc) + call FB_check_for_nans(gcomp, is_local%wrap%FBExp(compwav), maintask, logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! zero accumulator From 689d674c2bb083a580bd2ffbe66d6b1200d00f86 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Fri, 19 May 2023 09:20:26 -0600 Subject: [PATCH 05/15] remove CESMCOUPLED cppdef --- mediator/med_methods_mod.F90 | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/mediator/med_methods_mod.F90 b/mediator/med_methods_mod.F90 index 95c87d7b3..452017932 100644 --- a/mediator/med_methods_mod.F90 +++ b/mediator/med_methods_mod.F90 @@ -2535,7 +2535,6 @@ subroutine med_methods_FB_check_for_nans(gcomp, FB, maintask, logunit, rc) ! ---------------------------------------------- rc = ESMF_SUCCESS -#ifdef CESMCOUPLED if (firstcall) then call NUOPC_CompAttributeGet(gcomp, name="check_for_nans", value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -2551,11 +2550,7 @@ subroutine med_methods_FB_check_for_nans(gcomp, FB, maintask, logunit, rc) endif endif if(.not. checkfornans) return -#else - ! For now only CESM uses shr_infnan_isnan - so until other models provide this - RETURN -#endif - + call ESMF_FieldBundleGet(FB, fieldCount=fieldCount, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -2592,7 +2587,6 @@ subroutine med_methods_FB_check_for_nans(gcomp, FB, maintask, logunit, rc) end subroutine med_methods_FB_check_for_nans !----------------------------------------------------------------------------- -#ifdef CESMCOUPLED subroutine med_methods_check_for_nans_1d(dataptr, nancount) use shr_infnan_mod, only: shr_infnan_isnan @@ -2628,26 +2622,4 @@ subroutine med_methods_check_for_nans_2d(dataptr, nancount) end do end subroutine med_methods_check_for_nans_2d -#else - - ! For now only CESM uses shr_infnan_isnan - so until other models provide this - ! nancount will just be set to zero - - subroutine med_methods_check_for_nans_1d(dataptr, nancount) - ! input/output variables - real(r8) , intent(in) :: dataptr(:) - integer , intent(out) :: nancount - - nancount = 0 - end subroutine med_methods_check_for_nans_1d - - subroutine med_methods_check_for_nans_2d(dataptr, nancount) - ! input/output variables - real(r8) , intent(in) :: dataptr(:,:) - integer , intent(out) :: nancount - - nancount = 0 - end subroutine med_methods_check_for_nans_2d -#endif - end module med_methods_mod From b6ba816c71ad2e1b8992c7cab3c93185a56b1bad Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Fri, 19 May 2023 10:53:56 -0600 Subject: [PATCH 06/15] pass the strict ext build test --- .github/workflows/extbuild.yml | 4 ++-- mediator/med_methods_mod.F90 | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/.github/workflows/extbuild.yml b/.github/workflows/extbuild.yml index fafc46f46..a659e4eb6 100644 --- a/.github/workflows/extbuild.yml +++ b/.github/workflows/extbuild.yml @@ -19,10 +19,10 @@ jobs: CXX: mpicxx CPPFLAGS: "-I/usr/include -I/usr/local/include" # Versions of all dependencies can be updated here - ESMF_VERSION: v8.4.0 + ESMF_VERSION: v8.4.2 PNETCDF_VERSION: checkpoint.1.12.3 NETCDF_FORTRAN_VERSION: v4.6.0 - PIO_VERSION: pio2_5_10 + PIO_VERSION: pio2_6_0 steps: - uses: actions/checkout@v3 # Build the ESMF library, if the cache contains a previous build diff --git a/mediator/med_methods_mod.F90 b/mediator/med_methods_mod.F90 index 452017932..5b5ec6bde 100644 --- a/mediator/med_methods_mod.F90 +++ b/mediator/med_methods_mod.F90 @@ -2535,6 +2535,7 @@ subroutine med_methods_FB_check_for_nans(gcomp, FB, maintask, logunit, rc) ! ---------------------------------------------- rc = ESMF_SUCCESS +#ifdef CESMCOUPLED if (firstcall) then call NUOPC_CompAttributeGet(gcomp, name="check_for_nans", value=cvalue, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -2549,8 +2550,15 @@ subroutine med_methods_FB_check_for_nans(gcomp, FB, maintask, logunit, rc) endif endif endif +#else + ! For now only CESM uses shr_infnan_isnan - so until other models provide this + cvalue = ".false." + checkfornans = .false. + if(firstcall) write(logunit,*) ' Fields will NOT be checked for NaN values when passed from mediator to component' + firstcall = .false. +#endif if(.not. checkfornans) return - + call ESMF_FieldBundleGet(FB, fieldCount=fieldCount, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return @@ -2587,6 +2595,7 @@ subroutine med_methods_FB_check_for_nans(gcomp, FB, maintask, logunit, rc) end subroutine med_methods_FB_check_for_nans !----------------------------------------------------------------------------- +#ifdef CESMCOUPLED subroutine med_methods_check_for_nans_1d(dataptr, nancount) use shr_infnan_mod, only: shr_infnan_isnan @@ -2622,4 +2631,26 @@ subroutine med_methods_check_for_nans_2d(dataptr, nancount) end do end subroutine med_methods_check_for_nans_2d +#else + + ! For now only CESM uses shr_infnan_isnan - so until other models provide this + ! nancount will just be set to zero + + subroutine med_methods_check_for_nans_1d(dataptr, nancount) + ! input/output variables + real(r8) , intent(in) :: dataptr(:) + integer , intent(out) :: nancount + + nancount = 0 + end subroutine med_methods_check_for_nans_1d + + subroutine med_methods_check_for_nans_2d(dataptr, nancount) + ! input/output variables + real(r8) , intent(in) :: dataptr(:,:) + integer , intent(out) :: nancount + + nancount = 0 + end subroutine med_methods_check_for_nans_2d +#endif + end module med_methods_mod From 79cf2082355dfd70dc92013cbd04dcdd2c810d59 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Fri, 19 May 2023 16:49:26 -0600 Subject: [PATCH 07/15] rework based on pr review --- .github/workflows/extbuild.yml | 33 ++++++++++++++++++++++++-- mediator/med.F90 | 15 ++++++++++++ mediator/med_methods_mod.F90 | 35 +++++----------------------- mediator/med_phases_prep_atm_mod.F90 | 2 +- mediator/med_phases_prep_glc_mod.F90 | 4 ++-- mediator/med_phases_prep_ice_mod.F90 | 4 ++-- mediator/med_phases_prep_lnd_mod.F90 | 4 ++-- mediator/med_phases_prep_ocn_mod.F90 | 4 ++-- mediator/med_phases_prep_rof_mod.F90 | 4 ++-- mediator/med_phases_prep_wav_mod.F90 | 4 ++-- 10 files changed, 65 insertions(+), 44 deletions(-) diff --git a/.github/workflows/extbuild.yml b/.github/workflows/extbuild.yml index a659e4eb6..d5f742588 100644 --- a/.github/workflows/extbuild.yml +++ b/.github/workflows/extbuild.yml @@ -18,11 +18,13 @@ jobs: FC: mpifort CXX: mpicxx CPPFLAGS: "-I/usr/include -I/usr/local/include" + # Versions of all dependencies can be updated here ESMF_VERSION: v8.4.2 PNETCDF_VERSION: checkpoint.1.12.3 NETCDF_FORTRAN_VERSION: v4.6.0 PIO_VERSION: pio2_6_0 + CDEPS_VERSION: cdeps1.0.15 steps: - uses: actions/checkout@v3 # Build the ESMF library, if the cache contains a previous build @@ -50,14 +52,14 @@ jobs: key: ${{ runner.os }}-${{ env.PIO_VERSION }}.pio - name: Build ParallelIO if: steps.cache-ParallelIO.outputs.cache-hit != 'true' - uses: NCAR/ParallelIO/.github/actions/parallelio_cmake@9390e30e29d4ebbfbef0fc72162cacd9e8f25e4e + uses: NCAR/ParallelIO/.github/actions/parallelio_cmake@2_6_0 with: parallelio_version: ${{ env.ParallelIO_VERSION }} enable_fortran: True install_prefix: $HOME/pio - name: Build ESMF if: steps.cache-esmf.outputs.cache-hit != 'true' - uses: ESCOMP/CDEPS/.github/actions/buildesmf@e06246b560d3132170bb1a5443fa3d65dfbd2040 + uses: ESCOMP/CDEPS/.github/actions/buildesmf@cdeps1.0.15 with: esmf_version: ${{ env.ESMF_VERSION }} esmf_bopt: g @@ -67,6 +69,29 @@ jobs: netcdf_fortran_path: /usr pnetcdf_path: /usr parallelio_path: $HOME/pio + - name: Cache CDEPS + id: cache-cdeps + uses: actions/cache@v3 + with: + path: $HOME/cdeps + key: ${{ runner.os }}-${{ env.CDEPS_VERSION }}.cdeps + + - name: checkout CDEPS + uses: actions/checkout@v3 + with: + repository: ESCOMP/CDEPS + path: cdeps-src + ref: ${{ env.CDEPS_VERSION }} + - name: Build CDEPS + if steps.cache-cdeps.outputs.cache-hit != 'true' + uses: ESCOMP/CDEPS/.github/actions/buildcdeps@cdeps1.0.15 + with: + esmfmkfile: $HOME/ESMF/lib/libg/Linux.gfortran.64.openmpi.default/esmf.mk + pio_path: $HOME/pio + src_root: $HOME/cdeps-src + cmake_flags: " -Wno-dev -DCMAKE_BUILD_TYPE=DEBUG -DWERROR=ON -DCMAKE_Fortran_FLAGS=\"-DCPRGNU -g -Wall \ + -ffree-form -ffree-line-length-none -fallow-argument-mismatch \"" + - name: Build CMEPS run: | export ESMFMKFILE=$HOME/ESMF/lib/libg/Linux.gfortran.64.openmpi.default/esmf.mk @@ -76,3 +101,7 @@ jobs: cmake -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_Fortran_FLAGS="-g -Wall -Werror -ffree-form -ffree-line-length-none -Wno-unused-dummy-argument" ../ make VERBOSE=1 popd + + - name: Setup tmate session + if: ${{ failure() }} + uses: mxschmitt/action-tmate@v3 diff --git a/mediator/med.F90 b/mediator/med.F90 index e7c6da9d3..df0b13eca 100644 --- a/mediator/med.F90 +++ b/mediator/med.F90 @@ -661,6 +661,7 @@ subroutine AdvertiseFields(gcomp, importState, exportState, clock, rc) use NUOPC , only : NUOPC_CompAttributeGet, NUOPC_CompAttributeSet, NUOPC_CompAttributeAdd use esmFlds, only : med_fldlist_init1, med_fld_GetFldInfo, med_fldList_entry_type use med_phases_history_mod, only : med_phases_history_init + use med_methods_mod , only : mediator_checkfornans ! input/output variables type(ESMF_GridComp) :: gcomp @@ -916,6 +917,20 @@ subroutine AdvertiseFields(gcomp, importState, exportState, clock, rc) end if end do ! end of ncomps loop + ! Should mediator check for NaNs? + call NUOPC_CompAttributeGet(gcomp, name="check_for_nans", value=cvalue, rc=rc) + if (ChkErr(rc,__LINE__,u_FILE_u)) return + read(cvalue, *) mediator_checkfornans + if(maintask) then + write(logunit,*) ' check_for_nans is ',mediator_checkfornans + if(mediator_checkfornans) then + write(logunit,*) ' Fields will be checked for NaN values when passed from mediator to component' + else + write(logunit,*) ' Fields will NOT be checked for NaN values when passed from mediator to component' + endif + endif + + if (profile_memory) call ESMF_VMLogMemInfo("Leaving "//trim(subname)) call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO) diff --git a/mediator/med_methods_mod.F90 b/mediator/med_methods_mod.F90 index 5b5ec6bde..40e10bc72 100644 --- a/mediator/med_methods_mod.F90 +++ b/mediator/med_methods_mod.F90 @@ -30,7 +30,7 @@ module med_methods_mod end interface med_methods_check_for_nans ! used/reused in module - + logical, public :: mediator_checkfornans ! set in med.F90 AdvertiseFields logical :: isPresent character(len=1024) :: msgString type(ESMF_FieldStatus_Flag) :: status @@ -2506,11 +2506,9 @@ subroutine med_methods_FB_getmesh(FB, mesh, rc) end subroutine med_methods_FB_getmesh !----------------------------------------------------------------------------- - subroutine med_methods_FB_check_for_nans(gcomp, FB, maintask, logunit, rc) - use ESMF, only : ESMF_FieldBundle, ESMF_Field, ESMF_FieldBundleGet, ESMF_FieldGet, ESMF_GridComp - use NUOPC, only : NUOPC_CompAttributeGet + subroutine med_methods_FB_check_for_nans(FB, maintask, logunit, rc) + use ESMF, only : ESMF_FieldBundle, ESMF_Field, ESMF_FieldBundleGet, ESMF_FieldGet ! input/output variables - type(ESMF_GridComp) , intent(in) :: gcomp type(ESMF_FieldBundle) , intent(in) :: FB logical , intent(in) :: maintask integer , intent(in) :: logunit @@ -2528,36 +2526,15 @@ subroutine med_methods_FB_check_for_nans(gcomp, FB, maintask, logunit, rc) character(len=CS) :: nancount_char character(len=CL) :: msg_error logical :: nanfound - logical, save :: checkfornans - logical, save :: firstcall=.true. - character(len=CL) :: cvalue character(len=*), parameter :: subname='(med_methods_FB_check_for_nans)' ! ---------------------------------------------- rc = ESMF_SUCCESS -#ifdef CESMCOUPLED - if (firstcall) then - call NUOPC_CompAttributeGet(gcomp, name="check_for_nans", value=cvalue, rc=rc) - if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue, *) checkfornans - firstcall = .false. - if(maintask) then - write(logunit,*) ' check_for_nans is ',checkfornans - if(checkfornans) then - write(logunit,*) ' Fields will be checked for NaN values when passed from mediator to component' - else - write(logunit,*) ' Fields will NOT be checked for NaN values when passed from mediator to component' - endif - endif - endif -#else +#ifndef CESMCOUPLED ! For now only CESM uses shr_infnan_isnan - so until other models provide this - cvalue = ".false." - checkfornans = .false. - if(firstcall) write(logunit,*) ' Fields will NOT be checked for NaN values when passed from mediator to component' - firstcall = .false. + mediator_checkfornans = .false. #endif - if(.not. checkfornans) return + if(.not. mediator_checkfornans) return call ESMF_FieldBundleGet(FB, fieldCount=fieldCount, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return diff --git a/mediator/med_phases_prep_atm_mod.F90 b/mediator/med_phases_prep_atm_mod.F90 index a58becf9a..98728a8a6 100644 --- a/mediator/med_phases_prep_atm_mod.F90 +++ b/mediator/med_phases_prep_atm_mod.F90 @@ -245,7 +245,7 @@ subroutine med_phases_prep_atm(gcomp, rc) end if ! Check for nans in fields export to atm - call FB_check_for_nans(gcomp, is_local%wrap%FBExp(compatm), maintask, logunit, rc=rc) + call FB_check_for_nans(is_local%wrap%FBExp(compatm), maintask, logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (dbug_flag > 5) then diff --git a/mediator/med_phases_prep_glc_mod.F90 b/mediator/med_phases_prep_glc_mod.F90 index 4ee84448e..920fb415e 100644 --- a/mediator/med_phases_prep_glc_mod.F90 +++ b/mediator/med_phases_prep_glc_mod.F90 @@ -707,9 +707,9 @@ subroutine med_phases_prep_glc_avg(gcomp, rc) endif end if - ! Check for nans in fields export to atm + ! Check for nans in fields export to glc do ns = 1,is_local%wrap%num_icesheets - call FB_check_for_nans(gcomp, is_local%wrap%FBExp(compglc(ns)), maintask, logunit, rc=rc) + call FB_check_for_nans(is_local%wrap%FBExp(compglc(ns)), maintask, logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return end do diff --git a/mediator/med_phases_prep_ice_mod.F90 b/mediator/med_phases_prep_ice_mod.F90 index da56458c7..524313622 100644 --- a/mediator/med_phases_prep_ice_mod.F90 +++ b/mediator/med_phases_prep_ice_mod.F90 @@ -150,8 +150,8 @@ subroutine med_phases_prep_ice(gcomp, rc) if (chkerr(rc,__LINE__,u_FILE_u)) return end if - ! Check for nans in fields export to atm - call FB_check_for_nans(gcomp, is_local%wrap%FBExp(compice), maintask, logunit, rc=rc) + ! Check for nans in fields export to ice + call FB_check_for_nans(is_local%wrap%FBExp(compice), maintask, logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (dbug_flag > 5) then diff --git a/mediator/med_phases_prep_lnd_mod.F90 b/mediator/med_phases_prep_lnd_mod.F90 index 1bab6c794..4be8bb402 100644 --- a/mediator/med_phases_prep_lnd_mod.F90 +++ b/mediator/med_phases_prep_lnd_mod.F90 @@ -128,8 +128,8 @@ subroutine med_phases_prep_lnd(gcomp, rc) ! Set first call logical to false first_call = .false. - ! Check for nans in fields export to atm - call FB_check_for_nans(gcomp, is_local%wrap%FBExp(complnd), maintask, logunit, rc=rc) + ! Check for nans in fields export to lnd + call FB_check_for_nans(is_local%wrap%FBExp(complnd), maintask, logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (dbug_flag > 5) then diff --git a/mediator/med_phases_prep_ocn_mod.F90 b/mediator/med_phases_prep_ocn_mod.F90 index b9a3a485e..59a87726c 100644 --- a/mediator/med_phases_prep_ocn_mod.F90 +++ b/mediator/med_phases_prep_ocn_mod.F90 @@ -296,8 +296,8 @@ subroutine med_phases_prep_ocn_avg(gcomp, rc) call FB_copy(is_local%wrap%FBExp(compocn), is_local%wrap%FBExpAccumOcn, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Check for nans in fields export to atm - call FB_check_for_nans(gcomp, is_local%wrap%FBExp(compocn), maintask, logunit, rc=rc) + ! Check for nans in fields export to ocn + call FB_check_for_nans(is_local%wrap%FBExp(compocn), maintask, logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! zero accumulator diff --git a/mediator/med_phases_prep_rof_mod.F90 b/mediator/med_phases_prep_rof_mod.F90 index e2853c51c..55b2dae82 100644 --- a/mediator/med_phases_prep_rof_mod.F90 +++ b/mediator/med_phases_prep_rof_mod.F90 @@ -377,8 +377,8 @@ subroutine med_phases_prep_rof(gcomp, rc) FBfrac=is_local%wrap%FBFrac(comprof), FBin=FBlndAccum2rof_r, fldListTo=fldList, rc=rc) if (chkerr(rc,__LINE__,u_FILE_u)) return - ! Check for nans in fields export to atm - call FB_check_for_nans(gcomp, is_local%wrap%FBExp(comprof), maintask, logunit, rc=rc) + ! Check for nans in fields export to rof + call FB_check_for_nans(is_local%wrap%FBExp(comprof), maintask, logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return if (dbug_flag > 1) then diff --git a/mediator/med_phases_prep_wav_mod.F90 b/mediator/med_phases_prep_wav_mod.F90 index 200e4bc62..c690aa522 100644 --- a/mediator/med_phases_prep_wav_mod.F90 +++ b/mediator/med_phases_prep_wav_mod.F90 @@ -177,8 +177,8 @@ subroutine med_phases_prep_wav_avg(gcomp, rc) call FB_copy(is_local%wrap%FBExp(compwav), is_local%wrap%FBExpAccumWav, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - ! Check for nans in fields export to atm - call FB_check_for_nans(gcomp, is_local%wrap%FBExp(compwav), maintask, logunit, rc=rc) + ! Check for nans in fields export to wav + call FB_check_for_nans(is_local%wrap%FBExp(compwav), maintask, logunit, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return ! zero accumulator From 92ace685b61e48bd62ea41eeb5ea7768610d50ed Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Fri, 19 May 2023 16:51:41 -0600 Subject: [PATCH 08/15] fix yaml syntax --- .github/workflows/extbuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/extbuild.yml b/.github/workflows/extbuild.yml index d5f742588..4b00101c7 100644 --- a/.github/workflows/extbuild.yml +++ b/.github/workflows/extbuild.yml @@ -83,7 +83,7 @@ jobs: path: cdeps-src ref: ${{ env.CDEPS_VERSION }} - name: Build CDEPS - if steps.cache-cdeps.outputs.cache-hit != 'true' + if: steps.cache-cdeps.outputs.cache-hit != 'true' uses: ESCOMP/CDEPS/.github/actions/buildcdeps@cdeps1.0.15 with: esmfmkfile: $HOME/ESMF/lib/libg/Linux.gfortran.64.openmpi.default/esmf.mk From 60b9f1999890e6217b598f2011f0d55cf26f240d Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Fri, 19 May 2023 16:54:05 -0600 Subject: [PATCH 09/15] fix ext versions --- .github/workflows/extbuild.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/extbuild.yml b/.github/workflows/extbuild.yml index 4b00101c7..15237f0db 100644 --- a/.github/workflows/extbuild.yml +++ b/.github/workflows/extbuild.yml @@ -52,14 +52,14 @@ jobs: key: ${{ runner.os }}-${{ env.PIO_VERSION }}.pio - name: Build ParallelIO if: steps.cache-ParallelIO.outputs.cache-hit != 'true' - uses: NCAR/ParallelIO/.github/actions/parallelio_cmake@2_6_0 + uses: NCAR/ParallelIO/.github/actions/parallelio_cmake@${{ env.PIO_VERSION }} with: parallelio_version: ${{ env.ParallelIO_VERSION }} enable_fortran: True install_prefix: $HOME/pio - name: Build ESMF if: steps.cache-esmf.outputs.cache-hit != 'true' - uses: ESCOMP/CDEPS/.github/actions/buildesmf@cdeps1.0.15 + uses: ESCOMP/CDEPS/.github/actions/buildesmf@${{ env.CDEPS_VERSION }} with: esmf_version: ${{ env.ESMF_VERSION }} esmf_bopt: g From 0b862b929ace490f06c56b87f200b4d890146505 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Fri, 19 May 2023 16:55:21 -0600 Subject: [PATCH 10/15] fix ext versions --- .github/workflows/extbuild.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/extbuild.yml b/.github/workflows/extbuild.yml index 15237f0db..f968d0371 100644 --- a/.github/workflows/extbuild.yml +++ b/.github/workflows/extbuild.yml @@ -52,14 +52,14 @@ jobs: key: ${{ runner.os }}-${{ env.PIO_VERSION }}.pio - name: Build ParallelIO if: steps.cache-ParallelIO.outputs.cache-hit != 'true' - uses: NCAR/ParallelIO/.github/actions/parallelio_cmake@${{ env.PIO_VERSION }} + uses: NCAR/ParallelIO/.github/actions/parallelio_cmake@pio2_6_0 with: parallelio_version: ${{ env.ParallelIO_VERSION }} enable_fortran: True install_prefix: $HOME/pio - name: Build ESMF if: steps.cache-esmf.outputs.cache-hit != 'true' - uses: ESCOMP/CDEPS/.github/actions/buildesmf@${{ env.CDEPS_VERSION }} + uses: ESCOMP/CDEPS/.github/actions/buildesmf@cdeps1.0.15 with: esmf_version: ${{ env.ESMF_VERSION }} esmf_bopt: g From 5b26040ea42182724c5d24ec113f0221e78b51de Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Tue, 23 May 2023 10:53:19 -0600 Subject: [PATCH 11/15] add ispresent and isset --- mediator/med.F90 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mediator/med.F90 b/mediator/med.F90 index df0b13eca..56fcb7621 100644 --- a/mediator/med.F90 +++ b/mediator/med.F90 @@ -918,9 +918,13 @@ subroutine AdvertiseFields(gcomp, importState, exportState, clock, rc) end do ! end of ncomps loop ! Should mediator check for NaNs? - call NUOPC_CompAttributeGet(gcomp, name="check_for_nans", value=cvalue, rc=rc) + call NUOPC_CompAttributeGet(gcomp, name="check_for_nans", value=cvalue, isPresent=isPresent, isSet=isSet, rc=rc) if (ChkErr(rc,__LINE__,u_FILE_u)) return - read(cvalue, *) mediator_checkfornans + if(isPresent .and. isSet) then + read(cvalue, *) mediator_checkfornans + else + mediator_checkfornans = .false. + endif if(maintask) then write(logunit,*) ' check_for_nans is ',mediator_checkfornans if(mediator_checkfornans) then From f174edd579a62ec8278e0f70577d35faa155df91 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Wed, 24 May 2023 08:28:30 -0600 Subject: [PATCH 12/15] fix src path for cdeps --- .github/workflows/extbuild.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/extbuild.yml b/.github/workflows/extbuild.yml index f968d0371..581c27324 100644 --- a/.github/workflows/extbuild.yml +++ b/.github/workflows/extbuild.yml @@ -80,7 +80,7 @@ jobs: uses: actions/checkout@v3 with: repository: ESCOMP/CDEPS - path: cdeps-src + path: ${GITHUB_WORKSPACE}/cdeps-src ref: ${{ env.CDEPS_VERSION }} - name: Build CDEPS if: steps.cache-cdeps.outputs.cache-hit != 'true' @@ -88,7 +88,7 @@ jobs: with: esmfmkfile: $HOME/ESMF/lib/libg/Linux.gfortran.64.openmpi.default/esmf.mk pio_path: $HOME/pio - src_root: $HOME/cdeps-src + src_root: ${GITHUB_WORKSPACE}/cdeps-src cmake_flags: " -Wno-dev -DCMAKE_BUILD_TYPE=DEBUG -DWERROR=ON -DCMAKE_Fortran_FLAGS=\"-DCPRGNU -g -Wall \ -ffree-form -ffree-line-length-none -fallow-argument-mismatch \"" From 9817b91c5ccf3c91891aefad891ab910a5c45ba3 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Wed, 24 May 2023 09:44:00 -0600 Subject: [PATCH 13/15] cdeps path again --- .github/workflows/extbuild.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/extbuild.yml b/.github/workflows/extbuild.yml index 581c27324..2581a546d 100644 --- a/.github/workflows/extbuild.yml +++ b/.github/workflows/extbuild.yml @@ -80,7 +80,7 @@ jobs: uses: actions/checkout@v3 with: repository: ESCOMP/CDEPS - path: ${GITHUB_WORKSPACE}/cdeps-src + path: $HOME/cdeps-src ref: ${{ env.CDEPS_VERSION }} - name: Build CDEPS if: steps.cache-cdeps.outputs.cache-hit != 'true' @@ -88,7 +88,7 @@ jobs: with: esmfmkfile: $HOME/ESMF/lib/libg/Linux.gfortran.64.openmpi.default/esmf.mk pio_path: $HOME/pio - src_root: ${GITHUB_WORKSPACE}/cdeps-src + src_root: $HOME/cdeps-src cmake_flags: " -Wno-dev -DCMAKE_BUILD_TYPE=DEBUG -DWERROR=ON -DCMAKE_Fortran_FLAGS=\"-DCPRGNU -g -Wall \ -ffree-form -ffree-line-length-none -fallow-argument-mismatch \"" From 371d7522c8f3eabad6027d85084808d978ad7acf Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Wed, 24 May 2023 09:49:50 -0600 Subject: [PATCH 14/15] cdeps path again --- .github/workflows/extbuild.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/extbuild.yml b/.github/workflows/extbuild.yml index 2581a546d..a3b119392 100644 --- a/.github/workflows/extbuild.yml +++ b/.github/workflows/extbuild.yml @@ -80,7 +80,7 @@ jobs: uses: actions/checkout@v3 with: repository: ESCOMP/CDEPS - path: $HOME/cdeps-src + path: cdeps-src ref: ${{ env.CDEPS_VERSION }} - name: Build CDEPS if: steps.cache-cdeps.outputs.cache-hit != 'true' @@ -88,7 +88,7 @@ jobs: with: esmfmkfile: $HOME/ESMF/lib/libg/Linux.gfortran.64.openmpi.default/esmf.mk pio_path: $HOME/pio - src_root: $HOME/cdeps-src + src_root: ${GITHUB_WORKSPACE}/cdeps-src cmake_flags: " -Wno-dev -DCMAKE_BUILD_TYPE=DEBUG -DWERROR=ON -DCMAKE_Fortran_FLAGS=\"-DCPRGNU -g -Wall \ -ffree-form -ffree-line-length-none -fallow-argument-mismatch \"" From 8f59dbaa6bb113141d26c81d23538d8f4779bfae Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Wed, 24 May 2023 10:04:39 -0600 Subject: [PATCH 15/15] try building ext with cdeps share --- .github/workflows/extbuild.yml | 2 +- mediator/med_methods_mod.F90 | 28 ---------------------------- 2 files changed, 1 insertion(+), 29 deletions(-) diff --git a/.github/workflows/extbuild.yml b/.github/workflows/extbuild.yml index a3b119392..6e26b40a5 100644 --- a/.github/workflows/extbuild.yml +++ b/.github/workflows/extbuild.yml @@ -98,7 +98,7 @@ jobs: export PIO=$HOME/pio mkdir build-cmeps pushd build-cmeps - cmake -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_Fortran_FLAGS="-g -Wall -Werror -ffree-form -ffree-line-length-none -Wno-unused-dummy-argument" ../ + cmake -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_Fortran_FLAGS="-g -Wall -Werror -ffree-form -ffree-line-length-none -Wno-unused-dummy-argument -I /home/runner/work/CMEPS/CMEPS/build-cdeps/share" ../ make VERBOSE=1 popd diff --git a/mediator/med_methods_mod.F90 b/mediator/med_methods_mod.F90 index 40e10bc72..54fe20ec1 100644 --- a/mediator/med_methods_mod.F90 +++ b/mediator/med_methods_mod.F90 @@ -2530,10 +2530,6 @@ subroutine med_methods_FB_check_for_nans(FB, maintask, logunit, rc) ! ---------------------------------------------- rc = ESMF_SUCCESS -#ifndef CESMCOUPLED - ! For now only CESM uses shr_infnan_isnan - so until other models provide this - mediator_checkfornans = .false. -#endif if(.not. mediator_checkfornans) return call ESMF_FieldBundleGet(FB, fieldCount=fieldCount, rc=rc) @@ -2572,8 +2568,6 @@ subroutine med_methods_FB_check_for_nans(FB, maintask, logunit, rc) end subroutine med_methods_FB_check_for_nans !----------------------------------------------------------------------------- -#ifdef CESMCOUPLED - subroutine med_methods_check_for_nans_1d(dataptr, nancount) use shr_infnan_mod, only: shr_infnan_isnan ! input/output variables @@ -2608,26 +2602,4 @@ subroutine med_methods_check_for_nans_2d(dataptr, nancount) end do end subroutine med_methods_check_for_nans_2d -#else - - ! For now only CESM uses shr_infnan_isnan - so until other models provide this - ! nancount will just be set to zero - - subroutine med_methods_check_for_nans_1d(dataptr, nancount) - ! input/output variables - real(r8) , intent(in) :: dataptr(:) - integer , intent(out) :: nancount - - nancount = 0 - end subroutine med_methods_check_for_nans_1d - - subroutine med_methods_check_for_nans_2d(dataptr, nancount) - ! input/output variables - real(r8) , intent(in) :: dataptr(:,:) - integer , intent(out) :: nancount - - nancount = 0 - end subroutine med_methods_check_for_nans_2d -#endif - end module med_methods_mod