From 625e407c6449b1429ac024b0788ff31cc71236e5 Mon Sep 17 00:00:00 2001 From: Alice Bertini Date: Tue, 19 Feb 2019 16:02:09 -0700 Subject: [PATCH 1/2] update with DAV specific tests --- Tools/ration_script_dav | 37 ++++++++++++++ averager/pp_tests/runAvg_mpi_dav.sh | 62 +++++++++++++++++++++++ averager/pp_tests/test_atm_series.py | 74 ++++++++++++++++++++++++++++ 3 files changed, 173 insertions(+) create mode 100755 Tools/ration_script_dav create mode 100755 averager/pp_tests/runAvg_mpi_dav.sh create mode 100755 averager/pp_tests/test_atm_series.py diff --git a/Tools/ration_script_dav b/Tools/ration_script_dav new file mode 100755 index 00000000..50f5c470 --- /dev/null +++ b/Tools/ration_script_dav @@ -0,0 +1,37 @@ +#!/bin/bash -l + +## test the mpi4py and ASAPPyTools utility on DAV with ncar_pylib virtualenv + +#SBATCH -n 4 +#SBATCH -N 2 +#SBATCH --ntasks-per-node=2 +#SBATCH -t 00:05:00 +#SBATCH -p dav +#SBATCH -J ration_test +#SBATCH -A P93300606 +#SBATCH --mem 1G +#SBATCH -e ration_test.err.%J +#SBATCH -o ration_test.out.%J + +module purge +module load python/2.7.14 +module load intel/17.0.1 +module load ncarenv +module load ncarcompilers +module load impi + + +. /gpfs/fs1/work/aliceb/sandboxes/dev/postprocessing_dav/cesm-env2/bin/activate + +srun ./ration_test.py >> ./ration.log + +status=$? +echo $status + +deactivate + +echo $status + + + + diff --git a/averager/pp_tests/runAvg_mpi_dav.sh b/averager/pp_tests/runAvg_mpi_dav.sh new file mode 100755 index 00000000..c454a896 --- /dev/null +++ b/averager/pp_tests/runAvg_mpi_dav.sh @@ -0,0 +1,62 @@ +#! /bin/bash -l + +#SBATCH -n 16 +#SBATCH -N 4 +#SBATCH --ntasks-per-node=4 +#SBATCH -t 00:05:00 +#SBATCH -p dav +#SBATCH -J atm_averages_dav +#SBATCH -A P93300606 +#SBATCH --mem 10G +#SBATCH -e atm_averages_dav.err.%J +#SBATCH -o atm_averages_dav.out.%J +#SBATCH -m block + + +if [ ! -e /gpfs/fs1/work/aliceb/sandboxes/dev/postprocessing_dav/cesm-env2/bin ]; then + echo "*************************************************************************************" + echo "CESM atm_averages_dav exiting due to non-existant python virtual environment in" + echo " /gpfs/fs1/work/aliceb/sandboxes/dev/postprocessing_dav/cesm-env2/bin" + echo "You must first run:" + echo "$POSTPROCESS_PATH/create_python_env -machine [machine]" + echo "*************************************************************************************" + exit +fi + + +module purge + + + + +## activate the virtualenv that contains all the non-bootstrapped dependencies + +cd /gpfs/fs1/work/aliceb/sandboxes/dev/postprocessing_dav/cesm-env2/bin +echo "Running from virtualenv directory:" +pwd +. activate + +## load the boot-strap modules + + +module load python/2.7.14 + +module load intel/17.0.1 + +module load ncarenv + +module load ncarcompilers + +module load impi + +module load netcdf/4.6.1 + +module load nco/4.7.4 + +module load ncl/6.4.0 + +export POSTPROCESS_PATH=/gpfs/fs1/work/aliceb/sandboxes/dev/postprocessing_dav + +srun /gpfs/fs1/work/aliceb/sandboxes/dev/postprocessing_dav/averager/pp_tests/test_atm_series.py + + diff --git a/averager/pp_tests/test_atm_series.py b/averager/pp_tests/test_atm_series.py new file mode 100755 index 00000000..4c5e7126 --- /dev/null +++ b/averager/pp_tests/test_atm_series.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python2 + +from __future__ import print_function +import sys + +# check the system python version and require 2.7.x or greater +if sys.hexversion < 0x02070000: + print(70 * '*') + print('ERROR: {0} requires python >= 2.7.x. '.format(sys.argv[0])) + print('It appears that you are running python {0}'.format( + '.'.join(str(x) for x in sys.version_info[0:3]))) + print(70 * '*') + sys.exit(1) + +import os + +# +# check the POSTPROCESS_PATH which must be set +# +try: + os.environ["POSTPROCESS_PATH"] +except KeyError: + err_msg = ('create_postprocess ERROR: please set the POSTPROCESS_PATH environment variable.' \ + ' For example on yellowstone: setenv POSTPROCESS_PATH /glade/p/cesm/postprocessing') + raise OSError(err_msg) + +cesm_pp_path = os.environ["POSTPROCESS_PATH"] + +# +# activate the virtual environment that was created by create_python_env +# +if not os.path.isfile('{0}/cesm-env2/bin/activate_this.py'.format(cesm_pp_path)): + err_msg = ('create_postprocess ERROR: the virtual environment cesm-env2 does not exist.' \ + ' Please run $POSTPROCESS_PATH/create_python_env -machine [machine name]') + raise OSError(err_msg) + +execfile('{0}/cesm-env2/bin/activate_this.py'.format(cesm_pp_path), dict(__file__='{0}/cesm-env2/bin/activate_this.py'.format(cesm_pp_path))) + +from pyaverager import PyAverager, specification + +#### User modify #### + +in_dir='/glade/scratch/aliceb/F1850C5_f02_cntrl/atm//proc/tseries/month_1' +out_dir= '/glade/scratch/aliceb/F1850C5_f02_cntrl/atm/proc/climo/F1850C5_f02_cntrl//F1850C5_f02_cntrl.2-5' +pref= 'F1850C5_f02_cntrl.cam.h0' +htype= 'series' +average = ['dep_ann:2:5', 'dep_djf:2:5', 'dep_mam:2:5', 'dep_jja:2:5', 'dep_son:2:5', 'jan:2:5', 'feb:2:5', 'mar:2:5', 'apr:2:5', 'may:2:5', 'jun:2:5', 'jul:2:5', 'aug:2:5', 'sep:2:5', 'oct:2:5', 'nov:2:5', 'dec:2:5'] +collapse_dim = 'lon' +wght= False +ncfrmt = 'netcdfLarge' +serial=False +suffix = 'nc' +clobber = True +date_pattern= 'yyyymm-yyyymm' +var_list = ['CLDLIQ', 'PRECC', 'T', 'TS'] + +#### End user modify #### + +pyAveSpecifier = specification.create_specifier(in_directory=in_dir, + out_directory=out_dir, + prefix=pref, + suffix=suffix, + date_pattern=date_pattern, + hist_type=htype, + avg_list=average, + varlist=var_list, + collapse_dim=collapse_dim, + weighted=wght, + ncformat=ncfrmt, + serial=serial, + clobber=clobber) + +PyAverager.run_pyAverager(pyAveSpecifier) + From 9efa121fa8834845e9b6f83b4e1e084c28189c68 Mon Sep 17 00:00:00 2001 From: Alice Bertini Date: Tue, 30 Jul 2019 09:59:45 -0600 Subject: [PATCH 2/2] update DAV NPL version for machine upgrade and python/2/7/15 --- Machines/dav_modules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Machines/dav_modules b/Machines/dav_modules index fd446245..5be4bfa2 100755 --- a/Machines/dav_modules +++ b/Machines/dav_modules @@ -13,7 +13,7 @@ module load ncl/6.6.2 # clone the ncat virtualenv first with helper script ncar_pylib # use "ncar_pylib --help" to see all options -ncar_pylib -c 20190326 ${pp_dir}/cesm-env2 +ncar_pylib -c 20190718 ${pp_dir}/cesm-env2 export PYTHONPATH=${pp_dir}/cesm-env2/lib/python2.7/site-packages