diff --git a/config/cesm/machines/config_machines.xml b/config/cesm/machines/config_machines.xml index 36751b34c60..8d395aebab9 100644 --- a/config/cesm/machines/config_machines.xml +++ b/config/cesm/machines/config_machines.xml @@ -2096,7 +2096,6 @@ intel/15.0.3 mkl/11.1.2 - trilinos/11.10.2 esmf diff --git a/tools/mapping/check_maps/README b/tools/mapping/check_maps/README index 0970d3fc28b..b81dca2cee9 100644 --- a/tools/mapping/check_maps/README +++ b/tools/mapping/check_maps/README @@ -36,12 +36,12 @@ BUILD ===== To compile this tool, you need to have the ESMFMKFILE environment variable set. -The easiest way to do that is to load the ESMF modules. On yellowstone and -cheyenne, you must already have the intel module loaded. Then load the version -of ESMF you want to use (as of April 2017, the most recent version available is -7.0.0): +The easiest way to do that is to load the ESMF modules. On cheyenne, caldera, +geyser, or pronghorn you must already have the intel module loaded. Then load the +version of ESMF you want to use (as of May 2018, the most recent version on the +NCAR machines is 7.0.0): -Yellowstone: +Caldera, Geyser, Pronghorn: $ module load esmf $ module load esmf-7.0.0-ncdfio-uni-O @@ -78,6 +78,6 @@ listed in FILELIST --help, -h Output this usage information Notes: - 1) For use on cheyenne, yellowstone, geyser, or caldera only! + 1) For use on cheyenne, geyser, caldera, or pronghorn only! 2) Need to set ESMFMKFILE (see comments in Makefile) or compilation will fail 3) If -rc option is not enabled, -v flag is ignored and verbose / concise will depend on previous compilation diff --git a/tools/mapping/check_maps/check_map.sh b/tools/mapping/check_maps/check_map.sh index 9561853430a..9d123872bda 100755 --- a/tools/mapping/check_maps/check_map.sh +++ b/tools/mapping/check_maps/check_map.sh @@ -25,7 +25,7 @@ usage() { echo ' --help, -h Output this usage information' echo '' echo 'Notes:' - echo ' 1) For use on yellowstone, geyser, or caldera only!' + echo ' 1) For use on cheyenne, caldera, geyser, or pronghorn only!' echo ' 2) Need to set ESMFMKFILE (see comments in Makefile)'\ 'or compilation will fail' echo ' 3) If -rc option is not enabled, -v flag is ignored and verbose /'\ @@ -95,7 +95,7 @@ do if [ -e $MAP ]; then n=n+1 echo "${n}: ${MAP}" - $EXE $MAP + $EXE $MAP || exit $? echo "-----" else echo "File not found: $MAP" diff --git a/tools/mapping/check_maps/src/ESMF_RegridWeightGenCheck.F90 b/tools/mapping/check_maps/src/ESMF_RegridWeightGenCheck.F90 index 6a70217b479..7d0b9a8d56d 100644 --- a/tools/mapping/check_maps/src/ESMF_RegridWeightGenCheck.F90 +++ b/tools/mapping/check_maps/src/ESMF_RegridWeightGenCheck.F90 @@ -761,9 +761,9 @@ program OfflineTester ! destroy and deallocate call ESMF_ArrayDestroy(srcArray, rc=status) call ESMF_ArrayDestroy(dstArray, rc=status) - if (ESMF_LogFoundError(rcToCheck=status, msg=ESMF_LOGERR_PASSTHRU, & - line=__LINE__, file=__FILE__, rcToReturn=rc)) & - call ESMF_Finalize(endflag=ESMF_END_ABORT) +! if (ESMF_LogFoundError(rcToCheck=status, msg=ESMF_LOGERR_PASSTHRU, & +! line=__LINE__, file=__FILE__, rcToReturn=rc)) & +! call ESMF_Finalize(endflag=ESMF_END_ABORT) call ESMF_Finalize() diff --git a/tools/mapping/check_maps/src/Makefile b/tools/mapping/check_maps/src/Makefile index 2d1ddb3ba75..36dfa5c3cbb 100644 --- a/tools/mapping/check_maps/src/Makefile +++ b/tools/mapping/check_maps/src/Makefile @@ -8,11 +8,11 @@ ################################################################################ ### Finding and including esmf.mk ###### -### NOTE: On Yellowstone, ESMF is only available with the intel compilers ###### +### NOTE: On Cheyenne, ESMF is only available with the intel compilers ###### ### And require running the following: ###### -### $ module load esmf ###### -### $ module load esmf-6.3.0r-ncdfio-uni-O ###### -### The executable should run on the yellowstone login node ###### +### $ module load esmf_libs/7.0.0 ###### +### $ module load esmf-7.0.0-ncdfio-uni-O ###### +### The executable should run on the cheyenne login node ###### ################################################################################ # Don't require ESMF to be loaded to run "make clean": diff --git a/tools/mapping/gen_domain_files/src/.gitignore b/tools/mapping/gen_domain_files/src/.gitignore index 00cde60e6b5..898d25cceb7 100644 --- a/tools/mapping/gen_domain_files/src/.gitignore +++ b/tools/mapping/gen_domain_files/src/.gitignore @@ -4,3 +4,4 @@ Depends* Macros.make *.o *.mod +*.optrpt diff --git a/tools/mapping/gen_domain_files/src/Makefile b/tools/mapping/gen_domain_files/src/Makefile index 82c749eb39a..5a12b7daec5 100644 --- a/tools/mapping/gen_domain_files/src/Makefile +++ b/tools/mapping/gen_domain_files/src/Makefile @@ -143,7 +143,7 @@ $(EXENAME): $(OBJS) $(LINKER) -o $@ $(OBJS) $(SLIBS) $(LDFLAGS) clean: - $(RM) -f $(OBJS) $(EXENAME) *.mod + $(RM) -f $(OBJS) $(EXENAME) *.mod *.optrpt distclean: clean ../../../configure --clean diff --git a/tools/mapping/gen_mapping_files/.gitignore b/tools/mapping/gen_mapping_files/.gitignore new file mode 100644 index 00000000000..4e025b24ca3 --- /dev/null +++ b/tools/mapping/gen_mapping_files/.gitignore @@ -0,0 +1,2 @@ +*.Log +*.nc diff --git a/tools/mapping/gen_mapping_files/README b/tools/mapping/gen_mapping_files/README index a9594191d3a..facaeb290c1 100644 --- a/tools/mapping/gen_mapping_files/README +++ b/tools/mapping/gen_mapping_files/README @@ -64,10 +64,12 @@ gen_cesm_maps.sh --fileocn|-focn input ocn_grid_filename --filelnd|-flnd input lnd_grid_filename --filertm|-frtm input rtm_grid_filename + --fileglc|-fglc input glc_grid_filename --nameocn|-nocn output ocn_name in mapping file --nameatm|-natm output atm_name in mapping file --namelnd|-nlnd output lnd_name in mapping file --namertm|-nrtm output rtm_name in mapping file + --nameglc|-nglc output glc_name in mapping file [ --typeocn|tocn ] [regional|global] [ --typeatm|tatm ] [regional|global] [ --nogridcheck ] @@ -84,6 +86,8 @@ where SCRIP grid format land filename (full pathname), must be global --filertm (or -frtm) SCRIP grid format runoff filename (full pathname) + --fileglc (or -fglc) + SCRIP grid format glc filename (full pathname), assumed to be regional --nameatm (or -natm) Shortname to use for atm in mapping filename --nameocn (or -nocn) @@ -92,6 +96,8 @@ where Shortname to use for lnd in mapping filename --namertm (or -nrtm) Shortname to use for rtm in mapping filename + --nameglc (or -nglc) + Shortname to use for glc in mapping filename --typeocn (or -tocn) ocean grid type, valid values are regional or global default is global @@ -102,57 +108,20 @@ where --nogridcheck By default, script will run consistency check on new maps; this flag disables these checks - --batch (or -b) - Toggles batch mode usage. If you want to run in batch mode - you need to have a separate batch script for a supported machine - that calls this script interactively - you cannot submit this - script directly to the batch system + --serial + Run the ESMF tools in serial rather than parallel -rc Pass the "--recompile" flag to the ESMF tool (Only necessary if nothing has been built in ../check_maps/) - -d - toggle debug-only --help or -h displays this help message -Note: if rtm is specified and lnd is not, then this tool will +Note: if rtm or glc are specified and lnd is not, then this tool will assume lnd and atm are on the same grid. You can also set the following env variables: ESMFBIN_PATH - Path to ESMF binaries - (Leave unset on cheyenne, yellowstone, and caldera and the - tool will be loaded from modules) + (Known machines will load tools from modules) MPIEXEC ------ Name of mpirun executable - (default is mpirun.lsf on yellowstone and caldera; if - you run interactively on yellowstone, mpi is not used) - REGRID_PROC -- Number of MPI processors to use - (default is 8) - -================= -USAGE: BATCH MODE -================= - -Currently, batch mode is only set up for yellowstone. This uses the file -regridbatch.yellowstone.sh as a wrapper to gen_cesm_maps.sh. - -IMPORTANT NOTE: check_maps is NOT run when you run in batch mode. This must be -run as a separate step after you have created the mapping files. See below for -an example of how to do this. - -(1) Modify the #BSUB lines at the top of regridbatch.yellowstone.sh. You need to -at least specify a project number; you may want to change some of the other -settings, too. - -(2) Modify the variables in the section labeled "Set user-defined parameters -here". See the documentation for gen_cesm_maps.sh above for more details on -the parameters that can be set here. - -(3) Submit with: - -bsub < regridbatch.yellowstone.sh - -(4) Run the check_maps tool on the generated mapping files; e.g.: - - files=*.nc - ../check_maps/check_map.sh $files + (currently tools only run in serial due to module issues) diff --git a/tools/mapping/gen_mapping_files/gen_ESMF_mapping_file/.gitignore b/tools/mapping/gen_mapping_files/gen_ESMF_mapping_file/.gitignore index 4e025b24ca3..d7415928b36 100644 --- a/tools/mapping/gen_mapping_files/gen_ESMF_mapping_file/.gitignore +++ b/tools/mapping/gen_mapping_files/gen_ESMF_mapping_file/.gitignore @@ -1,2 +1,5 @@ +.env_mach* +env_mach* +Depends* *.Log *.nc diff --git a/tools/mapping/gen_mapping_files/gen_ESMF_mapping_file/README b/tools/mapping/gen_mapping_files/gen_ESMF_mapping_file/README index e0741bdb2d5..8d23575691d 100644 --- a/tools/mapping/gen_mapping_files/gen_ESMF_mapping_file/README +++ b/tools/mapping/gen_mapping_files/gen_ESMF_mapping_file/README @@ -60,20 +60,14 @@ where default is global --pass2esmf pass options directly to the ESMF tool. - --batch (or -b) - Toggles batch mode usage. If you want to run in batch mode - you need to have a separate batch script for a supported machine - that calls this script interactively - you cannot submit this - script directly to the batch system --clm_name Use the CLM naming convention --serial - For yellowstone batch jobs only! Load the serial ESMF tools rather - than the parallel tools (necessary for mapping grids with a single - point). + Load the serial ESMF tools rather than the parallel tools + (necessary for mapping grids with a single point). --machine (or -mach) - Name of the machine you are running on. Currently supports yellowstone, - geyser, caldera, pronghorn, and jaguar. Note that this script will + Name of the machine you are running on. Currently supports cheyenne, + geyser, caldera, and pronghorn. Note that this script will determine the machine name automatically from the hostfile command. -d toggle debug-only @@ -82,36 +76,9 @@ where You can also set the following env variables: ESMFBIN_PATH - Path to ESMF binaries - (Leave unset on cheyenne, yellowstone, and caldera and the - tool will be loaded from modules) + (Leave unset on cheyenne/caldera/geyser/pronghorn + and the tool will be loaded from modules) MPIEXEC ------ Name of mpirun executable - (default is mpirun.lsf on yellowstone and caldera; if - you run interactively on yellowstone, mpi is not used) - REGRID_PROC -- Number of MPI processors to use (jaguar only!) - (default is 8) - -================= -USAGE: BATCH MODE -================= - -Currently, batch mode is only set up for yellowstone. This uses the file -regridbatch.yellowstone.sh as a wrapper to create_ESMF_map.sh. Before submitting, -make sure you do the following: - -(1) Modify the #BSUB lines at the top of regridbatch.yellowstone.sh. You need to -at least specify a project number; you may want to change some of the other -settings, too. - -(2) Modify the variables in the section labeled "Set user-defined parameters -here". See the documentation for create_ESMF_map.sh above for more details on -the parameters that can be set here. - -(3) Submit with: - -bsub < regridbatch.yellowstone.sh - -(4) Run the check_maps tool on the generated mapping file: - - out_file=*.nc - ../../check_maps/check_map.sh ${out_file} + (ignored if --serial, which is default on cheyenne + login nodes diff --git a/tools/mapping/gen_mapping_files/gen_ESMF_mapping_file/create_ESMF_map.sh b/tools/mapping/gen_mapping_files/gen_ESMF_mapping_file/create_ESMF_map.sh index 60448bf1c8d..5b3989b0e2a 100755 --- a/tools/mapping/gen_mapping_files/gen_ESMF_mapping_file/create_ESMF_map.sh +++ b/tools/mapping/gen_mapping_files/gen_ESMF_mapping_file/create_ESMF_map.sh @@ -4,7 +4,7 @@ # SVN $URL: https://svn-ccsm-models.cgd.ucar.edu/tools/mapping/trunk_tags/mapping_141106/gen_mapping_files/gen_ESMF_mapping_file/create_ESMF_map.sh $ # # Create needed mapping files for gen_domain and coupler mapping -# Currently supported on yellowstone, geyser, caldera, pronghorn, and jaguarpf +# Currently supported on cheyenne, geyser, caldera, and pronghorn # #=============================================================================== echo $0 @@ -18,14 +18,14 @@ usage() { echo '' echo '**********************************************************' echo 'usage:' - echo './create_ESMF_map.sh ' + echo './create_ESMF_map.sh' echo ' A wrapper for the ESMF mapping tool that creates a mapping file' echo ' from the source grid to the destination grid. Specify what type' echo ' of mapping to use with the -maptype flag (aave, blin, bilin,patc,' echo ' nearestdtos, or neareststod)' echo '' - echo 'create_ESMF_map.sh ' - echo ' --filesrc|-fsrc input source grid_filename (required) ' + echo 'create_ESMF_map.sh' + echo ' --filesrc|-fsrc input source grid_filename (required)' echo ' --filedst|-fdst input destination grid_filename (required)' echo ' --namesrc|-nsrc output source name in mapping file (required)' echo ' --namedst|-ndst output destination name in mapping file (required)' @@ -40,13 +40,13 @@ usage() { echo ' [ --large_file|-big ]' echo ' [ --help|-h ]' echo ' [ -v ]' - echo ' ' - echo 'where ' + echo '' + echo 'where' echo ' --filesrc (or -fsrc)' echo ' SCRIP grid format source filename (full pathname)' echo ' --filedst (or -fdst)' echo ' SCRIP grid format destination filename (full pathname)' - echo ' --namesrc (or -nsrc) and --namesrc (or -nsrc) will result in the ' + echo ' --namesrc (or -nsrc) and --namesrc (or -nsrc) will result in the' echo ' following mapping files' echo ' namesrc_TO_namedst_maptype.cdate.nc' echo '' @@ -58,35 +58,27 @@ usage() { echo ' default is global' echo ' --pass2esmf' echo ' pass options directly to the ESMF tool.' - echo ' --batch (or -b)' - echo ' Toggles batch mode usage. If you want to run in batch mode' - echo ' you need to have a separate batch script for a supported machine' - echo ' that calls this script interactively - you cannot submit this' - echo ' script directly to the batch system' echo ' --clm_name' echo ' Use the CLM naming convention' echo ' --serial' - echo ' For yellowstone batch jobs only! Load the serial ESMF tools rather' - echo ' than the parallel tools (necessary for mapping grids with a single' - echo ' point).' + echo ' Load the serial ESMF tools rather than the parallel tools' + echo ' (necessary for mapping grids with a single point).' echo ' --machine (or -mach)' - echo ' Name of the machine you are running on. Currently supports yellowstone,' - echo ' geyser, caldera, pronghorn, and jaguar. Note that this script will' + echo ' Name of the machine you are running on. Currently supports cheyenne,' + echo ' geyser, caldera, and pronghorn. Note that this script will' echo ' determine the machine name automatically from the hostfile command.' echo ' -d' - echo ' toggle debug-only ' - echo ' --help or -h ' + echo ' toggle debug-only' + echo ' --help or -h' echo ' displays this help message' echo '' echo 'You can also set the following env variables:' - echo ' ESMFBIN_PATH - Path to ESMF binaries ' - echo ' (Leave unset on cheyenne/yellowstone/caldera/pronghorn' + echo ' ESMFBIN_PATH - Path to ESMF binaries' + echo ' (Leave unset on cheyenne/caldera/geyser/pronghorn' echo ' and the tool will be loaded from modules)' echo ' MPIEXEC ------ Name of mpirun executable' - echo ' (default is mpirun.lsf on yellowstone/caldera/pronghorn; if' - echo ' you run interactively on yellowstone, mpi is not used)' - echo ' REGRID_PROC -- Number of MPI processors to use (jaguar only!)' - echo ' (default is 8)' + echo ' (ignored if --serial, which is default on cheyenne' + echo ' login nodes' echo '**********************************************************' } @@ -128,7 +120,6 @@ runcmd() { # Process input arguments #------------------------------------------------------------------------------- -interactive="YES" debug="no" verbose="no" type_src="global" @@ -146,9 +137,6 @@ while [ $# -gt 0 ]; do -v ) verbose="YES" ;; - -b|--batch ) - interactive="NO" - ;; --clm_name ) CLMNAME="TRUE" ;; @@ -218,15 +206,16 @@ done # Determine machine to run on #------------------------------------------------------------------------------- +shopt -s extglob if [ $MACH == "UNSET" ]; then hostname=`hostname` case $hostname in - ## yellowstone - ys* ) - MACH="yellowstone" - ;; cheyenne* ) MACH="cheyenne" + cheyenne_login=TRUE + ;; + r+([0-9])i+([0-9])n+([0-9]) ) + MACH="cheyenne" ;; geyser* ) MACH="geyser" @@ -237,26 +226,18 @@ if [ $MACH == "UNSET" ]; then pronghorn* ) MACH="pronghorn" ;; - jaguarpf* ) - MACH="jaguar" - ;; *) - echo "Machine $hostname NOT recognized" + echo "Can not determine machine name from hostname '$hostname'" + exit 1 ;; esac fi -# Machine specific settings: -# 1) can not run in parallel interactively on yellowstone or cheyenne -if [ $MACH == "yellowstone" ] && [ $interactive == "YES" ]; then - serial="TRUE" -fi -if [ $MACH == "cheyenne" ] && [ $interactive == "YES" ]; then - serial="TRUE" -fi -# 2) jaguar requires additional environment var -if [ $MACH == "jaguar" ] && [ -z "$REGRID_PROC" ]; then - REGRID_PROC=8 +# machine-specific restrictions +if [ "$cheyenne_login" == "TRUE" ] && [ "$serial" != "TRUE" ]; then + echo "ERROR: You are trying to use parallal ESMF tools on the cheyenne login node." + echo " Either run with '--serial' or move to a compute node." + exit 1 fi # check for required arguments @@ -315,47 +296,54 @@ fi #------------------------------------------------------------------------------- case $MACH in - ## yellowstone, geyser, caldera, or pronghorn - "cheyenne" | "yellowstone" | "geyser" | "caldera" | "pronghorn" ) - # From tcsh, script will not find module command - # So check to see if module works, otherwise source an init file - module list > /dev/null 2>&1 || source /etc/profile.d/modules.sh - module purge - module load intel - module load nco - if [ $MACH == "cheyenne" ]; then - module load esmf_libs/7.0.0 - else - module load esmf - fi - - if [ $serial == "TRUE" ]; then - module load esmf-7.0.0-ncdfio-uni-O + ## cheyenne, geyser, caldera, or pronghorn + "cheyenne" | "geyser" | "caldera" | "pronghorn" ) + if [ "$serial" == "TRUE" ]; then + # No MPIEXEC if [ -z "$MPIEXEC" ]; then MPIEXEC="" fi + + # run configure in same directory as this script + CWD=`pwd -P` + cd $SDIR + ../../../configure --clean + ../../../configure --mpilib mpi-serial + . .env_mach_specific.sh + cd $CWD else - module load esmf-7.0.0-ncdfio-mpi-O + if [ "$MACH" == "cheyenne" ]; then + # MPIEXEC should be mpirun -np if [ -z "$MPIEXEC" ]; then - MPIEXEC="mpirun.lsf" + if [ -z "$NCPUS" ]; then + NCPUS=1 + fi + MPIEXEC="mpirun -np $NCPUS" fi - fi - ;; - ##jaguarpf - ## NOTE that for jaguarpf there is no batch script for now - "jaguar" ) - if [ -z "$ESMFBIN_PATH" ]; then - module load esmf/5.2.0-p1_with-netcdf_g - ESMFBIN_PATH=$ESMF_BINDIR + # run configure in same directory as this script + CWD=`pwd -P` + cd $SDIR + ../../../configure --clean + ../../../configure --mpilib mpt + . .env_mach_specific.sh + module swap mpt mpt/2.15f + module swap esmf-7.0.0-defio-mpi-O esmf-7.0.0-ncdfio-mpi-O + cd $CWD + else # geyser and caldera still don't work + echo "ERROR: Must use serial implementation of ESMF because module" + echo " changes have made it difficult to run in parallel." + echo " Rerun with --serial" + exit 1 + fi fi - if [ -z "$MPIEXEC" ]; then - MPIEXEC="aprun -n $REGRID_PROC" - fi + # need to load module to access ncatted + module load nco ;; *) echo "Machine $MACH NOT recognized" + exit ;; esac @@ -363,17 +351,6 @@ esac # run ESMF_RegridWeightGen #------------------------------------------------------------------------------- -# Resolve interactive or batch mode command -# NOTE - if you want to run in batch mode - you need to have a separate -# batch file that calls this script interactively - you cannot submit -# this script to the batch system - -if [ "$interactive" = "YES" ]; then - echo "Running interactively" -else - echo "Running in batch mode" -fi - if [ ! -z $ESMFBIN_PATH ]; then ESMF_REGRID="$ESMFBIN_PATH/ESMF_RegridWeightGen" else diff --git a/tools/mapping/gen_mapping_files/gen_ESMF_mapping_file/regridbatch.yellowstone.sh b/tools/mapping/gen_mapping_files/gen_ESMF_mapping_file/regridbatch.yellowstone.sh deleted file mode 100644 index 67977449396..00000000000 --- a/tools/mapping/gen_mapping_files/gen_ESMF_mapping_file/regridbatch.yellowstone.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -# -# -# Batch script to submit to create ESMF mapping file -# -# Set up for yellowstone -# -# yellowstone-specific batch commands: -#BSUB -P P00000000 # project number -#BSUB -n 16 # number of processors -#BSUB -R "span[ptile=16]" -#BSUB -W 1:00 # wall-clock limit -#BSUB -q small # queue -#BSUB -o regrid.%J.out # ouput filename -#BSUB -e regrid.%J.err # error filename -#BSUB -J create_ESMF_map # job name -#BSUB -N # send email upon job completion - -#---------------------------------------------------------------------- - -#---------------------------------------------------------------------- -# Set user-defined parameters here -#---------------------------------------------------------------------- - -griddir="/glade/scratch/mlevy/grids" - -filesrc="$griddir/tx0.1v2_090127.nc" -filedst="$griddir/fv0.9x1.25_070727.nc" -namesrc='tx0.1v2' -namedst='fv0.9x1.25' - -typesrc='global' -typedst='global' -maptype='aave' - -#---------------------------------------------------------------------- -# Done setting user-defined parameters -#---------------------------------------------------------------------- - -#---------------------------------------------------------------------- -# Stuff done in a machine-specific way -#---------------------------------------------------------------------- - -# Determine number of processors we're running on -host_array=($LSB_HOSTS) -REGRID_PROC=${#host_array[@]} - -#---------------------------------------------------------------------- -# Begin general script -#---------------------------------------------------------------------- - -cmdargs="--filesrc $filesrc --filedst $filedst --namesrc $namesrc --namedst $namedst --typesrc $typesrc --typedst $typedst --maptype $maptype --batch" -env REGRID_PROC=$REGRID_PROC ./create_ESMF_map.sh $cmdargs diff --git a/tools/mapping/gen_mapping_files/gen_cesm_maps.sh b/tools/mapping/gen_mapping_files/gen_cesm_maps.sh index b2602979af1..146fedd7a52 100755 --- a/tools/mapping/gen_mapping_files/gen_cesm_maps.sh +++ b/tools/mapping/gen_mapping_files/gen_cesm_maps.sh @@ -1,11 +1,7 @@ #!/bin/bash #=============================================================================== -# SVN $Id: gen_cesm_maps.sh 46158 2013-04-19 18:41:34Z mlevy@ucar.edu $ -# SVN $URL: https://svn-ccsm-models.cgd.ucar.edu/tools/mapping/trunk_tags/mapping_141106/gen_mapping_files/gen_cesm_maps.sh $ -# # Create needed mapping files for gen_domain and coupler mapping -# Currently supported on yellowstone, geyser, caldera, and jaguarpf -# +# Currently supported on cheyenne, geyser, caldera, and prognhorn #=============================================================================== echo $0 date @@ -18,10 +14,10 @@ usage() { echo '' echo '**********************************************************' echo 'usage:' - echo './gen_cesm_maps.sh ' + echo './gen_cesm_maps.sh' echo ' Create a suite of mapping files to use in CESM. Depending on the' echo ' grid files specified, the result will be a subset of the following' - echo ' mapping files: ' + echo ' mapping files:' echo ' * atm -> ocn: conservative, bilinear, patch' echo ' * ocn -> atm: conservative, bilinear' echo ' * atm -> lnd: conservative, bilinear' @@ -32,7 +28,7 @@ usage() { echo ' * lnd -> glc: conservative, bilinear' echo ' * glc -> lnd: conservative, bilinear' echo '' - echo 'gen_cesm_maps.sh ' + echo 'gen_cesm_maps.sh' echo ' --fileatm|-fatm input atm_grid_filename' echo ' --fileocn|-focn input ocn_grid_filename' echo ' --filelnd|-flnd input lnd_grid_filename' @@ -49,66 +45,78 @@ usage() { echo ' [ --batch|-b ]' echo ' [ --help|-h ]' echo ' [ -v ]' - echo ' ' - echo 'where ' - echo ' --fileatm (or -fatm) ' + echo '' + echo 'where' + echo ' --fileatm (or -fatm)' echo ' SCRIP grid format atmosphere filename (full pathname)' - echo ' --fileocn (or -focn) ' + echo ' --fileocn (or -focn)' echo ' SCRIP grid format ocean filename (full pathname)' - echo ' --filelnd (or -flnd) ' + echo ' --filelnd (or -flnd)' echo ' SCRIP grid format land filename (full pathname), must be global' - echo ' --filertm (or -frtm) ' + echo ' --filertm (or -frtm)' echo ' SCRIP grid format runoff filename (full pathname)' - echo ' --fileglc (or -fglc) ' + echo ' --fileglc (or -fglc)' echo ' SCRIP grid format glc filename (full pathname), assumed to be regional' - echo ' --nameatm (or -natm) ' + echo ' --nameatm (or -natm)' echo ' Shortname to use for atm in mapping filename' - echo ' --nameocn (or -nocn) ' + echo ' --nameocn (or -nocn)' echo ' Shortname to use for ocn in mapping filename' - echo ' --namelnd (or -nlnd) ' + echo ' --namelnd (or -nlnd)' echo ' Shortname to use for lnd in mapping filename' - echo ' --namertm (or -nrtm) ' + echo ' --namertm (or -nrtm)' echo ' Shortname to use for rtm in mapping filename' - echo ' --nameglc (or -nglc) ' + echo ' --nameglc (or -nglc)' echo ' Shortname to use for glc in mapping filename' - echo ' --typeocn (or -tocn) ' + echo ' --typeocn (or -tocn)' echo ' ocean grid type, valid values are regional or global' echo ' default is global' - echo ' --typeatm (or -tatm) ' + echo ' --typeatm (or -tatm)' echo ' atm grid type, valid values are regional or global' echo ' default is global' echo ' value must be global if -frtm and -nrtm are specified' - echo ' --nogridcheck ' + echo ' --nogridcheck' echo ' By default, script will run consistency check on new' echo ' maps; this flag disables these checks' - echo ' --batch (or -b) ' - echo ' Toggles batch mode usage. If you want to run in batch mode' - echo ' you need to have a separate batch script for a supported machine' - echo ' that calls this script interactively - you cannot submit this' - echo ' script directly to the batch system' - echo ' -rc ' + echo ' --serial' + echo ' Run the ESMF tools in serial rather than parallel' + echo ' -rc' echo ' Pass the "--recompile" flag to the ESMF tool' echo ' (Only necessary if nothing has been built in ../check_maps/)' - echo ' -d ' - echo ' toggle debug-only ' - echo ' --help or -h ' + echo ' --help or -h' echo ' displays this help message' echo '' echo 'Note: if rtm or glc are specified and lnd is not, then this tool will' echo ' assume lnd and atm are on the same grid.' echo '' echo 'You can also set the following env variables:' - echo ' ESMFBIN_PATH - Path to ESMF binaries ' - echo ' (Leave unset on yellowstone and caldera and the tool' - echo ' will be loaded from modules)' + echo ' ESMFBIN_PATH - Path to ESMF binaries' + echo ' (Known machines will load tools from modules)' echo ' MPIEXEC ------ Name of mpirun executable' - echo ' (default is mpirun.lsf on yellowstone and caldera; if' - echo ' you run interactively on yellowstone, mpi is not used)' - echo ' REGRID_PROC -- Number of MPI processors to use' - echo ' (default is 8)' + echo ' (currently tools only run in serial due to module issues)' echo '**********************************************************' } +#=============================================================================== +# make_map subroutine +#=============================================================================== +make_map() { + make_map_exe=$SDIR/gen_ESMF_mapping_file/create_ESMF_map.sh + fsrc=$1 + nsrc=$2 + fdst=$3 + ndst=$4 + tsrc=$5 + tdst=$6 + map=$7 + if [ "$serial" == "TRUE" ]; then + run_serial="--serial" + else + run_serial="" + fi + $make_map_exe -fsrc $fsrc -nsrc $nsrc -fdst $fdst -ndst $ndst \ + -tsrc $tsrc -tdst $tdst -map $map $run_serial || exit $? +} + #=============================================================================== # runcmd subroutine #=============================================================================== @@ -121,16 +129,11 @@ runcmd() { if [ "$verbose" = "YES" ]; then echo "$cmd" fi - if [ "$debug" != "YES" ]; then - ${cmd} - rc=$? - else - rc=0 - fi + ${cmd} + rc=$? if [ $rc != 0 ]; then - echo "Error status returned from gen_cesm_maps script" - exit 4 -undo + echo "Error status $rc returned from gen_cesm_maps script" + exit $rc fi return 0 } @@ -143,8 +146,6 @@ undo # Process input arguments #------------------------------------------------------------------------------- -interactive="YES" -debug="no" verbose="no" type_atm="global" type_ocn="global" @@ -154,82 +155,83 @@ atm_lnd=0 lnd_rtm=0 ocn_lnd=0 lnd_glc=0 +serial="FALSE" while [ $# -gt 0 ]; do case $1 in - -v) - verbose="YES" + -v) + verbose="YES" ;; - -b|--batch) - interactive="NO" + -focn|--fileocn ) + focn=$2 + shift ;; - -focn|--fileocn ) - focn=$2 - shift + -fatm|--fileatm ) + fatm=$2 + shift ;; - -fatm|--fileatm ) - fatm=$2 - shift + -flnd|--filelnd ) + flnd=$2 + shift ;; - -flnd|--filelnd ) - flnd=$2 - shift + -frtm|--filertm ) + frtm=$2 + shift ;; - -frtm|--filertm ) - frtm=$2 - shift + -fglc|--fileglc ) + fglc=$2 + shift ;; - -fglc|--fileglc ) - fglc=$2 - shift + -nocn|--nameocn ) + nocn=$2 + shift ;; - -nocn|--nameocn ) - nocn=$2 - shift + -natm|--nameatm ) + natm=$2 + shift ;; - -natm|--nameatm ) - natm=$2 - shift + -nlnd|--namelnd ) + nlnd=$2 + shift ;; - -nlnd|--namelnd ) - nlnd=$2 - shift + -nrtm|--namertm ) + nrtm=$2 + shift ;; - -nrtm|--namertm ) - nrtm=$2 - shift + -nglc|--nameglc ) + nglc=$2 + shift ;; - -nglc|--nameglc ) - nglc=$2 - shift + -tocn|--typeocn ) + type_ocn=$2 + shift ;; - -tocn|--typeocn ) - type_ocn=$2 - shift + --serial ) + serial=TRUE + ;; + --recompile|-rc ) + CheckMapsFlag=-rc + echo "Will recompile ESMF gridcheck tool" ;; - --recompile|-rc ) - CheckMapsFlag=-rc - echo "Will recompile ESMF gridcheck tool" + --nogridcheck ) + SkipGridCheck=TRUE + echo "Will not check quality of maps!" ;; - --nogridcheck ) - SkipGridCheck=TRUE - echo "Will not check quality of maps!" + -tatm|--typeatm ) + type_atm=$2 + shift ;; - -tatm|--typeatm ) - type_atm=$2 - shift + -h|--help ) + usage + exit 0 ;; - -h|--help ) - usage - exit 0 - ;; - * ) - echo "****************************" - echo "ERROR:: invalid argument $1" - echo "****************************" - usage - exit 1 + * ) + echo "****************************" + echo "ERROR:: invalid argument $1" + echo "****************************" + usage + exit 1 ;; esac shift @@ -352,29 +354,12 @@ if [ $((atm_ocn+atm_lnd+lnd_rtm+lnd_glc+ocn_lnd)) == 0 ]; then exit 9 fi -# set some defaults -if [ -z "$REGRID_PROC" ]; then - REGRID_PROC=8 -fi - #------------------------------------------------------------------------------- # run ESMF_RegridWeightGen #------------------------------------------------------------------------------- -# Resolve interactive or batch mode command -# NOTE - if you want to run in batch mode - you need to have a separate -# batch file that calls this script interactively - you cannot submit -# this script to the batch system - -if [ "$interactive" = "YES" ]; then - batchrun="" -else - batchrun="--batch" -fi - cdate=`date +%y%m%d` file_list="" -make_map=$SDIR/gen_ESMF_mapping_file/create_ESMF_map.sh #------------------------------------------------------------------------------- # Make Maps @@ -382,40 +367,35 @@ make_map=$SDIR/gen_ESMF_mapping_file/create_ESMF_map.sh if [ ${atm_ocn} == 1 ]; then #--- ocn to atm conservative (area avg?) ------------------------------------- - $make_map -fsrc $focn -nsrc $nocn -fdst $fatm -ndst $natm \ - -tsrc $type_ocn -tdst $type_atm -map aave $batchrun + make_map "$focn" "$nocn" "$fatm" "$natm" "$type_ocn" "$type_atm" "aave" file_list="$file_list map_${nocn}_TO_${natm}_aave.$cdate.nc" #--- ocn to atm bilinear (non-conservative) ---------------------------------- echo "" echo "----------------------------------------------------------" echo "" - $make_map -fsrc $focn -nsrc $nocn -fdst $fatm -ndst $natm \ - -tsrc $type_ocn -tdst $type_atm -map blin $batchrun + make_map "$focn" "$nocn" "$fatm" "$natm" "$type_ocn" "$type_atm" "blin" file_list="$file_list map_${nocn}_TO_${natm}_blin.$cdate.nc" #--- atm to ocn conservative (area avg?) ------------------------------------- echo "" echo "----------------------------------------------------------" echo "" - $make_map -fsrc $fatm -nsrc $natm -fdst $focn -ndst $nocn \ - -tsrc $type_atm -tdst $type_ocn -map aave $batchrun + make_map "$fatm" "$natm" "$focn" "$nocn" "$type_atm" "$type_ocn" "aave" file_list="$file_list map_${natm}_TO_${nocn}_aave.$cdate.nc" #--- atm to ocn bilinear (non-conservative) ---------------------------------- echo "" echo "----------------------------------------------------------" echo "" - $make_map -fsrc $fatm -nsrc $natm -fdst $focn -ndst $nocn \ - -tsrc $type_atm -tdst $type_ocn -map blin $batchrun + make_map "$fatm" "$natm" "$focn" "$nocn" "$type_atm" "$type_ocn" "blin" file_list="$file_list map_${natm}_TO_${nocn}_blin.$cdate.nc" #--- atm to ocn patch mapping (non-conservative) ------------------------------- echo "" echo "----------------------------------------------------------" echo "" - $make_map -fsrc $fatm -nsrc $natm -fdst $focn -ndst $nocn \ - -tsrc $type_atm -tdst $type_ocn -map patc $batchrun + make_map "$fatm" "$natm" "$focn" "$nocn" "$type_atm" "$type_ocn" "patc" file_list="$file_list map_${natm}_TO_${nocn}_patc.$cdate.nc" fi @@ -426,24 +406,21 @@ if [ $atm_lnd == 1 ]; then echo "----------------------------------------------------------" echo "" fi - $make_map -fsrc $fatm -nsrc $natm -fdst $flnd -ndst $nlnd \ - -tsrc $type_atm -tdst global -map aave $batchrun + make_map "$fatm" "$natm" "$flnd" "$nlnd" "$type_atm" "global" "aave" file_list="$file_list map_${natm}_TO_${nlnd}_aave.$cdate.nc" #--- atm to lnd bilinear (non-conservative) ---------------------------------- echo "" echo "----------------------------------------------------------" echo "" - $make_map -fsrc $fatm -nsrc $natm -fdst $flnd -ndst $nlnd \ - -tsrc $type_atm -tdst global -map blin $batchrun + make_map "$fatm" "$natm" "$flnd" "$nlnd" "$type_atm" "global" "blin" file_list="$file_list map_${natm}_TO_${nlnd}_blin.$cdate.nc" #--- lnd to atm conservative (area avg?) ------------------------------------- echo "" echo "----------------------------------------------------------" echo "" - $make_map -fsrc $flnd -nsrc $nlnd -fdst $fatm -ndst $natm \ - -tsrc global -tdst $type_atm -map aave $batchrun + make_map "$flnd" "$nlnd" "$fatm" "$natm" "global" "$type_atm" "aave" file_list="$file_list map_${nlnd}_TO_${natm}_aave.$cdate.nc" fi @@ -455,8 +432,7 @@ if [ $ocn_lnd == 1 ]; then echo "----------------------------------------------------------" echo "" fi - $make_map -fsrc $focn -nsrc $nocn -fdst $flnd -ndst $nlnd \ - -tsrc $type_ocn -tdst global -map aave $batchrun + make_map "$focn" "$nocn" "$flnd" "$nlnd" "$type_ocn" "global" "aave" file_list="$file_list map_${nocn}_TO_${nlnd}_aave.$cdate.nc" fi @@ -467,16 +443,14 @@ if [ $lnd_rtm == 1 ]; then echo "----------------------------------------------------------" echo "" fi - $make_map -fsrc $flnd -nsrc $nlnd -fdst $frtm -ndst $nrtm \ - -tsrc global -tdst global -map aave $batchrun + make_map "$flnd" "$nlnd" "$frtm" "$nrtm" "global" "global" "aave" file_list="$file_list map_${nlnd}_TO_${nrtm}_aave.$cdate.nc" #--- rtm to lnd conservative (area avg) ------------------------------------- echo "" echo "----------------------------------------------------------" echo "" - $make_map -fsrc $frtm -nsrc $nrtm -fdst $flnd -ndst $nlnd \ - -tsrc global -tdst global -map aave $batchrun + make_map "$frtm" "$nrtm" "$flnd" "$nlnd" "global" "global" "aave" file_list="$file_list map_${nrtm}_TO_${nlnd}_aave.$cdate.nc" fi @@ -488,24 +462,21 @@ if [ $lnd_glc == 1 ]; then echo "----------------------------------------------------------" echo "" fi - $make_map -fsrc $fglc -nsrc $nglc -fdst $flnd -ndst $nlnd \ - -tsrc regional -tdst global -map aave $batchrun + make_map "$fglc" "$nglc" "$flnd" "$nlnd" "regional" "global" "aave" file_list="$file_list map_${nglc}_TO_${nlnd}_aave.$cdate.nc" #--- lnd to glc conservative (area avg?) ------------------------------------- echo "" echo "----------------------------------------------------------" echo "" - $make_map -fsrc $flnd -nsrc $nlnd -fdst $fglc -ndst $nglc \ - -tsrc global -tdst regional -map aave $batchrun + make_map "$flnd" "$nlnd" "$fglc" "$nglc" "global" "regional" "aave" file_list="$file_list map_${nlnd}_TO_${nglc}_aave.$cdate.nc" #--- lnd to glc bilinear (non-conservative) ---------------------------------- echo "" echo "----------------------------------------------------------" echo "" - $make_map -fsrc $flnd -nsrc $nlnd -fdst $fglc -ndst $nglc \ - -tsrc global -tdst regional -map blin $batchrun + make_map "$flnd" "$nlnd" "$fglc" "$nglc" "global" "regional" "blin" file_list="$file_list map_${nlnd}_TO_${nglc}_blin.$cdate.nc" fi diff --git a/tools/mapping/gen_mapping_files/regridbatch.yellowstone.sh b/tools/mapping/gen_mapping_files/regridbatch.yellowstone.sh deleted file mode 100644 index 091c7f28533..00000000000 --- a/tools/mapping/gen_mapping_files/regridbatch.yellowstone.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -# -# -# Batch script to submit to create suite of ESMF mapping files -# -# Set up for yellowstone -# -# yellowstone-specific batch commands: -#BSUB -P P00000000 # project number -#BSUB -n 16 # number of processors -#BSUB -R "span[ptile=16]" -#BSUB -W 1:00 # wall-clock limit -#BSUB -q small # queue -#BSUB -o regrid.%J.out # ouput filename -#BSUB -e regrid.%J.err # error filename -#BSUB -J gen_cesm_maps # job name -#BSUB -N # send email upon job completion - -#---------------------------------------------------------------------- - -#---------------------------------------------------------------------- -# Set user-defined parameters here -#---------------------------------------------------------------------- - -griddir1="/glade/scratch/mlevy/grids" -griddir2="/glade/scratch/mlevy/grids" - -fileocn="${griddir1}/tx0.1v2_090127.nc" -fileatm="${griddir1}/CESM/cseg/mapping/grids/fv0.9x1.25_070727.nc" -filertm="${griddir2}/SCRIPgrid_0.5x0.5_nomask_c110308.nc" -nameocn='tx0.1v2' -nameatm='fv0.9x1.25' -namertm='r0.5x0.5' - -use_rtm=1 -typeocn='global' -typeatm='global' - -#---------------------------------------------------------------------- -# Done setting user-defined parameters -#---------------------------------------------------------------------- - -#---------------------------------------------------------------------- -# Stuff done in a machine-specific way -#---------------------------------------------------------------------- - -# Determine number of processors we're running on -host_array=($LSB_HOSTS) -REGRID_PROC=${#host_array[@]} - -#---------------------------------------------------------------------- -# Begin general script -#---------------------------------------------------------------------- - -cmdargs="--fileocn $fileocn --fileatm $fileatm --nameocn $nameocn --nameatm $nameatm --typeocn $typeocn --typeatm $typeatm" -if [ $use_rtm == 1 ]; then - cmdargs="$cmdargs --filertm $filertm --namertm $namertm" -fi -cmdargs="$cmdargs --batch --nogridcheck" -env REGRID_PROC=$REGRID_PROC ./gen_cesm_maps.sh $cmdargs diff --git a/tools/mapping/gen_mapping_files/runoff_to_ocn/.gitignore b/tools/mapping/gen_mapping_files/runoff_to_ocn/.gitignore index 656541ef22b..fb6d20ac265 100644 --- a/tools/mapping/gen_mapping_files/runoff_to_ocn/.gitignore +++ b/tools/mapping/gen_mapping_files/runoff_to_ocn/.gitignore @@ -3,6 +3,7 @@ runoff_map obj src/*.o src/*.mod +src/*.optrpt src/Macros.make src/.env_mach* src/env_mach* diff --git a/tools/mapping/gen_mapping_files/runoff_to_ocn/src/Makefile b/tools/mapping/gen_mapping_files/runoff_to_ocn/src/Makefile index baf1f6cf754..4eaa62b62c3 100644 --- a/tools/mapping/gen_mapping_files/runoff_to_ocn/src/Makefile +++ b/tools/mapping/gen_mapping_files/runoff_to_ocn/src/Makefile @@ -134,7 +134,7 @@ endif .PHONY: clean clean: - $(RM) -f *.f *.f90 *.d *.mod $(OBJS) $(EXEC) $(DEPGEN) + $(RM) -f *.f *.f90 *.d *.mod *.optrpt $(OBJS) $(EXEC) $(DEPGEN) .PHONY: distclean distclean: clean diff --git a/tools/mapping/map_field/.gitignore b/tools/mapping/map_field/.gitignore index 8ebbdfcfc21..02b7b9bac2c 100644 --- a/tools/mapping/map_field/.gitignore +++ b/tools/mapping/map_field/.gitignore @@ -3,4 +3,5 @@ src/env_mach* src/Macros.make src/Depends* src/*.o +src/*.optrpt map_field diff --git a/tools/mapping/map_field/README b/tools/mapping/map_field/README index b040348da03..ff43aa9cf47 100644 --- a/tools/mapping/map_field/README +++ b/tools/mapping/map_field/README @@ -37,23 +37,17 @@ The following files are read The following files are created output_file -======= -EXAMPLE -======= - -To build: +============ +HOW TO BUILD +============ -> cd src -> setenv CIMEROOT ~/cime -> setenv CIME_MODEL cesm -> $CIMEROOT/toolsq/configure --machine yellowstone --macros-format Makefile -> source ./.env_mach_specific.sh -> gmake -> cd ../ +See INSTALL file in this directory -To run: +========== +HOW TO RUN +========== -> ./map_field -m "/glade/p/cesm/cseg/inputdata/cpl/cpl6/map_ar9v4_to_wr50a_aave_da_110107.nc" -if "/glade/u/home/tcraig/racm_masks_121108.nc" -iv POP_MASK -of x1.nc -ov atm_pop_frac +$ ./map_field -m "/glade/p/cesm/cseg/inputdata/cpl/cpl6/map_ar9v4_to_wr50a_aave_da_110107.nc" -if "/glade/u/home/tcraig/racm_masks_121108.nc" -iv POP_MASK -of x1.nc -ov atm_pop_frac ===== NOTES diff --git a/tools/mapping/map_field/src/Makefile b/tools/mapping/map_field/src/Makefile index 27b53b6128f..fe7035234a8 100644 --- a/tools/mapping/map_field/src/Makefile +++ b/tools/mapping/map_field/src/Makefile @@ -143,7 +143,7 @@ $(EXENAME): $(OBJS) $(LINKER) -o $@ $(OBJS) $(SLIBS) $(LDFLAGS) clean: - $(RM) -f $(OBJS) $(EXENAME) *.mod + $(RM) -f $(OBJS) $(EXENAME) *.mod *.optrpt distclean: clean ../../../configure --clean