Skip to content

Commit

Permalink
Merge branch 'standalone_updates' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
mnlevy1981 committed Dec 29, 2023
2 parents 6e6b2f7 + ddf969a commit 1b6fa9b
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 11 deletions.
6 changes: 4 additions & 2 deletions MARBL_tools/netcdf_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# to make it easy to update the default values if necessary
# rtol = 1e-11 fails the cgs vs mks comparison
# (POC_REMIN_DIC and PON_REMIN_NH4 have rel errors of ~1.4e-11)
DEFAULT_TOLS = {'rtol' : 2e-11, 'atol' : 1e-16, 'thres' : 1e-16}
DEFAULT_TOLS = {'rtol' : 1e-9, 'atol' : 1e-16, 'thres' : 1e-16}

##################

Expand Down Expand Up @@ -181,7 +181,7 @@ def _get_conversion_factor(ds_base, ds_new, var):
conversion_factor = 1. / unit_conversion[old_units][new_units]
found = True
if not found:
raise KeyError(f'Can not convert from {new_units} to {old_units}')
raise KeyError(f'Can not convert from {new_units} to {old_units} for {var}')
return conversion_factor

def _variable_check_loose(ds_base, ds_new, rtol, atol, thres):
Expand Down Expand Up @@ -209,6 +209,8 @@ def _variable_check_loose(ds_base, ds_new, rtol, atol, thres):
conversion_factor = _get_conversion_factor(ds_base, ds_new, var)

# (1) Are NaNs in the same place?
if var.lower() == 'time':
continue
mask = np.isfinite(ds_base[var].data)
if np.any(mask ^ np.isfinite(ds_new[var].data)):
error_checking['messages'].append('NaNs are not in same place')
Expand Down
7 changes: 7 additions & 0 deletions MARBL_tools/run_test_suite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function print_status() {
TAIL=""
if [ "${STATUS}" == "FAIL" ]; then
FAIL_CNT=$((FAIL_CNT+1))
echo "${FAIL_CNT}. $1" >> ${FAILURE_CACHE}
HEAD="***"
TAIL=" ***"
fi
Expand All @@ -34,9 +35,11 @@ function print_status() {

MARBL_ROOT=`(cd ..; pwd -P)`
RESULTS_CACHE=${MARBL_ROOT}/MARBL_tools/.test_suite.cache
FAILURE_CACHE=${MARBL_ROOT}/MARBL_tools/.test_suite.failures.cache
TEST_CNT=0
FAIL_CNT=0
echo "Test Results:" > ${RESULTS_CACHE}
echo "Failed Tests:" > ${FAILURE_CACHE}

#########
# TESTS #
Expand Down Expand Up @@ -365,5 +368,9 @@ cat ${RESULTS_CACHE}
rm -f ${RESULTS_CACHE}
echo ""
echo "${TEST_CNT} tests were run, and $FAIL_CNT failed."
if [ ${FAIL_CNT} -gt 0 ]; then
cat ${FAILURE_CACHE}
fi
rm -f ${FAILURE_CACHE}
exit ${FAIL_CNT}

12 changes: 8 additions & 4 deletions tests/driver_src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,13 @@ endif
ifneq ($(COMP_NAME),NONE)
INFO_FILE = $(EXE_SRC_DIR)/.netcdf_info.$(COMP_NAME)
ifeq ($(USE_NETCDF),TRUE)
NETCDF_INC=-D_NETCDF -I$(shell nc-config --includedir)
# hobart_intel version of nc-config does not have --libdir option
NETCDF_LNK=-L$(shell nc-config --prefix)/lib -lnetcdf -lnetcdff
ifneq (${shell which nf-config},)
CONFIG=nf-config
else
CONFIG=nc-config
endif
NETCDF_INC=-D_NETCDF -I$(shell $(CONFIG) --includedir)
NETCDF_LNK=-L$(shell $(CONFIG) --prefix)/lib -lnetcdff
endif

# Determine if existing build used netCDF
Expand Down Expand Up @@ -151,7 +155,7 @@ all: gnu

.PHONY: gnu
gnu:
$(MAKE) -f $(MAKE_DIR)/Makefile $(EXE) COMP_NAME=gnu$(MPISUF) FC=gfortran FCFLAGS="-Wall -Wextra -Wno-compare-reals -Werror -O2 -ffree-form -cpp -finit-real=snan -ffpe-trap=invalid" INC="-J $(OBJ_ROOT)/gnu$(MPISUF)" INC2="-J $(OBJ_ROOT)/gnu$(MPISUF)/driver"
$(MAKE) -f $(MAKE_DIR)/Makefile $(EXE) COMP_NAME=gnu$(MPISUF) FC=gfortran FCFLAGS="-g -Wall -Wextra -Wno-compare-reals -Werror -O2 -ffree-form -cpp -finit-real=snan -ffpe-trap=invalid" INC="-J $(OBJ_ROOT)/gnu$(MPISUF)" INC2="-J $(OBJ_ROOT)/gnu$(MPISUF)/driver"

.PHONY: intel
intel:
Expand Down
18 changes: 14 additions & 4 deletions tests/python_for_tests/machines.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,21 @@ def load_module(mach, compiler, module_name):
sys.path.insert(0, os.path.join(os.sep, 'glade', 'u', 'apps', 'derecho', '23.06', 'spack', 'opt', 'spack', 'lmod', '8.7.20', 'gcc', '7.5.0', 'pdxb', 'lmod', 'lmod', 'init'))
from env_modules_python import module
module('--force', 'purge')
module('load', 'ncarenv/23.06')
module('load', 'craype')
module('load', 'cesmdev/1.0')
if compiler == 'cray':
module('load', 'ncarenv/23.06')
module('load', 'craype')
elif compiler == 'nvhpc':
module('load', 'ncarenv/23.06')
else:
module('load', 'ncarenv/23.09')
module('load', module_name)
module('load', 'ncarcompilers/1.0.0')
if compiler == 'cray':
module('load', 'cray-mpich/8.1.25')
else:
module('load', 'cray-mpich/8.1.27')
module('load', 'netcdf/4.9.2')
module('load', 'ncarcompilers')
if compiler in ['gnu', 'cray']:
module('load', 'cray-libsci/23.02.1.1')

Expand Down Expand Up @@ -88,7 +98,7 @@ def machine_specific(mach, supported_compilers, module_names):
supported_compilers.append('gnu')
supported_compilers.append('cray')
supported_compilers.append('nvhpc')
module_names['intel'] = 'intel/2023.0.0'
module_names['intel'] = 'intel/2023.2.1'
module_names['gnu'] = 'gcc/12.2.0'
module_names['cray'] = 'cce/15.0.1'
module_names['nvhpc'] = 'nvhpc/23.1'
Expand Down
2 changes: 1 addition & 1 deletion tests/python_for_tests/marbl_testing_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def parse_args(self, desc, HaveCompiler=True, HaveInputFile=True,
from socket import gethostname
self._hostname = gethostname()
found = True
if 'derecho' in self._hostname:
if 'derecho' in self._hostname or self._hostname.startswith('dec'):
self._machine = 'derecho'
elif 'cheyenne' in self._hostname:
self._machine = 'cheyenne'
Expand Down

0 comments on commit 1b6fa9b

Please sign in to comment.