From f5ec359e95b9dd745ab379ff8592936c592f7c3f Mon Sep 17 00:00:00 2001 From: John Krasting Date: Thu, 10 Aug 2023 17:36:04 -0400 Subject: [PATCH] Patches to MIDAS and mkmf for OM4_025 preprocessing - MIDAS environment patches for running on GFDL HPC - Generalized NetCDF include and lib paths in mkmf.template --- .../OM4_025/preprocessing/MIDAS.patch | 66 +++++++++++++++++++ ice_ocean_SIS2/OM4_025/preprocessing/Makefile | 3 +- .../OM4_025/preprocessing/mkmf.patch | 10 +++ 3 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 ice_ocean_SIS2/OM4_025/preprocessing/MIDAS.patch create mode 100644 ice_ocean_SIS2/OM4_025/preprocessing/mkmf.patch diff --git a/ice_ocean_SIS2/OM4_025/preprocessing/MIDAS.patch b/ice_ocean_SIS2/OM4_025/preprocessing/MIDAS.patch new file mode 100644 index 0000000000..c9cd32e9a3 --- /dev/null +++ b/ice_ocean_SIS2/OM4_025/preprocessing/MIDAS.patch @@ -0,0 +1,66 @@ +diff --git a/MOM6_ALE/build_ale/build_ale.csh b/MOM6_ALE/build_ale/build_ale.csh +index e464452..34535b2 100755 +--- a/MOM6_ALE/build_ale/build_ale.csh ++++ b/MOM6_ALE/build_ale/build_ale.csh +@@ -19,8 +19,8 @@ set LISTPATHS = $root/fms/bin/list_paths + + + if ($platform == 'gfdl_hpcs') then +- module load netcdf/4.2 +- module load intel_compilers ++ module load netcdf-fortran/4.5.3 ++ module load intel-oneapi-compilers/2022.0.2 + endif + + +diff --git a/Makefile_GFDL b/Makefile_GFDL +index 1054790..6ed2ea8 100644 +--- a/Makefile_GFDL ++++ b/Makefile_GFDL +@@ -17,10 +17,12 @@ MIDAS: fms_build/libfms.a MOM6_ALE/build_ale/libale.a + (python setup.py config_fc --f90flags="-nowarn -i4 -r8 -DPY_SOLO" --fcompiler=intelem build >& /dev/null) + (python setup.py install --home=$(INSTALL_PATH)) + +-fms_build/libfms.a: +- (cd fms;tar xvf fms_env.tar) +- (cd fms;git clone https://github.com/NOAA-GFDL/FMS.git shared;cd shared;git checkout 34097d0) +- (cd fms_build;./build_fms.csh) ++fms_build/libfms.a: fms/site ++ cd fms_build;./build_fms.csh ++fms/site: | fms/fms_env.tar ++ cd fms;tar xvf fms_env.tar ++fms/shared: ++ cd fms;git clone https://github.com/NOAA-GFDL/FMS.git shared;cd shared;git checkout 34097d0 + + MOM6_ALE/build_ale/libale.a: + (cd MOM6_ALE/build_ale;./build_ale.csh) +diff --git a/fms_build/build_fms.csh b/fms_build/build_fms.csh +index 7b61a9b..a2c4c96 100755 +--- a/fms_build/build_fms.csh ++++ b/fms_build/build_fms.csh +@@ -17,8 +17,8 @@ set LISTPATHS = $root/fms/bin/list_paths + + + if ($platform == 'gfdl_hpcs') then +- module load netcdf/4.2 +- module load intel_compilers ++ module load netcdf-fortran/4.5.3 ++ module load intel-oneapi-compilers/2022.0.2 + endif + + cd $root +diff --git a/setup.py b/setup.py +index 231c81c..4fafb75 100644 +--- a/setup.py ++++ b/setup.py +@@ -25,9 +25,8 @@ remap_sfc_fluxes = Extension(name = 'remap_sfc_fluxes', + + hinterp = Extension(name = 'fms_hinterp', + include_dirs = ['fms_build'], +- library_dirs = ['fms_build'], ++ library_dirs = ['fms_build','/app/spack/2022.01.01/linux-rhel7-x86_64/gcc-11.2.0/netcdf-fortran/4.5.3-m4arkb34bmowqtb4br3xgceig3x7tovf/lib'], + libraries = ['fms','netcdf','netcdff'], +- extra_objects = ['fms_build/*.o'], + sources = ['hinterp/hinterp.f90']) + + diff --git a/ice_ocean_SIS2/OM4_025/preprocessing/Makefile b/ice_ocean_SIS2/OM4_025/preprocessing/Makefile index f93a2fe82f..ffa059335e 100644 --- a/ice_ocean_SIS2/OM4_025/preprocessing/Makefile +++ b/ice_ocean_SIS2/OM4_025/preprocessing/Makefile @@ -126,11 +126,12 @@ PHC2_salx.2004_08_03.nc: MIDAS: git clone https://github.com/mjharriso/MIDAS.git - (cd MIDAS; git checkout a067a11693d97d7993c2c6522e118490666eeae0) + (cd MIDAS; git checkout a067a11693d97d7993c2c6522e118490666eeae0; git apply ../MIDAS.patch) local: MIDAS -rm -rf $ NETCDFPATH = `nc-config --prefix` +32a33 +> FFLAGS += -I`nf-config --includedir` +35c36 +< CFLAGS := -D__IFC -fPIC -O2 -fast -I$(TOOLSHAREDIR) -I$(COREDIR) -I$(SHAREDIR) -I${NETCDFPATH}/include -I${HDF5PATH}/include +--- +> CFLAGS := -D__IFC -fPIC -O2 -fast -I$(TOOLSHAREDIR) -I$(COREDIR) -I$(SHAREDIR) -I`nc-config --includedir` -I${HDF5PATH}/include