Skip to content

Commit

Permalink
Update Machine Ports, Add CPPs NO_CDF2, NO_CDF5 (#956)
Browse files Browse the repository at this point in the history
These changes are associated with the multi-machine pre-release testing for CICE.

Update Hera port, new compiler version

Add NO_CDF2, NO_CDF5, and NO_HDF5 CPP options to model to support older/other versions of netcdf. Several machines with only netcdf 4.4 do not support cdf5 format. Sometimes netcdf is not built with hdf5. We need a CPP to avoid that part of the code to allow the model to build on those machines.

Set NO_CDF5 for gaffney, koehr, mustang machines

Set NO_HDF5 for compy

Update documentation
  • Loading branch information
apcraig committed May 18, 2024
1 parent 969a76d commit 4587504
Show file tree
Hide file tree
Showing 13 changed files with 71 additions and 11 deletions.
29 changes: 29 additions & 0 deletions cicecore/cicedyn/infrastructure/io/io_netcdf/ice_history_write.F90
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,26 @@ subroutine ice_write_hist (ns)
if (history_format == 'cdf1') then
iflag = nf90_clobber
elseif (history_format == 'cdf2') then
#ifdef NO_CDF2
call abort_ice(subname//' ERROR: history_format cdf2 not available ', &
file=__FILE__, line=__LINE__)
#else
iflag = ior(nf90_clobber,nf90_64bit_offset)
#endif
elseif (history_format == 'cdf5') then
#ifdef NO_CDF5
call abort_ice(subname//' ERROR: history_format cdf5 not available ', &
file=__FILE__, line=__LINE__)
#else
iflag = ior(nf90_clobber,nf90_64bit_data)
#endif
elseif (history_format == 'hdf5') then
#ifdef NO_HDF5
call abort_ice(subname//' ERROR: history_format hdf5 not available ', &
file=__FILE__, line=__LINE__)
#else
iflag = ior(nf90_clobber,nf90_netcdf4)
#endif
else
call abort_ice(subname//' ERROR: history_format not allowed for '//trim(history_format), &
file=__FILE__, line=__LINE__)
Expand Down Expand Up @@ -1192,6 +1207,12 @@ subroutine ice_hist_field_def(ncid, hfield, lprecision, dimids, ns)
status = nf90_def_var(ncid, hfield%vname, lprecision, dimids, varid)
call ice_check_nc(status, subname//' ERROR: defining var '//trim(hfield%vname),file=__FILE__,line=__LINE__)

#ifdef NO_HDF5
if (history_format=='hdf5') then
call abort_ice(subname//' ERROR: history_format hdf5 not available ', &
file=__FILE__, line=__LINE__)
endif
#else
if (history_format=='hdf5' .and. size(dimids)>1) then
if (dimids(1)==imtid .and. dimids(2)==jmtid) then
chunks(1)=history_chunksize(1)
Expand All @@ -1208,6 +1229,7 @@ subroutine ice_hist_field_def(ncid, hfield, lprecision, dimids, ns)
status = nf90_def_var_deflate(ncid, varid, shuffle=0, deflate=1, deflate_level=history_deflate)
call ice_check_nc(status, subname//' ERROR deflating var '//trim(hfield%vname), file=__FILE__, line=__LINE__)
endif
#endif

! add attributes
status = nf90_put_att(ncid,varid,'units', hfield%vunit)
Expand Down Expand Up @@ -1335,6 +1357,12 @@ subroutine ice_hist_coord_def(ncid, coord, lprecision, dimids, varid)
status = nf90_def_var(ncid, coord%short_name, lprecision, dimids, varid)
call ice_check_nc(status, subname//' ERROR: defining coord '//coord%short_name,file=__FILE__,line=__LINE__)

#ifdef NO_HDF5
if (history_format=='hdf5') then
call abort_ice(subname//' ERROR: history_format hdf5 not available ', &
file=__FILE__, line=__LINE__)
endif
#else
if (history_format=='hdf5' .and. size(dimids)>1) then
if (dimids(1)==imtid .and. dimids(2)==jmtid) then
chunks(1)=history_chunksize(1)
Expand All @@ -1351,6 +1379,7 @@ subroutine ice_hist_coord_def(ncid, coord, lprecision, dimids, varid)
status=nf90_def_var_deflate(ncid, varid, shuffle=0, deflate=1, deflate_level=history_deflate)
call ice_check_nc(status, subname//' ERROR deflating var '//trim(coord%short_name), file=__FILE__, line=__LINE__)
endif
#endif

status = nf90_put_att(ncid,varid,'long_name',trim(coord%long_name))
call ice_check_nc(status, subname// ' ERROR: defining long_name for '//coord%short_name, &
Expand Down
22 changes: 22 additions & 0 deletions cicecore/cicedyn/infrastructure/io/io_netcdf/ice_restart.F90
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,26 @@ subroutine init_restart_write(filename_spec)
if (restart_format == 'cdf1') then
iflag = nf90_clobber
elseif (restart_format == 'cdf2') then
#ifdef NO_CDF2
call abort_ice(subname//' ERROR: restart_format cdf2 not available ', &
file=__FILE__, line=__LINE__)
#else
iflag = ior(nf90_clobber,nf90_64bit_offset)
#endif
elseif (restart_format == 'cdf5') then
#ifdef NO_CDF5
call abort_ice(subname//' ERROR: restart_format cdf5 not available ', &
file=__FILE__, line=__LINE__)
#else
iflag = ior(nf90_clobber,nf90_64bit_data)
#endif
elseif (restart_format == 'hdf5') then
#ifdef NO_HDF5
call abort_ice(subname//' ERROR: restart_format hdf5 not available ', &
file=__FILE__, line=__LINE__)
#else
iflag = ior(nf90_clobber,nf90_netcdf4)
#endif
else
call abort_ice(subname//' ERROR: restart_format not allowed for '//trim(restart_format), &
file=__FILE__, line=__LINE__)
Expand Down Expand Up @@ -894,6 +909,12 @@ subroutine define_rest_field(ncid, vname, dims)
status = nf90_def_var(ncid,trim(vname),nf90_double,dims,varid)
call ice_check_nc(status, subname//' ERROR: def var '//trim(vname), file=__FILE__, line=__LINE__)

#ifdef NO_HDF5
if (restart_format=='hdf5') then
call abort_ice(subname//' ERROR: restart_format hdf5 not available ', &
file=__FILE__, line=__LINE__)
endif
#else
if (restart_format=='hdf5' .and. size(dims)>1) then
if (dims(1)==dimid_ni .and. dims(2)==dimid_nj) then
chunks(1)=restart_chunksize(1)
Expand All @@ -910,6 +931,7 @@ subroutine define_rest_field(ncid, vname, dims)
status=nf90_def_var_deflate(ncid, varid, shuffle=0, deflate=1, deflate_level=restart_deflate)
call ice_check_nc(status, subname//' ERROR deflating var '//trim(vname), file=__FILE__, line=__LINE__)
endif
#endif

#else
call abort_ice(subname//' ERROR: USE_NETCDF cpp not defined', &
Expand Down
2 changes: 1 addition & 1 deletion configuration/scripts/machines/Macros.compy_intel
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#==============================================================================

CPP := fpp
CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS}
CPPDEFS := -DFORTRANUNDERSCORE -DNO_HDF5 ${ICE_CPPDEFS}
CFLAGS := -c -O2 -fp-model precise -xHost

FIXEDFLAGS := -132
Expand Down
2 changes: 1 addition & 1 deletion configuration/scripts/machines/Macros.gaffney_gnu
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#==============================================================================

CPP := ftn -E
CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS}
CPPDEFS := -DFORTRANUNDERSCORE -DNO_CDF5 ${ICE_CPPDEFS}
CFLAGS := -c

FIXEDFLAGS := -ffixed-line-length-132
Expand Down
2 changes: 1 addition & 1 deletion configuration/scripts/machines/Macros.gaffney_intel
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#==============================================================================

CPP := fpp
CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS}
CPPDEFS := -DFORTRANUNDERSCORE -DNO_CDF5 ${ICE_CPPDEFS}
CFLAGS := -c -O2 -fp-model precise -xHost

FIXEDFLAGS := -132
Expand Down
2 changes: 1 addition & 1 deletion configuration/scripts/machines/Macros.koehr_intel
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#==============================================================================

CPP := fpp
CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS}
CPPDEFS := -DFORTRANUNDERSCORE -DNO_CDF5 ${ICE_CPPDEFS}
CFLAGS := -c -O2 -fp-model precise -xHost

FIXEDFLAGS := -132
Expand Down
2 changes: 1 addition & 1 deletion configuration/scripts/machines/Macros.mustang_intel18
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#==============================================================================

CPP := fpp
CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS}
CPPDEFS := -DFORTRANUNDERSCORE -DNO_CDF5 ${ICE_CPPDEFS}
CFLAGS := -c -O2 -fp-model precise -xHost

FIXEDFLAGS := -132
Expand Down
2 changes: 1 addition & 1 deletion configuration/scripts/machines/Macros.mustang_intel19
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#==============================================================================

CPP := fpp
CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS}
CPPDEFS := -DFORTRANUNDERSCORE -DNO_CDF5 ${ICE_CPPDEFS}
CFLAGS := -c -O2 -fp-model precise -xHost

FIXEDFLAGS := -132
Expand Down
2 changes: 1 addition & 1 deletion configuration/scripts/machines/Macros.mustang_intel20
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#==============================================================================

CPP := fpp
CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS}
CPPDEFS := -DFORTRANUNDERSCORE -DNO_CDF5 ${ICE_CPPDEFS}
CFLAGS := -c -O2 -fp-model precise -xHost

FIXEDFLAGS := -132
Expand Down
7 changes: 4 additions & 3 deletions configuration/scripts/machines/env.hera_intel
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ if ("$inp" != "-nomodules") then
source /etc/profile.d/modules.csh
#module list
module purge
module load intel/18.0.5.274
module load impi/2018.0.4
module load gnu/13.2.0
module load intel/2023.2.0
module load impi/2023.2.0
module load netcdf/4.7.0
#module list

Expand All @@ -23,7 +24,7 @@ setenv OMP_STACKSIZE 64M
setenv ICE_MACHINE_MACHNAME hera
setenv ICE_MACHINE_MACHINFO "Cray CS500 Intel SkyLake 2.4GHz, Infiniband HDR"
setenv ICE_MACHINE_ENVNAME intel
setenv ICE_MACHINE_ENVINFO "ifort 18.0.5 20180823, intelmpi/2018.0.4, netcdf/4.7.0"
setenv ICE_MACHINE_ENVINFO "icc/ifort 2021.10.0 20230609, intelmpi/2023.2.0, netcdf/4.7.0"
setenv ICE_MACHINE_MAKE gmake
setenv ICE_MACHINE_WKDIR $HOME/scratch/CICE_RUNS
setenv ICE_MACHINE_INPUTDATA /home/Anthony.Craig/scratch/CICE_INPUTDATA
Expand Down
3 changes: 3 additions & 0 deletions doc/source/user_guide/ug_case_settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ can be found in :ref:`cicecpps`. The following CPPs are available.
"ESMF_INTERFACE", "Turns on ESMF support in a subset of driver code. Also USE_ESMF_LIB and USE_ESMF_METADATA"
"FORTRANUNDERSCORE", "Used in ice_shr_reprosum86.c to support Fortran-C interfaces. This should generally be turned on at all times. There are other CPPs (FORTRANDOUBULEUNDERSCORE, FORTRANCAPS, etc) in ice_shr_reprosum.c that are generally not used in CICE but could be useful if problems arise in the Fortran-C interfaces"
"GPTL", "Turns on GPTL initialization if needed for PIO"
"NO_CDF2", "Turns off support for netcdf cdf2 (nf90_64bit_offset)"
"NO_CDF5", "Turns off support for netcdf cdf5 (nf90_64bit_data)"
"NO_F2003", "Turns off some Fortran 2003 features"
"NO_HDF2", "Turns off support for netcdf hdf5 (netcdf4 including chunking and compression)"
"NO_I8", "Converts integer*8 to integer*4. This could have adverse affects for certain algorithms including the ddpdd implementation associated with the ``bfbflag``"
"NO_R16", "Converts real*16 to real*8. This could have adverse affects for certain algorithms including the lsum16 implementation associated with the ``bfbflag``"
"NO_SNICARHC", "Does not compile hardcoded (HC) 5 band snicar tables tables needed by ``shortwave=dEdd_snicar_ad``. May reduce compile time."
Expand Down
5 changes: 4 additions & 1 deletion doc/source/user_guide/ug_implementation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,10 @@ and (https://github.com/NCAR/ParallelIO).
netCDF requires CICE compilation with a netCDF library built externally.
PIO requires CICE compilation with a PIO and netCDF library built externally.
Both netCDF and PIO can be built with many options which may require additional libraries
such as MPI, hdf5, or pnetCDF.
such as MPI, hdf5, or pnetCDF. There are CPPs that will deprecate cdf2,
cdf5, and hdf5 support should the netcdf library be built without those features.
Those CPPs are ``NO_CDF2``, ``NO_CDF5``, and ``NO_HDF5``. Those can be added
to the Macros machine file explicity when needed.

.. _history:

Expand Down
2 changes: 2 additions & 0 deletions doc/source/user_guide/ug_running.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ The Consortium has tested the following compilers at some point,
- Intel ifort 2021.6.0
- Intel ifort 2021.8.0
- Intel ifort 2021.9.0
- Intel ifort 2021.10.0
- Intel ifort 2022.2.1
- PGI 16.10.0
- PGI 19.9-0
Expand Down Expand Up @@ -86,6 +87,7 @@ The Consortium has tested the following MPI implementations and versions,
- MPICH 8.1.14
- MPICH 8.1.21
- MPICH 8.1.25
- MPICH 8.1.26
- Intel MPI 18.0.1
- Intel MPI 18.0.4
- Intel MPI 2019 Update 6
Expand Down

0 comments on commit 4587504

Please sign in to comment.