diff --git a/model/bin/README.md b/model/bin/README.md index d57dca8e1..e410e6462 100644 --- a/model/bin/README.md +++ b/model/bin/README.md @@ -1,9 +1,9 @@ # About the bin directory -This is the WW3 bin directory which mostly serves to create the make file -and set up the environment. Below we have three sections, build environment -varibles, quick start instructions and information from various centers that -use WW3. +This is the WW3 bin directory which mostly serves to provide information +and a few generic utilities. Below we have three sections, CMAKE build +information, quick start instructions and information from various centers +that use WW3. ## CMake Build @@ -22,6 +22,10 @@ make install The CMake build builds all available executables with the given switches. + + +## TODO: Update this section for CMAKE or deleted + # Build Enivronment Variables This is the WW3 bin directory which mostly serves to create the make file @@ -29,11 +33,6 @@ and set up the environment WW3 build can have the following env variables set: -## Optional variable to use with any configuration: - -WW3_PARCOMPN = - - ## To build NetCDF executables you need: The requirements for NetCDF are: @@ -61,20 +60,6 @@ If using NCEP hpc-stack, you just need to set the following: the other vairables should already be appropriately set. -# Quick Start for building WW3 - -After cloning and changing into the WW3 directory: - -Run the w3_setup script: - - ./model/bin/w3_setup model -c -s - -Build a WW3 exe after setting up any appropraite environment variables described above. - - cd model/bin/ - ./w3_make ww3_grid - - # Below is information about various centers use of WW3: ## Information from Ifremer: diff --git a/model/bin/ad3.tmpl b/model/bin/ad3.tmpl deleted file mode 100755 index e8fc59617..000000000 --- a/model/bin/ad3.tmpl +++ /dev/null @@ -1,410 +0,0 @@ -#!/bin/bash -# --------------------------------------------------------------------------- # -# ad3 : Run fortran CPP preprocessor on a single WAVEWATCH III # -# source code file. Switches are set in the file 'switch', which # -# has to be in the "bin" directory. After the preprocessing the code # -# is compiled using the script comp in the "bin" directory. # -# # -# use : ad3 basename [itest [icomp]] # -# basename: name of source code file without the '.F90' extension. # -# file with .f or .f90 extension is not preprocessed. # -# file with .c extension uses standard cc compiler. # -# itest : test output switch. # -# not defind or 0 : no test output # -# all other : verbose mode # -# icomp : compiling switch. # -# not defind or 0 : compile. # -# all other : do not compile. # -# # -# error codes : 1 : input error # -# 2 : no environment file $ww3_env found. # -# 3 : error in creating scratch directory. # -# 4 : w3adc error. # -# 5 : compiler error. # -# # -# programs used : # -# comp : compiler script. # -# # -# remarks : # -# # -# - Do not use itest in w3adc to avoid spurious error messages. # -# - The main WAVEWATCH directory ($main_dir) is obtained from the setup # -# file $ww3_env, as is the scratch directory ($temp_dir). The following # -# directories are used : # -# $main_dir/src : Raw FORTRAN file ($basename.F90). # -# $main_dir/bin : File with preprocessor switches 'switch', and # -# compiler script 'comp'. # -# $main_dir/obj : Final object modules ($basename.o). # -# $main_dir/mod : Final modules (*.mod). # -# # -# The following temporary files (in $temp_dir) are used and are removed # -# only if the corresponding step of ad3 is ompleted successfully : # -# comp.out : input file for comp. # -# comp.err : eror file for comp. # -# comp.stat : status file of compiler, containing number of errors # -# and number of warnings (generated by comp). # -# # -# - Check the compress variable in section 1.b to print or suppress the_ # -# documentation in the clean FORTRAN files. # -# # -# Hendrik L. Tolman # -# May 2009 # -# January 2014 # -# # -# Copyright 2009-2014 National Weather Service (NWS), # -# National Oceanic and Atmospheric Administration. All rights # -# reserved. WAVEWATCH III is a trademark of the NWS. # -# No unauthorized use without permission. # -# # -# --------------------------------------------------------------------------- # - - -# --------------------------------------------------------------------------- # -# 1. Preparations # -# --------------------------------------------------------------------------- # -# 1.a Check and process input - - if [ "$#" -gt '3' ] || [ "$#" -lt 1 ] - then - echo "usage: ad3 basename [itest [icomp]]" 1>&2 ; exit 1 - fi - - name=$1 - if [ "$#" -ge '2' ] - then - itst=$2 - else - itst='0' - fi - if [ "$#" = '3' ] - then - icmp=$3 - else - icmp='0' - fi - -# 1.b Internal variables - - - - - - - - - - - - - - - - - - - - - - - - - - - - - switch="switch" # file containing switches - compress=0 # source code compression par in w3adc - # if not 0, documentaion removed from .f90 file - -# 1.d Get data from setup file - - - - - - - - - - - - - - - - - - - - - - - - - - source $(dirname $0)/w3_setenv - main_dir=$WWATCH3_DIR - temp_dir=$WWATCH3_TMP - source=$WWATCH3_SOURCE - list=$WWATCH3_LIST - -# 1.d Set up paths etc. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - path_b="$main_dir/bin" - path_w="$( cd $temp_dir && pwd )" - path_i="$main_dir/src" - path_o="$main_dir/obj" - path_m="$main_dir/mod" - path_e="$main_dir/exe" - if [ -n "`echo $name | grep scrip_ 2>/dev/null`" ] - then - path_i="$path_i/SCRIP" - fi - if [ ${name:0:3} = 'yow' ] - then - path_i="$path_i/PDLIB" - fi - - if [ -z "$(env | grep switch_file)" ] - then - switch_file=$main_dir/bin/$switch - fi - - sw_str=$(cat $switch_file) - - if [ ! -d $path_w ] - then - if ! `mkdir $path_w` - then - echo ' *** w3adc error ***' - echo " Cannot create $path_w" - exit 3 - fi - fi - -# 1.e Test necessity of running w3adc - - - - - - - - - - - - - - - - - - - - - - if [ -f $path_i/$name.F90 ] - then - w3adc='yes' - idstr= - else - w3adc='no' - idstr='[no w3adc]' - fi - -# 1.f Set appropriate Fortran file suffix - - - - - - - - - - - - - - - - - - - - suffixes="ftn f F f90 F90 c" - fexti=none - for s in $suffixes - do - if [ -f $path_i/$name.$s ] - then - fexti=$s - break - fi - done - if [ "$fexti" = 'none' ] - then - echo ' *** ad3 error ***' - echo " Source file $path_i/$name.* not found" - echo " Source file suffixes checked: $suffixes" - exit 2 - fi - if [ "$fexti" = 'ftn' ] - then - fexto=F90 - else - fexto=$fexti - fi - fext=$fexto - -# 1.g Output - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - echo "ad3 : processing $name $idstr" - - if [ "$itst" != '0' ] - then - echo ' ' ; echo 'Test output ad3 ' ; echo '----------------' - echo " bin directory : $path_b " - echo " work directory : $path_w " - echo " input directory : $path_i " - echo " object directory : $path_o " - echo " module directory : $path_m " - echo " executable dir. : $path_e " - echo " switches file : $switch " ; echo ' ' - echo " switches : $sw_str" - echo ' ' - fi - -# 1.h Final preparations - - - - - - - - - - - - - - - - - - - - - - - - - - - - - cd $path_w - rm -f $name.$fext - rm -f $name.l - -# --------------------------------------------------------------------------- # -# 2. Run w3adc # -# --------------------------------------------------------------------------- # -# 2.a Make input file - - if [ "$w3adc" = 'yes' ] - then - -# 2.b Run CPP preprocessor - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #Generate list of CPP Flags based on switches: - CPPFLAGS=() - for sw in $sw_str - do - CPPFLAGS+=("-DW3_$sw") - done - - CPPFLAGS+=("-D__WW3_SWITCHES__='$sw_str'") - - # Also set endianness: - CPPFLAGS+=("-DENDIANNESS=''") - - "${CPPFLAGS[@]}" $path_i/$name.F90 $name.F90 - mv $name.i $name.F90 - -# 2.c Test the output of w3adc - - - - - - - - - - - - - - - - - - - - - - - - - - if [ ! -f $name.$fext ] - then - echo ' *** w3adc error ***' - fi - - if [ "`wc -l $name.$fext | awk '{ print $1}'`" -lt '2' ] - then - echo ' *** w3adc error ***' - echo " file $name.$fext not found (2)." - fi - - else - -# 2.f No w3adc, just copy file - - - - - - - - - - - - - - - - - - - - - - - - - - cp $path_i/$name.$fext . - - fi - - if [ ! -f $name.$fext ] - then - echo ' *** adc error ***' - echo " file $name.$fext not found." - exit 5 - fi - -# 2.g Stop if requested - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if [ "$icmp" != '0' ] - then - exit 0 - fi - - rm -f $path_o/$name.o - ## Chris B: Dont delete *.mod - could clobber files in parallel make - ## Need to delete specific mod file that could be upper/lower/mixed case! -# rm -f *.mod ## too indiscriminate - - ## Using find -iname most succinct, but maybe not all version of find have - ## the -iname option? -# find . -iname "${name}.mod" -delete # not all versions of find have -iname? - - # Fall back on grep -i - mods=`ls *.mod 2> /dev/null | grep -i "${name}.mod"` - if [ -n ${mods} ]; then - rm -f ${mods} - fi - -# --------------------------------------------------------------------------- # -# 3. Compile source code f / f90 # -# --------------------------------------------------------------------------- # - -export fext # for use by comp -export path_m # for use by comp -export path_i # for use by comp - -if [ ! -f $name.c ] -then - -# 3.a Run compile program - - error='0' - - $path_b/comp $name > comp.out.$name 2> comp.err.$name - OK="$?" - - -# 3.b Error escape location - - - - - - - - - - - - - - - - - - - - - - - - - - if [ "$OK" != '0' ] - then - echo ' *** compile error ***' - echo ' error in comp' - echo '--- comp output -------------------------------------------------' - cat comp.out.$name - echo '--- comp error output -------------------------------------------' - cat comp.err.$name - echo '-----------------------------------------------------------------' - error='6' - rm -f comp.stat.$name - fi - rm -f comp.out.$name - rm -f comp.err.$name - - -# 3.c Check comp.stat - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if [ -f comp.stat.$name ] - then - nr_err="$(grep -i error comp.stat.$name | awk '{ print $2 }')" - nr_war="$(grep -i warning comp.stat.$name | awk '{ print $2 }')" - rm -f comp.stat.$name - if [ "$nr_err" != '0' ] - then - echo " $nr_err errors found, see $path_w/$name.err" - list='yes' - else - if [ "$nr_war" != '0' ] - then - echo " $nr_war warnings found, see $path_w/$name.out" - list='yes' - fi - fi - else - echo ' *** compile error ***' - echo " file comp.stat.$name not found" - error='5' - nr_err='1' - rm -f $name.o - fi - -# 3.d process object file - - - - - - - - - - - - - - - - - - - - - - - - - - - - if [ "$nr_err" != '0' ] && [ ! -f $name.o ] && [ "$error" = '0' ] - then - echo ' *** compile error ***' - echo " file $name.o not found" - error='5' - fi - - if [ "$nr_err" != '0' ] - then - rm -f $name.o - else - mv $name.o $path_o/. - ## ChrisB: Don't move all module files...could break parallel make. - ## Just target specific module file (could be mixed case filename - ## depending on compiler - use case insensitive find): -# mods=`ls *.mod 2> /dev/null` - - ## Using find -iname most succinct, but maybe not all version of find have - ## the -iname option? -# mods=`find . -iname "${name}.mod"` # not all versions of find have -iname? - - # Fall back on grep -i - mods=`ls *.mod 2> /dev/null | grep -i "${name}.mod"` - if [ -n "$mods" ] - then - for mod in $mods - do - mv $mod $path_m/. - echo " $mod" - done - fi - fi - -# Note: the need for moving the .mod file and therefore the printing of the -# $mod depend on the compiler behavior. - - -# 3.e process output files - - - - - - - - - - - - - - - - - - - - - - - - - - - - rm -f $name.o - - if [ "$source" != 'yes' ] - then - rm -f $name.f $name.$fext - fi - if [ "$list" != 'yes' ] && [ "$error" = '0' ] - then - rm -f $name.l - fi - - exit $error - -# --------------------------------------------------------------------------- # -# 4. Compile source code c # -# --------------------------------------------------------------------------- # -# For now only diagnostics / profiling codes compiled with simple cc compiler - -else - -# 4.a Compile - - cc -c $name.c - -# 4.b Save object file - - if [ -f $name.o ] - then - mv $name.o $path_o/. - else - echo ' *** compile error ***' - echo " file $name.o not found" - error='6' - fi - -fi - -# End of ad3 ---------------------------------------------------------------- # diff --git a/model/bin/all_switches b/model/bin/all_switches deleted file mode 100755 index 72e645e92..000000000 --- a/model/bin/all_switches +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash -# --------------------------------------------------------------------------- # -# all_switches : Make a list of all switches hat are found in the program # -# (.F90) files of WAVEWATCH III. # -# # -# use : all_switches # -# # -# Hendrik L. Tolman # -# May 2009 # -# # -# Copyright 2009 National Weather Service (NWS), # -# National Oceanic and Atmospheric Administration. All rights # -# reserved. WAVEWATCH III is a trademark of the NWS. # -# No unauthorized use without permission. # -# # -# --------------------------------------------------------------------------- # - - -# --------------------------------------------------------------------------- # -# 1. Preparations # -# --------------------------------------------------------------------------- # - -# 1.a ID header - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - echo ' ' - echo 'Find all switches in WAVEWATCH III' - echo '----------------------------------' - -# 1.b Get data from setup file - - - - - - - - - - - - - - - - - - - - - - - - - - source $(dirname $0)/w3_setenv - main_dir=$WWATCH3_DIR - temp_dir=$WWATCH3_TMP - source=$WWATCH3_SOURCE - list=$WWATCH3_LIST - -# --------------------------------------------------------------------------- # -# 2. Strip all switches from sources # -# --------------------------------------------------------------------------- # - - cd $main_dir/src - - all=`sed -n '/^!\/[[:alpha:]]/'p *.ftn | awk '{print $1}' | \ - awk -F'!/' 'BEGIN{OFS="\n"}{$1=$1; print $0}' | \ - sed 's/^!\///' | sed 's/[\/!].*$//' | sort -u` - - set $all - -# --------------------------------------------------------------------------- # -# 3. Display in organized manner # -# --------------------------------------------------------------------------- # - - last= - line=' ' - - while [ "$#" -gt '0' ] - do - next=$1 ; shift - if [ -z "$last" ] ; then - line="$line $next" - else - if [ "`echo $last | cut -c1-1`" != "`echo $next | cut -c1-1`" ] ; then - echo "$line" - line=' ' - fi - line="$line $next" - fi - last=$next - done - - echo "$line" - - echo ' ' - echo 'end of all_switches' - -# End of all_switches ------------------------------------------------------- # diff --git a/model/bin/build_utils.sh b/model/bin/build_utils.sh deleted file mode 100755 index fe65b6d61..000000000 --- a/model/bin/build_utils.sh +++ /dev/null @@ -1,1037 +0,0 @@ -#!/bin/bash -e -# --------------------------------------------------------------------------- # -# build_utils.sh : Shell functions that can be used by multiple scripts # -# for building the model # -# # -# programs used : w3_new Touches the correct files if compiler switches # -# have been changed. # -# # -# error codes : all error output goes directly to screen in w3_make. # -# # -# Hendrik L. Tolman # -# May 2009 # -# March 2014 # -# # -# Copyright 2009-2014 National Weather Service (NWS), # -# National Oceanic and Atmospheric Administration. All rights # -# reserved. WAVEWATCH III is a trademark of the NWS. # -# No unauthorized use without permission. # -# # -# --------------------------------------------------------------------------- # - -# --------------------------------------------------------------------------- # -# 1. Check switches # -# Performs quality check on switches defined in variable $switch. Checks # -# to make sure that swtich choices are compatible and that only the valid # -# switches have been identified. Groups switched into different variables # -# by type # -# --------------------------------------------------------------------------- # - - - -check_switches() - { - - # 1.a Step through categories - - for type in nco grib scrip scripnc \ - shared mpp mpiexp thread GSE prop smcg \ - stress s_ln sterm stab s_nl snls s_bot s_db miche s_tr s_bs \ - dstress s_ice s_is reflection \ - wind windx wcor rwind curr currx mgwind mgprop mggse \ - subsec tdyn dss0 pdif tide refrx ig rotag nnt mprf \ - cou oasis agcm ogcm igcm trknc setup pdlib ddlib memck uost rstwind b4b - do - -# 1.a.1 Group switches by category - - case $type in -#sort:nco: - nco ) TY='upto1' - ID='NCO modifications' - TS='NCO' - OK='NCO' ;; -#sort:grib: - grib ) TY='one' - ID='GRIB package' - OK='NOGRB NCEP2' ;; -#sort:scrip: - scrip ) TY='upto1' - ID='grid to grid interpolation' - TS='SCRIP' - OK='SCRIP' ;; -#sort:scripnc: - scripnc ) TY='upto1' - ID='use of netcdf in grid to grid interpolation' - TS='SCRIPNC' - OK='SCRIPNC' ;; -#sort:shared: - shared ) TY='one' - ID='shared / distributed memory' - OK='SHRD DIST' ;; -#sort:mpp: - mpp ) TY='one' - ID='message passing protocol' - OK='SHRD MPI' ;; -#sort:mpiexp: - mpiexp ) TY='upto1' - ID='experimental MPI option' - TS='MPIBDI' - OK='MPIBDI' ;; -#sort:thread: - thread ) TY='upto2' - ID='directive controlled threading' - TS='OMP' - OK='OMPG OMPH' ;; -#sort:GSE: - GSE ) TY='one' - ID='GSE aleviation' - OK='PR0 PR1 PR2 PR3' ;; -#sort:prop: - prop ) TY='one' - ID='propagation scheme' - OK='PR0 PR1 UQ UNO' ;; -#sort:smcg: - smcg ) TY='upto1' - ID='SMC grid' - TS='SMC' - OK='SMC' ;; -#sort:stress: - stress ) TY='one' - ID='stress computation' - OK='FLX0 FLX1 FLX2 FLX3 FLX4 FLX5' ;; -#sort:dstress: - dstress) TY='upto1' - ID='Diagnostic stress comp' - TS='FLD' - OK='FLD0 FLD1 FLD2' ;; -#sort:s_ln: - s_ln ) TY='one' - ID='linear input' - OK='LN0 SEED LN1' ;; -#sort:sterm: - sterm ) TY='one' - ID='input/whitecapping' - OK='ST0 ST1 ST2 ST3 ST4 ST6' ;; -#sort:stab: - stab ) TY='upto1' - ID='stability correction' - TS='STAB' - OK='STAB0 STAB2 STAB3' ;; -#sort:s_nl: - s_nl ) TY='one' - ID='quadruplet interactions' - OK='NL0 NL1 NL2 NL3 NL4 NL5' ;; -#sort:snls: - snls ) TY='upto1' - ID='quadruplet smoother' - TS='NLS' - OK='NLS' ;; -#sort:s_bot: - s_bot ) TY='one' - ID='bottom friction' - OK='BT0 BT1 BT4 BT8 BT9' ;; -#sort:s_db: - s_db ) TY='one' - ID='depth-induced breaking' - OK='DB0 DB1' ;; -#sort:miche: - miche ) TY='upto1' - ID='Miche style limiter' - TS='MLIM' - OK='MLIM' ;; -#sort:s_tr: - s_tr ) TY='one' - ID='triad interactions' - OK='TR0 TR1' ;; -#sort:s_bs: - s_bs ) TY='one' - ID='bottom scattering' - OK='BS0 BS1' ;; -#sort:s_ice: - s_ice ) TY='one' - ID='ice sink term' - OK='IC0 IC1 IC2 IC3 IC4 IC5' ;; -#sort:s_is: - s_is ) TY='one' - ID='ice scattering term' - OK='IS0 IS1 IS2' ;; -#sort:reflection: - reflection ) TY='one' - ID='wave reflections' - OK='REF0 REF1' ;; -#sort:wind: - wind ) TY='one' - ID='wind interpolation in time' - OK='WNT0 WNT1 WNT2' ;; -#sort:windx: - windx ) TY='one' - ID='wind interpolation in space' - OK='WNX0 WNX1 WNX2' ;; -#sort:wcor: - wcor ) TY='upto1' - ID='wind speed correction' - TS='WCOR' - OK='WCOR' ;; -#sort:rwind: - rwind ) TY='upto1' - ID='wind vs. current definition' - TS='RWND' - OK='RWND' ;; -#sort:rstwind: - rstwind ) TY='upto1' - ID='wind in restart for wmesmf' - TS='WRST' - OK='WRST' ;; -#sort:curr: - curr ) TY='one' - ID='current interpolation in time' - OK='CRT0 CRT1 CRT2' ;; -#sort:currx: - currx ) TY='one' - ID='current interpolation in space' - OK='CRX0 CRX1 CRX2' ;; -#sort:mgwind: - mgwind ) TY='upto1' - ID='moving grid wind correction' - TS='MGW' - OK='MGW' ;; -#sort:mgprop: - mgprop ) TY='upto1' - ID='moving grid propagation correction' - TS='MGP' - OK='MGP' ;; -#sort:mggse: - mggse ) TY='upto1' - ID='moving grid GSE correction' - TS='MGG' - OK='MGG' ;; -#sort:subsec: - subsec ) TY='upto1' - ID='sub-second time stepping' - TS='SEC1' - OK='SEC1' ;; -#sort:tdyn: - tdyn ) TY='upto1' - ID='dynamic diffusion time' - TS='TDYN' - OK='TDYN' ;; -#sort:dss0: - dss0 ) TY='upto1' - ID='diffusion tensor' - TS='DSS0' - OK='DSS0' ;; -#sort:pdif: - pdif ) TY='upto1' - ID='propagation diffusion' - TS='XW' - OK='XW0 XW1' ;; -#sort:tide: - tide ) TY='upto1' - ID='use of tidal analysis' - TS='TIDE' - OK='TIDE' ;; -#sort:refrx: - refrx ) TY='upto1' - ID='use of spectral refraction @C/@x' - TS='REFRX' - OK='REFRX' ;; -#sort:ig: - ig ) TY='upto1' - ID='infragravity waves' - TS='IG1' - OK='IG1' ;; -#sort:rotag: - rotag ) TY='upto1' - ID='rotated grid' - TS='RTD' - OK='RTD' ;; -#sort:nnt: - nnt ) TY='upto1' - ID='NN training/test data generation' - TS='NNT' - OK='NNT' ;; -#sort:mprf: - mprf ) TY='upto1' - ID='multi-grid model profiling' - TS='MPRF' - OK='MPRF' ;; -#sort:agcm: - agcm ) TY='upto1' - ID='atmospheric circulation model' - TS='OASACM' - OK='OASACM' ;; -#sort:ogcm: - ogcm ) TY='upto1' - ID='ocean circulation model' - TS='OASOCM' - OK='OASOCM' ;; -#sort:igcm: - igcm ) TY='upto1' - ID='ice model' - TS='OASICM' - OK='OASICM' ;; -#sort:cou: - cou ) TY='upto1' - ID='use of the coupler' - TS='COU' - OK='COU' ;; -#sort:oasis: - oasis ) TY='upto1' - ID='type of coupler' - TS='OASIS' - OK='OASIS' ;; -#sort:trknc: - trknc ) TY='upto1' - ID='use of netcdf for tracking of wave systems' - TS='TRKNC' - OK='TRKNC' ;; -#sort:pdlib: - pdlib ) TY='upto1' - ID='use pdlib' - TS='PDLIB' - OK='PDLIB' ;; - -#sort:ddlib: - ddlib ) TY='upto1' - ID='domain decomposition library' - OK='METIS SCOTCH' ;; - -#sort:memck: - memck ) TY='upto1' - ID='check memory use' - TS='MEMCHECK' - OK='MEMCHECK' ;; -#sort:setup: - setup ) TY='upto1' - ID='switch to zeta setup' - TS='SETUP' - OK='SETUP' ;; -#sort:uost: - uost ) TY='upto1' - ID='unresolved obstacles source term' - TS='UOST' - OK='UOST' ;; -#sort:b4b: - b4b ) TY='upto1' - ID='bit-for-bit reproducability' - TS='B4B' - OK='B4B' ;; - esac - -# 1.a.2 Check to make sure the correct amount of switches identified per category - - n_found='0' - s_found= - for check in $OK - do - if [ "`grep $check $switch | wc -w | awk '{print $1}'`" -gt '1' ] - then - n_found=$(($n_found + 1)) - s_found="$s_found $check" - fi - done - - if [ "$n_found" != '1' ] && [ "$TY" = 'one' ] - then - echo ' ' - echo " *** No valid $ID switch found ***" - echo " valid : $OK" - echo " found : $s_found" - echo ' ' ; exit 1 - fi - - if [ "$n_found" -gt '1' ] && [ "$TY" = 'upto1' ] - then - echo ' ' - echo " *** Too many $ID switches found (max 1) ***" - echo " valid : $OK" - echo " found : $s_found" - echo ' ' ; exit 2 - fi - - if [ "$n_found" -gt '2' ] && [ "$TY" = 'upto2' ] - then - echo ' ' - echo " *** Too many $ID switches found (max 2) ***" - echo " valid : $OK" - echo " found : $s_found" - echo ' ' ; exit 3 - fi - - -# 1.a.3 Refresh files where switches have changed - - if [ "$TY" = 'man' ] - then - echo " w3_new $type has to be run manually" - else - if [ "$n_found" = '1' ] - then - sw="`echo $s_found | awk '{ print $1 }'`" - if [ "`grep $sw $old_sw | wc -w | awk '{print $1}'`" -lt '1' ] - then - $new_sw $type - echo " new $ID" - fi - else - if [ "`grep $TS $old_sw | wc -w | awk '{print $1}'`" -gt '1' ] - then - $new_sw $type - echo " new $ID" - fi - fi - fi - -# 1.a.4 Put switch names in category - - if [ "$n_found" = '1' ] - then - sw="`echo $s_found | awk '{ print $1 }'`" - else - sw= - fi - - if [ "$type" = 'thread' ] - then - sw1="`echo $s_found | awk '{ print $1 }'`" - sw2="`echo $s_found | awk '{ print $2 }'`" - fi - - - case $type in - shared ) shared=$sw ;; - mpp ) mpp=$sw ;; - mpiexp ) mpiexp=$sw ;; - thread ) thread1=$sw1 ; thread2=$sw2 ;; - GSE ) g_switch=$sw ;; - prop ) p_switch=$sw ;; - smcg ) smcg=$sw ;; - s_ln ) s_ln=$sw ;; - sterm ) s_inds=$sw ;; - stab ) stab=$sw ;; - stress ) stress=$sw ;; - dstress) dstress=$sw ;; - scrip ) scrip=$sw ;; - scripnc) scripnc=$sw ;; - s_nl ) s_nl=$sw ;; - snls ) snls=$sw ;; - s_bot ) s_bt=$sw ;; - s_ice ) s_ic=$sw ;; - s_is ) s_is=$sw ;; - s_db ) s_db=$sw ;; - s_tr ) s_tr=$sw ;; - s_bs ) s_bs=$sw ;; - reflection ) reflection=$sw ;; - refrx ) refrx=$sw ;; - ig ) ig=$sw ;; - tide ) tide=$sw ;; - mprf ) mprf=$sw ;; - cou ) cou=$sw ;; - oasis ) oasis=$sw ;; - agcm ) agcm=$sw ;; - ogcm ) ogcm=$sw ;; - igcm ) igcm=$sw ;; - trknc ) trknc=$sw ;; - pdlib ) pdlib=$sw ;; - ddlib ) ddlib=$sw ;; - memck ) memck=$sw ;; - setup ) setup=$sw ;; - uost ) uost=$sw ;; - b4b ) b4b=$sw ;; - * ) ;; - esac - done - -# 1.b Check switch compatibility - - case $stress in - FLX0) str_st1='no' ; str_st2='no' ; str_st3='OK' ; str_st6='no' ;; - FLX1) str_st1='OK' ; str_st2='no' ; str_st3='no' ; str_st6='OK' ;; - FLX2) str_st1='OK' ; str_st2='OK' ; str_st3='no' ; str_st6='OK' ;; - FLX3) str_st1='OK' ; str_st2='OK' ; str_st3='no' ; str_st6='OK' ;; - FLX4) str_st1='OK' ; str_st2='no' ; str_st3='no' ; str_st6='OK' ;; - FLX5) str_st1='no' ; str_st2='no' ; str_st3='yes' ; str_st6='OK' ;; - esac - - if [ -n "$thread2" ] && [ "$thread1" != 'OMPG' ] - then - echo ' ' - echo " *** !/OMPH has to be used in combination with !/OMPG" - echo ' ' ; exit 4 - fi - - if [ "$thread2" = 'OMPH' ] && [ "$mpp" != 'MPI' ] - then - echo ' ' - echo " *** !/OMPH has to be used in combination with !/MPI" - echo ' ' ; exit 5 - fi - - if [ -n "$b4b" ] && [ -z "$thread2" ] - then - echo ' ' - echo " *** !/B4B should be used in combination with !/OMPG or !/OMPH" - echo ' ' ; exit 7 - fi - - if [ "$stab" = 'STAB2' ] && [ "$s_inds" != 'ST2' ] - then - echo ' ' - echo " *** !/STAB2 has to be used in combination with !/ST2" - echo ' ' ; exit 8 - fi - - if [ "$stab" = 'STAB3' ] && [ "$s_inds" != 'ST3' ] - then - if [ "$s_inds" != 'ST4' ] - then - echo ' ' - echo " *** !/STAB3 has to be used in combination with !/ST3 or !/ST4" - echo ' ' ; exit 9 - fi - fi - - if [ "$s_inds" = 'ST1' ] && [ "$str_st1" = 'no' ] - then - echo ' ' - echo " *** !/ST1 cannot be used in combination with !/$stress" - echo " Choose from FLX1, FLX2, FLX3, or FLX4." - echo ' ' ; exit 10 - fi - - if [ "$s_inds" = 'ST2' ] && [ "$str_st2" = 'no' ] - then - echo ' ' - echo " *** !/ST2 cannot be used in combination with !/$stress" - echo " Choose from FLX2 or FLX3." - echo ' ' ; exit 11 - fi - - if [ "$s_inds" = 'ST3' ] && [ "$str_st3" = 'no' ] - then - echo ' ' - echo " *** !/ST3 cannot be used in combination with !/$stress" - echo " Stresses embedded in source terms, use FLX0." - echo ' ' ; exit 12 - fi - if [ "$s_inds" = 'ST4' ] && [ "$str_st3" = 'no' ] - then - echo ' ' - echo " *** !/ST4 cannot be used in combination with !/$stress" - echo " Stresses embedded in source terms, use FLX0." - echo ' ' ; exit 13 - fi - if [ "$s_inds" = 'ST6' ] && [ "$str_st6" = 'no' ] - then - echo ' ' - echo " *** !/ST6 cannot be used in combination with !/$stress" - echo " Choose from FLX1, FLX2, FLX3, or FLX4 or FLX5." - echo ' ' ; exit 14 - fi - - if [ "$oasis" = 'OASIS' ] && [ "$str_st3" = 'no' ] - then - echo ' ' - echo " *** !/OASIS cannot be used in combination with !/$stress" - echo " Stresses embedded in source terms, use FLX0." - echo ' ' ; exit 15 - fi - - if [ -n "$thread1" ] && [ "$s_nl" = 'NL2' ] - then - echo ' ' - echo " *** The present version of the WRT interactions" - echo " cannot be run under OpenMP (OMPG, OMPH). Use" - echo " SHRD or MPI options instead. ***" - echo ' ' ; exit 16 - fi - - if [ "$pdlib" = 'PDLIB' ] && [ "$mpp" != 'MPI' ] - then - echo ' ' - echo " *** For PDLIB, we need to have MPI as well." - echo ' ' ; exit 17 - fi - - if [ "$pdlib" = 'PDLIB' ] && [ "$ddlib" != 'SCOTCH' ] - then - if [ "$ddlib" != 'METIS' ] - then - echo ' ' - echo " *** For PDLIB, we need either SCOTCH or METIS, not both." - echo ' ' ; exit 18 - fi - fi - - - if [ "$ddlib" = 'METIS' ] && [ "$pdlib" != 'PDLIB' ] - then - echo ' ' - echo " *** For METIS, we need to have PDLIB as well." - echo ' ' ; exit 19 - fi - - if [ "$ddlib" = 'SCOTCH' ] && [ "$pdlib" != 'PDLIB' ] - then - echo ' ' - echo " *** For SCOTCH, we need to have PDLIB as well." - echo ' ' ; exit 20 - fi - -} #end of check_switches - - -# --------------------------------------------------------------------------- # -# 2. Get files associated with switches # -# Use the switches sorted and grouped in check_switches() to get the # -# associated files. This function should be called after check_switches() # -# --------------------------------------------------------------------------- # - -switch_files() -{ - - case $g_switch in - PR0) pr=$NULL ;; - PR1) pr='w3profsmd w3pro1md' ;; - PR2) pr='w3profsmd w3pro2md' ;; - PR3) pr='w3profsmd w3pro3md' ;; - esac - - case $p_switch in - UQ ) pr="$pr w3uqckmd" ;; - UNO) pr="$pr w3uno2md" ;; - esac - - smcm=$NULL - smco=$NULL - case $smcg in - SMC) smcm='w3psmcmd'; smco='w3smcomd w3psmcmd' ;; - esac - - case $uost in - UOST) uostmd="w3uostmd" - esac - - case $stress in - FLX0) flx=$NULL - flxx=$NULL ;; - FLX1) flx='w3flx1md' - flxx=$NULL ;; - FLX2) flx='w3flx2md' - flxx=$NULL ;; - FLX3) flx='w3flx3md' - flxx=$NULL ;; - FLX4) flx='w3flx4md' - flxx=$NULL ;; - FLX5) flx='w3flx5md' - flxx=$NULL ;; - esac - - case $dstress in - FLD0) ds=$NULL - dsx=$NULL ;; - FLD1) ds=$NULL - dsx='w3fld1md' ;; - FLD2) ds=$NULL - dsx='w3fld1md w3fld2md' ;; - esac - - case $s_ln in - LN0) ln=$NULL - lnx=$NULL ;; - LN1) ln='w3sln1md' - lnx=$NULL ;; - esac - - case $s_inds in - ST0) st='w3src0md' - stx=$NULL ;; - ST1) st='w3src1md' - stx='w3src1md' ;; - ST2) st='w3src2md' - stx='w3src2md' ;; - ST3) st='w3src3md' - stx='w3src3md' ;; - ST4) st='w3src4md' - stx='w3src4md' ;; - ST6) st='w3src6md w3swldmd' - stx='w3src6md' ;; - esac - - case $s_nl in - NL0) nl=$NULL - nlx=$NULL ;; - NL1) nl='w3snl1md' - nlx='w3snl1md' ;; - NL2) nl='w3snl2md mod_xnl4v5 serv_xnl4v5 mod_constants mod_fileio' - nlx="$nl" ;; - NL3) nl='w3snl3md' - nlx='w3snl3md' ;; - NL4) nl='w3snl4md' - nlx='w3snl4md' ;; - NL5) nl='w3snl5md w3gkemd' - nlx="$nl" ;; - esac - - case $snls in - NLS) nl="$nl w3snlsmd" - nlx="$nlx w3snlsmd" ;; - esac - - case $s_bt in - BT0) bt=$NULL ;; - BT1) bt='w3sbt1md' ;; - BT4) bt='w3sbt4md' ;; - BT8) bt='w3sbt8md' ;; - BT9) bt='w3sbt9md' ;; - esac - - case $s_db in - DB0) db=$NULL - dbx=$NULL ;; - DB1) db='w3sdb1md' - dbx=$NULL ;; - esac - - case $s_tr in - TR0) tr=$NULL - trx=$NULL ;; - TR1) tr='w3str1md' - trx=$NULL ;; - esac - - case $s_bs in - BS0) bs=$NULL - bsx=$NULL ;; - BS1) bs='w3sbs1md' - bsx=$NULL ;; - esac - - ic=$NULL - case $s_ic in - IC1) ic='w3sic1md' ;; - IC2) ic='w3sic2md' ;; - IC3) ic='w3sic3md' ;; - IC4) ic='w3sic4md' ;; - IC5) ic='w3sic5md' ;; - esac - - is=$NULL - case $s_is in - IS1) is='w3sis1md' ;; - IS2) is='w3sis2md' ;; - esac - - refcode=$NULL - case $reflection in - REF1) refcode='w3ref1md' - esac - - pdlibcode=$NULL - pdlibyow=$NULL - case $pdlib in - PDLIB) pdlibcode='yowfunction pdlib_field_vec w3profsmd_pdlib' - pdlibyow='yowsidepool yowdatapool yowerr yownodepool yowelementpool yowexchangeModule yowrankModule yowpdlibmain yowpd' ;; - esac - - memcode=$NULL - case $memck in - MEMCHECK) memcode='w3meminfo' - esac - - setupcode=$NULL - case $setup in - SETUP) setupcode='w3wavset' - esac - - tidecode=$NULL - tideprog=$NULL - case $tide in - TIDE) tidecode='w3tidemd' - tideprog='ww3_prtide' - esac - - igcode=$NULL - case $ig in - IG1) igcode='w3gig1md w3canomd' - esac - - oasismd=$NULL - case $oasis in - OASIS) oasismd='w3oacpmd' - esac - - agcmmd=$NULL - case $agcm in - OASACM) agcmmd='w3agcmmd' - esac - - ogcmmd=$NULL - case $ogcm in - OASOCM) ogcmmd='w3ogcmmd' - esac - - igcmmd=$NULL - case $igcm in - OASICM) igcmmd='w3igcmmd' - esac - - mprfaux=$NULL - case $mprf in - MPRF) mprfaux='w3getmem' - esac - -} #end of switch_files - - - -# --------------------------------------------------------------------------- # -# 3. Create list of files for a prog # -# For a particular prog create files and filesl a list of files and a # -# list of files to be linked. The variable prog needs to be set and # -# the switch_files should be used first (which requires check_switches() # -# --------------------------------------------------------------------------- # - -create_file_list() -{ - case $prog in - ww3_grid) - core= - data='w3wdatmd w3gdatmd w3adatmd w3idatmd w3odatmd wmmdatmd' - prop= - sourcet="w3parall w3triamd w3gridmd $stx $flx $nlx $btx $is $uostmd" - IO='w3iogrmd' - aux="constants w3servmd w3arrymd w3dispmd w3gsrumd w3timemd w3nmlgridmd $pdlibyow $memcode" - if [ "$scrip" = 'SCRIP' ] - then - aux="$aux scrip_constants scrip_grids scrip_iounitsmod" - aux="$aux scrip_remap_vars scrip_timers scrip_errormod scrip_interface" - aux="$aux scrip_kindsmod scrip_remap_conservative wmscrpmd" - fi - if [ "$scripnc" = 'SCRIPNC' ] - then - aux="$aux scrip_netcdfmod scrip_remap_write scrip_remap_read" - fi ;; - ww3_strt) - core= - data="$memcode w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd" - prop= - sourcet="$pdlibcode $pdlibyow $db $tr $trx $bt $setupcode $stx $flx $nlx $btx $is wmmdatmd w3parall $uostmd" - IO='w3iogrmd w3iorsmd' - aux="constants w3triamd w3servmd w3arrymd w3dispmd w3gsrumd w3timemd" ;; - ww3_bound) - core= - data="w3adatmd $memcode w3gdatmd w3wdatmd w3idatmd w3odatmd" - prop="$smcm" - sourcet="$pdlibcode $pdlibyow $db $bt $setupcode $tr $trx $stx $nlx $btx $is wmmdatmd w3parall w3triamd $uostmd" - IO='w3iobcmd w3iogrmd w3dispmd w3gsrumd' - aux="constants w3servmd w3timemd w3arrymd w3cspcmd w3nmlboundmd" ;; - ww3_bounc) - core= - data="w3adatmd $memcode w3gdatmd w3wdatmd w3idatmd w3odatmd" - prop="$smcm" - sourcet="$pdlibcode $pdlibyow $db $bt $setupcode $stx $nlx $btx $is wmmdatmd w3parall w3triamd $uostmd" - IO='w3iobcmd w3iogrmd w3dispmd w3gsrumd' - aux="constants w3servmd w3arrymd w3timemd w3cspcmd w3nmlbouncmd" ;; - ww3_prep) - core='w3fldsmd' - data="$memcode w3gdatmd w3adatmd w3idatmd w3odatmd w3wdatmd wmmdatmd" - prop= - sourcet="$pdlibcode $pdlibyow $db $bt $setupcode w3triamd $stx $flx $nlx $btx $is $uostmd" - IO="w3iogrmd $oasismd $agcmmd $ogcmmd $igcmmd" - aux="constants w3servmd w3timemd $tidecode w3arrymd w3dispmd w3gsrumd w3parall" ;; - ww3_prnc) - core='w3fldsmd' - data="$memcode w3gdatmd w3adatmd w3idatmd w3odatmd w3wdatmd wmmdatmd" - prop= - sourcet="$pdlibcode $pdlibyow $db $bt $setupcode w3triamd $stx $flx $nlx $btx $is w3parall $uostmd" - IO="w3iogrmd $oasismd $agcmmd $ogcmmd $igcmmd" - aux="constants w3servmd w3timemd w3arrymd w3dispmd w3gsrumd w3tidemd w3nmlprncmd" ;; - ww3_prtide) - core='w3fldsmd' - data="wmmdatmd $memcode w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd" - prop="$pr $smcm" - sourcet="$pdlibcode $pdlibyow $db $bt $setupcode w3triamd $stx $nlx $btx $is w3parall $uostmd" - IO="w3iogrmd $oasismd $agcmmd $ogcmmd $igcmmd" - aux="constants w3servmd w3timemd w3arrymd w3dispmd w3gsrumd $tidecode" ;; - ww3_shel) - core='w3fldsmd w3initmd w3wavemd w3wdasmd w3updtmd' - data="wmmdatmd $memcode w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd" - prop="$pr $smcm" - sourcet="$pdlibcode $setupcode w3triamd w3srcemd $dsx $flx $ln $st $nl $bt $ic" - sourcet="$sourcet $is $db $tr $bs $refcode $igcode w3parall $uostmd" - IO="w3iogrmd w3iogomd w3iopomd w3iotrmd w3iorsmd w3iobcmd $oasismd $agcmmd $ogcmmd $igcmmd" - IO="$IO w3iosfmd w3partmd" - aux="constants w3servmd w3timemd $tidecode w3arrymd w3dispmd w3cspcmd w3gsrumd" - aux="$aux w3nmlshelmd $pdlibyow" ;; - ww3_multi|ww3_multi_esmf) - if [ "$prog" = "ww3_multi" ] - then - core='' - else - core='wmesmfmd' - fi - core="$core wminitmd wmwavemd wmfinlmd wmgridmd wmupdtmd wminiomd" - core="$core w3fldsmd w3initmd w3wavemd w3wdasmd w3updtmd" - data="wmmdatmd $memcode w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd" - prop="$pr $smcm" - sourcet="$pdlibcode $pdlibyow $setupcode w3parall w3triamd w3srcemd $dsx $flx $ln $st $nl $bt $ic $is $db $tr $bs $refcode $igcode $uostmd" - IO='w3iogrmd w3iogomd w3iopomd wmiopomd' - IO="$IO w3iotrmd w3iorsmd w3iobcmd w3iosfmd w3partmd $oasismd $agcmmd $ogcmmd $igcmmd" - aux="constants $tidecode w3servmd w3timemd w3arrymd w3dispmd w3cspcmd w3gsrumd $mprfaux" - aux="$aux wmunitmd w3nmlmultimd" - if [ "$scrip" = 'SCRIP' ] - then - aux="$aux scrip_constants scrip_grids scrip_iounitsmod" - aux="$aux scrip_remap_vars scrip_timers scrip_errormod scrip_interface" - aux="$aux scrip_kindsmod scrip_remap_conservative wmscrpmd" - fi - if [ "$scripnc" = 'SCRIPNC' ] - then - aux="$aux scrip_netcdfmod scrip_remap_write scrip_remap_read" - fi ;; - ww3_sbs1) - core='wminitmd wmwavemd wmfinlmd wmgridmd wmupdtmd wminiomd' - core="$core w3fldsmd w3initmd w3wavemd w3wdasmd w3updtmd" - data="w3parall wmmdatmd $memcode w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd" - prop="$pr $smcm" - sourcet="$pdlibcode $pdlibyow w3triamd w3srcemd $dsx $flx $ln $st $nl $bt $db $tr $bs $refcode $igcode $is $ic $uostmd" - IO='w3iogrmd w3iogomd w3iopomd wmiopomd' - IO="$IO w3iotrmd w3iorsmd w3iobcmd w3iosfmd w3partmd $oasismd $agcmmd $ogcmmd $igcmmd" - aux="constants w3servmd w3timemd w3arrymd w3dispmd w3cspcmd w3gsrumd $mprfaux $tidecode" - aux="$aux wmunitmd w3nmlmultimd" - if [ "$scrip" = 'SCRIP' ] - then - aux="$aux scrip_constants scrip_grids scrip_iounitsmod" - aux="$aux scrip_remap_vars scrip_timers scrip_errormod scrip_interface" - aux="$aux scrip_kindsmod scrip_remap_conservative wmscrpmd" - fi - if [ "$scripnc" = 'SCRIPNC' ] - then - aux="$aux scrip_netcdfmod scrip_remap_write scrip_remap_read" - fi ;; - ww3_outf) - core= - data="w3parall wmmdatmd $memcode w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd" - prop= - sourcet="$pdlibcode $pdlibyow $db $bt $setupcode $tr $trx $stx $flx $nlx $btx $is $uostmd" - IO='w3iogrmd w3iogomd' - aux="constants w3servmd w3timemd w3arrymd w3dispmd w3gsrumd" - aux="$aux" ;; - ww3_ounf) - core='w3initmd' - data="wmmdatmd $memcode w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd" - prop= - sourcet="$pdlibcode $pdlibyow $db $bt $setupcode w3parall w3triamd $stx $flx $nlx $btx $is $uostmd" - IO='w3iogrmd w3iogomd w3iorsmd w3iopomd' - aux="constants w3servmd w3timemd w3arrymd w3dispmd w3gsrumd" - aux="$aux w3nmlounfmd $smco w3ounfmetamd w3metamd" ;; - ww3_outp) - core= - data="wmmdatmd w3parall w3triamd $memcode w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd" - prop= - sourcet="$pdlibcode $pdlibyow $setupcode $flx $ln $st $nl $bt $ic $is $db $tr $bs $igcode $uostmd" - IO='w3bullmd w3iogrmd w3iopomd w3partmd' - aux="constants w3servmd w3timemd w3arrymd w3dispmd w3gsrumd" ;; - ww3_ounp) - core= - data="wmmdatmd w3parall w3triamd $memcode w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd" - prop= - sourcet="$pdlibcode $pdlibyow $setupcode $flx $ln $st $nl $bt $ic $is $db $tr $bs $igcode $uostmd" - IO='w3bullmd w3iogrmd w3iopomd w3partmd' - aux="constants w3servmd w3timemd w3arrymd w3dispmd w3gsrumd" - aux="$aux w3nmlounpmd" ;; - ww3_trck) - core= - data="$memcode w3gdatmd w3odatmd" - prop= - sourcet= - IO= - aux="constants w3servmd w3timemd w3gsrumd" ;; - ww3_trnc) - core= - data="$memcode w3gdatmd w3odatmd" - prop= - sourcet= - IO= - aux="constants w3servmd w3timemd w3gsrumd w3nmltrncmd" ;; - ww3_grib) - core= - data="w3parall wmmdatmd w3triamd $memcode w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd" - prop= - sourcet="$pdlibcode $pdlibyow $db $bt $setupcode $stx $flx $nlx $btx $is $uostmd" - IO='w3iogrmd w3iogomd' - aux="constants w3servmd w3timemd w3arrymd w3dispmd w3gsrumd" - aux="$aux" ;; - ww3_gspl) - core='w3fldsmd' - data="$memcode w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd" - prop= - sourcet="$pdlibcode $pdlibyow $db $bt $setupcode wmmdatmd w3parall w3triamd $stx $flx $nlx $btx $is $uostmd" - IO="w3iogrmd $oasismd $agcmmd $ogcmmd $igcmmd" - aux="constants w3servmd w3timemd w3arrymd w3dispmd w3gsrumd $tidecode" ;; - ww3_gint) - core= - data="w3parall wmmdatmd $memcode w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd" - IO='w3iogrmd w3iogomd' - prop= - sourcet="$pdlibcode $pdlibyow $db $bt $st $nl $is $uostmd" - aux="constants w3triamd w3servmd w3arrymd w3dispmd w3timemd w3gsrumd" - aux="$aux" ;; - gx_outf) - core= - data="$memcode w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd" - prop= - sourcet="$pdlibcode $pdlibyow $db $bt $setupcode wmmdatmd w3parall w3triamd $stx $flx $nlx $btx $tr $bs $is $uostmd" - IO='w3iogrmd w3iogomd' - aux="constants w3servmd w3timemd w3arrymd w3dispmd w3gsrumd" - aux="$aux" ;; - gx_outp) - core= - data="$memcode w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd" - prop= - sourcet="$pdlibcode $pdlibyow $db $bt $setupcode wmmdatmd w3parall w3triamd $ln $flx $st $nlx $btx $tr $bs $is $ic $uostmd" - IO='w3iogrmd w3iopomd' - aux="constants w3servmd w3timemd w3arrymd w3dispmd w3gsrumd" ;; - ww3_systrk) - core='w3strkmd' - data="$memcode w3gdatmd w3adatmd w3idatmd w3odatmd w3wdatmd" - prop= - sourcet="$pdlibcode $pdlibyow $db $bt $setupcode wmmdatmd w3dispmd w3triamd $ln $stx $flx $nlx $btx $tr $bs $is $uostmd" - IO= - aux="constants w3servmd w3timemd w3arrymd w3gsrumd w3parall" ;; - libww3|libww3.so) - core='w3fldsmd w3initmd w3wavemd w3wdasmd w3updtmd' - data='wmmdatmd w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd' - prop="$pr $smcm" - sourcet="w3triamd w3srcemd $dsx $flx $ln $st $nl $bt $ic $is $db $tr $bs $refcode $igcode $uostmd" - IO='w3iogrmd w3iogomd w3iopomd w3iotrmd w3iorsmd w3iobcmd w3iosfmd w3partmd' - aux="constants w3servmd w3timemd $tidecode w3arrymd w3dispmd w3cspcmd w3gsrumd" ;; - ww3_uprstr) - core= - data='wmmdatmd w3triamd w3gdatmd w3wdatmd w3adatmd w3idatmd w3odatmd' - prop= - sourcet="$memcode $pdlibcode $pdlibyow $flx $ln $st $nl $bt $ic $is $db $tr $bs $uostmd" - IO='w3iogrmd w3iogomd w3iorsmd' - aux="constants w3servmd w3timemd w3arrymd w3dispmd w3gsrumd" - aux="$aux w3parall w3nmluprstrmd" ;; - esac - - # if esmf is included in program name or if - # the target is compile and create archive - if [ -n "`echo $prog | grep esmf 2>/dev/null`" ] - then - files="$aux $core $data $prop $sourcet $IO" - filesl="$data $core $prop $sourcet $IO $aux" - # if program name is libww3, then - # the target is compile and create archive - elif [ "$prog" = "libww3" ] || [ "$prog" = "libww3.so" ] - then - files="$aux $core $data $prop $sourcet $IO" - filesl="$data $core $prop $sourcet $IO $aux" - else - files="$aux $core $data $prop $sourcet $IO $prog" - filesl="$prog $data $core $prop $sourcet $IO $aux" - fi -} #end of create_file_list diff --git a/model/bin/cmplr.env b/model/bin/cmplr.env deleted file mode 100644 index 217e6be3a..000000000 --- a/model/bin/cmplr.env +++ /dev/null @@ -1,429 +0,0 @@ -#!/bin/bash -e - -# --------------------------------------------------------------------------- # -# cmplr.env : Defines the compiler executable and its options for WW3 # -# from the compiler keyword given in argument # -# # -# - supported compiler are SGI-MPT, INTEL, GNU, PORTLAND, CRAY # -# # -# # -# use : cmplr.env cmplr # -# # -# cmplr : keyword based on a value and optional suffix, prefix and extras # -# # -# value : mpt / intel / gnu / pgi / cray # -# suffix : _debug # -# prefix : datarmor_ # -# extras : so_ # -# # -# - examples : intel / pgi_debug / datarmor_mpt_debug / so_intel # -# # -# remarks : # -# # -# - template files comp.tmpl and link.tmpl will be used to create the # -# comp and link file based on the following environment variables : # -# $optc, $optl, $comp_seq, $comp_mpi, $optomp, $err_pattern, $warn_pattern # -# # -# # -# M. Accensi # -# August 2018 # -# --------------------------------------------------------------------------- # - - -## Set some defaults (can be overriden by individual compiler sections) - -# grep pattern for errors/warnings in compiler output: -err_pattern='[[:space:]]error[[:space:]]' -warn_pattern='warn' - -# Binary I/O defaults to native endian: -endian='native' - -# disable listing done by the compiler -list='no' - - -############################### -# MPT # -############################### - -if [ "$cmplr" == "mpt" ] || [ "$cmplr" == "mpt_debug" ] || [ "$cmplr" == "mpt_prof" ] || \ - [ "$cmplr" == "datarmor_mpt" ] || [ "$cmplr" == "datarmor_mpt_debug" ] || [ "$cmplr" == "datarmor_mpt_prof" ] ; then - - # COMPILER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # common compiler - comp_seq='ifort' - comp_mpi='ifort -lmpi' - - # Cray compiler - if [ ! -z "$(echo $cmplr | grep wcoss_cray)" ] ; then - comp_seq='ftn' - comp_mpi='ftn' - fi - - - # OPTIONS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # common options - optc='-c -module $path_m -no-fma -ip -g -i4 -real-size 32 -fp-model precise -assume byterecl -fno-alias -fno-fnalias' - optl='-o $prog -g' - - endian='big_endian' - - # list options - if [ "$list" == 'yes' ] ; then optc="$optc -list"; fi - - # omp options - optomp="-openmp" - - # optimized options - if [ -z "$(echo $cmplr | grep debug)" ] ; then - optc="$optc -O3" - optl="$optl -O3" - fi - - # profiling option - if [ ! -z "$(echo $cmplr | grep prof)" ] ; then - optc="$optc -p" - optl="$optl -p" - fi - - # debugging options - if [ ! -z "$(echo $cmplr | grep debug)" ] ; then - optc="$optc -O0 -debug all -warn all -check all -check noarg_temp_created -fp-stack-check -heap-arrays -traceback -fpe0" - optl="$optl -O0 -traceback" - fi - - # system-dependant options - if [ ! -z "$(echo $cmplr | grep datarmor)" ] ; then - optc="$optc -xcore-avx2" - optl="$optl -xcore-avx2" - else - optc="$optc -xhost" - optl="$optl -xhost" - fi - - #Flags for CPP: - cppad3procflag='-E' - cppad3flag2=' ' - cppad3flag3='-o' - cppad3flag4='#' - - - -fi - - -############################### -# INTEL # -############################### - -if [ "$cmplr" == "intel" ] || [ "$cmplr" == "intel_debug" ] || [ "$cmplr" == "intel_prof" ] || \ - [ "$cmplr" == "so_intel" ] || [ "$cmplr" == "so_intel_debug" ] || [ "$cmplr" == "so_intel_prof" ] || \ - [ "$cmplr" == "datarmor_intel" ] || [ "$cmplr" == "datarmor_intel_debug" ] || [ "$cmplr" == "datarmor_intel_prof" ] || \ - [ "$cmplr" == "wcoss_cray" ] || [ "$cmplr" == "wcoss_dell_p3" ] || [ "$cmplr" == "cheyenne.intel" ] || \ - [ "$cmplr" == "gaea.intel" ] || [ "$cmplr" == "jet.intel" ] || \ - [ "$cmplr" == "wcoss2" ] || [ "$cmplr" == "s4.intel" ] || \ - [ "$cmplr" == "expanse.intel" ] || \ - [ "$cmplr" == "hera.intel" ] || [ "$cmplr" == "orion.intel" ] || [ "$cmplr" == "stampede.intel" ] || \ - [ "$cmplr" == "ukmo_cray_intel" ] || [ "$cmplr" == "ukmo_cray_intel_debug" ]; then - - # COMPILER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # compiler - comp_seq='ifort' - comp_mpi='mpiifort' - - # cray compiler - if [ ! -z "$(echo $cmplr | grep wcoss_cray)" ] || [ "$cmplr" == "gaea.intel" ] || [ "$cmplr" == "wcoss2" ] || [[ $cmplr == ukmo_cray* ]]; then - comp_seq='ftn' - comp_mpi='ftn' - fi - - if [ ! -z "$(echo $cmplr | grep cheyenne)" ] ; then - comp_seq='ifort' - comp_mpi='mpif90' - fi - - - # OPTIONS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # common options - optc='-c -module $path_m -no-fma -ip -g -traceback -i4 -real-size 32 -fp-model precise -assume byterecl -fno-alias -fno-fnalias -sox' - optl='-o $prog -g' - - endian='big_endian' - - # list options - if [ "$list" == 'yes' ] ; then optc="$optc -list"; fi - - # omp options - if [ ! -z "$(echo $cmplr | grep datarmor)" ] || [ "$cmplr" == "hera.intel" ] || [ "$cmplr" == "orion.intel" ] || \ - [ "$cmplr" == "wcoss_cray" ] || [ "$cmplr" == "wcoss_dell_p3" ] || [ "$cmplr" == "cheyenne.intel" ] || \ - [ "$cmplr" == "gaea.intel" ] || [ "$cmplr" == "jet.intel" ] || [ "$cmplr" == "wcoss2" ] || \ - [ "$cmplr" == "stampede.intel" ] || [ "$cmplr" == "s4.intel" ] || [ "$cmplr" == "expanse.intel" ] ; then - optomp="-qopenmp" - else - optomp="-openmp" - fi - - # optimized options - if [ -z "$(echo $cmplr | grep debug)" ] ; then - optc="$optc -O3" - optl="$optl -O3" - fi - - # profiling option - if [ ! -z "$(echo $cmplr | grep prof)" ] ; then - optc="$optc -p" - optl="$optl -p" - fi - - # debugging options - if [ ! -z "$(echo $cmplr | grep debug)" ] ; then - optc="$optc -O0 -debug all -warn all -check all -check noarg_temp_created -fp-stack-check -heap-arrays -traceback -fpe0" - optl="$optl -O0 -traceback" - fi - - # system-dependant options - if [ ! -z "$(echo $cmplr | grep datarmor)" ] ; then - optc="$optc -xcore-avx2" - optl="$optl -xcore-avx2" - elif [ ! -z "$(echo $cmplr | grep wcoss_cray)" ] ; then - optc="$optc -xCORE-AVX2" - optl="$optl -xCORE-AVX2" - elif [ ! -z "$(echo $cmplr | grep wcoss2)" ] ; then - optc="$optc" - optl="$optl" - elif [ ! -z "$(echo $cmplr | grep wcoss_dell_p3)" ] ; then - optc="$optc -xHOST" - optl="$optl -xHOST" - elif [ ! -z "$(echo $cmplr | grep jet.intel)" ] ; then - optc="$optc -axSSE4.2,AVX,CORE-AVX2,CORE-AVX512 -align array64byte -ip" - optl="$optl -axSSE4.2,AVX,CORE-AVX2,CORE-AVX512 -align array64byte -ip" - elif [[ $cmplr == ukmo_cray* ]]; then - : # processor type set by ftn wrapper script. - elif [ ! -z "$(echo $cmplr | grep s4)" ] ; then - #Necessary to run on the Ivy partition - optc="$optc -march=ivybridge" - optl="$optl -march=ivybridge" - else - optc="$optc -xhost" - optl="$optl -xhost" - fi - - if [ ! -z "$(echo $cmplr | grep so)" ] ; then - optc="$optc -fPIC" - optl='-o $prog -g' - fi - - - #Flags for CPP: - cppad3procflag='-E' - cppad3flag2=' ' - cppad3flag3='>' - cppad3flag4='#' - - -fi - -############################### -# GNU # -############################### - - -if [ "$cmplr" == "gnu" ] || [ "$cmplr" == "gnu_debug" ] || [ "$cmplr" == "gnu_prof" ] || \ - [ "$cmplr" == "so_gnu" ] || [ "$cmplr" == "so_gnu_debug" ] || [ "$cmplr" == "so_gnu_prof" ] || \ - [ "$cmplr" == "hera.gnu" ] || [ "$cmplr" == "cheyenne.gnu" ] || \ - [ "$cmplr" == "datarmor_gnu" ] || [ "$cmplr" == "datarmor_gnu_debug" ] || [ "$cmplr" == "datarmor_gnu_prof" ] || \ - [ "$cmplr" == "ukmo_cray_gnu" ] || [ "$cmplr" == "ukmo_cray_gnu_debug" ] || [ "$cmplr" == "ukmo_cray_gnu_prof" ] ; then - - # COMPILER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Only match `error` and `warn` at beginning of line: - err_pattern='^error' - warn_pattern='^warn' - - # common compiler - comp_seq='gfortran' - comp_mpi='mpif90' - - # Cray compiler - if [ ! -z "$(echo $cmplr | grep cray)" ] ; then - comp_seq='ftn' - comp_mpi='ftn' - fi - - - # OPTIONS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # common options - optc='-c -J$path_m -g -fno-second-underscore -ffree-line-length-none' - optl='-o $prog -g' - - endian='big_endian' - - # omp options - optomp='-fopenmp' - - # optimized options - if [ -z "$(echo $cmplr | grep debug)" ] ; then - optc="$optc -O3" - optl="$optl -O3" - fi - - # profiling option - if [ ! -z "$(echo $cmplr | grep prof)" ] ; then - optc="$optc -p" - optl="$optl -p" - fi - - # debugging options - if [ ! -z "$(echo $cmplr | grep debug)" ] ; then - optc="$optc -O0 -Wall -fcheck=all -ffpe-trap=invalid,zero,overflow -frecursive -fbacktrace" - optl="$optl -O0 -fbacktrace" - fi - - # system-dependant options - if [ ! -z "$(echo $cmplr | grep datarmor)" ] ; then - optc="$optc -march=core-avx2" - optl="$optl -march=core-avx2" - elif [ ! -z "$(echo $cmplr | grep ukmo_cray)" ]; then - # don't specify -march for Cray; processor specific tuning handled by ftn wrapper script - optc="$optc -frecord-marker=4" - else - optc="$optc -march=native" - optl="$optl -march=native" - fi - - if [ ! -z "$(echo $cmplr | grep so)" ] ; then - optc="$optc -fPIC" - fi - - #Flags for CPP: - cppad3procflag='-E' - cppad3flag2=' ' - cppad3flag3='-o' - cppad3flag4='#' - -fi - -############################### -# PGI # -############################### - -if [ "$cmplr" == "pgi" ] || [ "$cmplr" == "pgi_debug" ] || [ "$cmplr" == "pgi_prof" ] || \ - [ "$cmplr" == "datarmor_pgi" ] || [ "$cmplr" == "datarmor_pgi_debug" ] || [ "$cmplr" == "datarmor_pgi_debug" ] ; then - - # COMPILER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # common compiler - comp_seq='pgf90' - comp_mpi='mpif90' - - # OPTIONS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # common options - optc='-c -module $path_m -g -i4 -r4 -Kieee -byteswapio' - optl='-o $prog -g' - - # list options - if [ "$list" == 'yes' ] ; then optc="$optc -Mlist"; fi - - # omp options - optomp="-mp" - - # optimized options - if [ -z "$(echo $cmplr | grep debug)" ] ; then - optc="$optc -O3" - optl="$optl -O3" - fi - - # profiling option - if [ ! -z "$(echo $cmplr | grep prof)" ] ; then - optc="$optc -p" - optl="$optl -p" - fi - - # debugging options - if [ ! -z "$(echo $cmplr | grep debug)" ] ; then - optc="$optc -O0 -Mbounds -Mchkfpstk -Mchkstk -Mdalign -Mdclchk -Mdepchk -Miomutex -Ktrap=fp -Mrecursive -traceback" - optl="$optl -O0 -traceback" - fi - - # system-dependant options - if [ ! -z "$(echo $cmplr | grep datarmor)" ] ; then - optc="$(echo $optc | sed 's/O3/O2/') -Mlist" - optl="$optl" - else - optc="$optc" - optl="$optl" - fi - - #Flags for CPP: - cppad3procflag='-E' - cppad3flag2=' ' - cppad3flag3='>' - cppad3flag4='#' - -fi - - -############################### -# Crayftn (CCE) -############################### - -if [ "$cmplr" == "ukmo_cray" ] || [ "$cmplr" == "ukmo_cray_debug" ] || \ - [ "$cmplr" == "ukmo_cray_regtest" ]; then - - # COMPILER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # common compiler - comp_seq='ftn' - comp_mpi='ftn' - - # cray compiler output needs more specific err/warn search patterns: - err_pattern='crayftn: error' - warn_pattern='crayftn: warn' - # OPTIONS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # common options - optc='-c -J$path_m -sdefault32 -eg' - optl='-o $prog' - - # list options - if [ "$list" == 'yes' ] ; then optc="$optc -hlist=a"; fi - - # omp options - optomp="-h omp" - - # optimized options - if [ -z "$(echo $cmplr | grep debug)" ] ; then - optc="$optc -O3" - optl="$optl -O3" - fi - - # debugging options - if [ ! -z "$(echo $cmplr | grep debug)" ] ; then - optc="$optc -O0 -g -Rbcps" - optl="$optl -O0 -g" - fi - - # regtest options: - if [ ! -z "$(echo $cmplr | grep regtest)" ] ; then - # -O1 best balance between compile time and runtime for regtests - optc="$optc -O1" - optl="$optl -O1" - fi - - # system-dependant options - # N/A - #Flags for CPP: - cppad3procflag='-eP' - cppad3flag2=' ' - cppad3flag3='#' - cppad3flag4=' ' - - -fi diff --git a/model/bin/comp.tmpl b/model/bin/comp.tmpl deleted file mode 100755 index 3dc544c56..000000000 --- a/model/bin/comp.tmpl +++ /dev/null @@ -1,153 +0,0 @@ -#!/bin/bash -# --------------------------------------------------------------------------- # -# comp : Compiler script for use in ad3 (customized for hardware and # -# optimization). Note that this script will not be replaced if part # -# of WAVEWATCH III is re-installed. Used by ad3. # -# # -# use : comp name # -# name: name of source code file without the extension. # -# # -# error codes : 1 : input error # -# 2 : no environment file $ww3_env found. # -# 3 : error in creating scratch directory. # -# 4 : w3adc error. # -# 5 : compiler error. # -# # -# remarks : # -# # -# - This script runs from the scratch directory, where it should remain. # -# # -# - For this script to interact with ad3, it needs to generate / leave # -# following files : # -# $name.F90 : Source code (generated by ad3). # -# $name.l : Listing file. # -# $name.o : Object module. # -# comp.stat.$name : status file of compiler, containing number of # -# errors and number of warnings (generated by comp) # -# # -# - Upon (first) installation of WAVEWATCH III the user needs to check the # -# existing compilers and options available in the script cmplr.env # -# # -# - This version is a template for mpt/intel/gnu/pgi with optimized or # -# debugging options by adding _debug # -# # -# M. Accensi # -# August 2018 # -# --------------------------------------------------------------------------- # -# 1. Preparations # -# --------------------------------------------------------------------------- # - -# 1.a Check and process input - - if [ "$#" -ne '1' ] - then - echo "usage: comp name" ; exit 1 - fi - name="$1" - echo " Compiling $name" - -# 1.b Initial clean-up - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rm -f $name.l - rm -f $name.o - rm -f $name.out - rm -f $name.err - rm -f comp.stat.$name - -# --------------------------------------------------------------------------- # -# 2. Compile # -# --------------------------------------------------------------------------- # - -# 2.a Build options and determine compiler name - - - - - - - - - - - - - - - - - - # compiler - if [ "$mpi_mod" = 'yes' ] ; then - comp='' - else - comp='' - fi - - # compilation options - opt="" - - # oasis coupler include dir - if [ "$oasis_mod" = 'yes' ] - then - opt="$opt -I$OASISDIR/build/lib/psmile.MPI1" - fi - - # netcdf include dir - if [ "$netcdf_compile" = 'yes' ] - then - if [ "$mpi_mod" = 'no' ]; then comp="`$NETCDF_CONFIG --fc`"; fi - opt="$opt `$NETCDF_CONFIG --cflags`" - fi - - # ftn include dir - opt="$opt -I$path_i" - opt="$opt $ESMF_F90COMPILEPATHS" - opt="$opt $EXTRA_COMP_OPTIONS" - - # OMP support - if [ "$omp_mod" = 'yes' ] ; then - opt="$opt " - fi - -# 2.b Compile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $comp $opt $name.$fext 1> $name.out 2> $name.err - OK="$?" - -# --------------------------------------------------------------------------- # -# 3. Postprocessing # -# --------------------------------------------------------------------------- # - -# 3.a Capture errors - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# nr_err : number of errors. -# nr_war : number of warnings. - - nr_err='0' - nr_war='0' - - if [ -s $name.err ] - then - nr_err="$(grep -i '' $name.err | wc -l | awk '{ print $1 }')" - nr_war="$(grep -i '' $name.err | wc -l | awk '{ print $1 }')" - else - if [ "$OK" != '0' ] - then - nr_err='1' - fi - fi - -# 3.b Make file comp.stat - - - - - - - - - - - - - - - - - - - - - - - - - - - - echo "ERROR $nr_err" > comp.stat.$name - echo "WARNING $nr_war" >> comp.stat.$name - -# 3.c Prepare listing - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# if compiler does not provide listing, make listing from source code -# and compiler messages. Second input line for w3list identifies if -# comment lines are to be numbered. - - # listing done by the compiler - if [ -s $name.lst ] - then - mv $name.lst $name.l - fi - # add comp options, warnings and error to listing - if [ -s $name.l ] - then - echo '------------' >> $name.l - echo "$comp $opt" >> $name.l - echo '------------' >> $name.l - cat $name.out >> $name.l 2> /dev/null - echo '------------' >> $name.l - cat $name.err >> $name.l 2> /dev/null - echo '------------' >> $name.l - fi - - # remove empty warning and error files - # find . -name "*.out" -or -name "*.err" -empty -delete - -# end of comp --------------------------------------------------------------- # diff --git a/model/bin/find_switch b/model/bin/find_switch deleted file mode 100755 index ae4cca2dc..000000000 --- a/model/bin/find_switch +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash -# --------------------------------------------------------------------------- # -# find_switch : Find compiler switches in subroutines and include files. # -# # -# use : find_switch [switch] # -# switch : any strig for which the code is to be scanned. # -# # -# Hendrik L. Tolman # -# May 2009 # -# # -# Copyright 2009 National Weather Service (NWS), # -# National Oceanic and Atmospheric Administration. All rights # -# reserved. WAVEWATCH III is a trademark of the NWS. # -# No unauthorized use without permission. # -# # -# --------------------------------------------------------------------------- # - - -# --------------------------------------------------------------------------- # -# 1. Preparations # -# --------------------------------------------------------------------------- # - -# 1.a ID header - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - echo ' ' - echo 'Find switches in WAVEWATCH III' - echo '------------------------------' - -# 1.b Process/save input - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if test "$#" != '0' - then - switch="$1" - else - echo -n "Switch ? : " ; read switch - progs="$*" - fi - - echo ' ' ; echo "Files including $switch :" ; echo ' ' - -# 1.c Get data from setup file - - - - - - - - - - - - - - - - - - - - - - - - - - source $(dirname $0)/w3_setenv - main_dir=$WWATCH3_DIR - temp_dir=$WWATCH3_TMP - source=$WWATCH3_SOURCE - list=$WWATCH3_LIST - -# 1.d Raw data file - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -### TO DO: This needs to be improved for CPP transition - cd $main_dir/src - grep "$switch" * | sed 's/\:/ /' | awk '{ print $1}' > ../.switch.files - -# 1.e Output - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - last=$NULL - for file in `cat ../.switch.files` - do - if test "$file" != "$last" - then - echo " $file" - last="$file" - fi - done - rm -f ../.switch.files - echo ' ' - -# End of find_switch -------------------------------------------------------- # diff --git a/model/bin/link.tmpl b/model/bin/link.tmpl deleted file mode 100755 index aaa845342..000000000 --- a/model/bin/link.tmpl +++ /dev/null @@ -1,201 +0,0 @@ -#!/bin/bash -e -# --------------------------------------------------------------------------- # -# link : Linker script for use in make (customized for hardware and # -# optimization. Note that this script will not be replaced if part # -# of WAVEWATCH III is re-installed. # -# # -# use : link name [name ... ] # -# name: name of source code file without the extension. # -# the first name will become the program name. # -# # -# error codes : all error output directly to screen. # -# # -# remarks : # -# # -# - Upon (first) installation of WAVEWATCH III the user needs to check the # -# existing compilers and options available in the script cmplr.env # -# # -# - This version is a template for mpt/intel/gnu/pgi with optimized or # -# debugging options by adding _debug # -# # -# M. Accensi # -# August 2018 # -# --------------------------------------------------------------------------- # -# 1. Preparations # -# --------------------------------------------------------------------------- # -# 1.a Check and process input - - if [ "$#" -lt '1' ] - then - echo "usage: link name [name]" ; exit 1 - fi - prog=$1 - echo " Linking $prog" - input="$*" - -# 1.b Get data from setup file - - - - - - - - - - - - - - - - - - - - - - - - - - source $(dirname $0)/w3_setenv - main_dir=$WWATCH3_DIR - temp_dir=$WWATCH3_TMP - source=$WWATCH3_SOURCE - list=$WWATCH3_LIST - - -# 1.c Initial clean-up - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rm -f $main_dir/exe/$prog - -# --------------------------------------------------------------------------- # -# 2. Check objects # -# --------------------------------------------------------------------------- # - - cd $main_dir/obj - objects=$NULL - error='n' - set $input - - while [ "$#" -gt '0' ] - do - file=$1.o - if [ -f "$file" ] - then - objects="$objects $file" - else - echo " *** file $file not found ***" - error='y' - fi - shift - done - if [ "$error" = 'y' ] - then - echo "*** Missing object files ***" - exit 3 - fi - -# --------------------------------------------------------------------------- # -# 3. Link # -# --------------------------------------------------------------------------- # - -# 3.a Build options and determine compiler name - - - - - - - - - - - - - - - - - - # compiler - if [ "$mpi_mod" = 'yes' ] ; then - comp='' - else - comp='' - fi - - # linking options - opt="" - - # oasis coupler archive - if [ "$prog" = 'ww3_shel' ] || [ "$prog" = 'ww3_multi' ] || [ "$prog" = 'ww3_sbs1' ] || \ - [ "$prog" = 'ww3_prnc' ] || [ "$prog" = 'ww3_prep' ] || [ "$prog" = 'ww3_prtide' ] || \ - [ "$prog" = 'ww3_gspl' ] ; then - if [ "$oasis_mod" = 'yes' ] ; then - if [ -z "$(env | grep OASISDIR)" ] ; then - echo '' - echo "[ERROR] OASISDIR is not defined" - exit 1 - fi - echo "link with oasis" - libs="$libs $OASISDIR/lib/libpsmile.MPI1.a $OASISDIR/lib/libmct.a $OASISDIR/lib/libmpeu.a $OASISDIR/lib/libscrip.a" - fi - fi - - # grib library - if [ "$ncep_grib_compile" = 'yes' ] - then - opt="$opt -convert big_endian -assume byterecl -prec-div -prec-sqrt -ip" - libs="$libs ${G2_LIB4} ${W3EMC_LIB4} ${BACIO_LIB4} ${JASPER_LIB} ${PNG_LIB} ${Z_LIB}" - fi - - # netcdf library dir - if [ "$netcdf_compile" = 'yes' ] ; then - if [ "$mpi_mod" = 'no' ]; then comp="`$NETCDF_CONFIG --fc`"; fi - libs="$libs `$NETCDF_CONFIG --flibs` `$NETCDF_CONFIG --libs`" - fi - - # scotch library - if [ "$prog" = 'ww3_shel' ] || [ "$prog" = 'ww3_multi' ] || [ "$prog" = 'ww3_sbs1' ] ; then - if [ "$scotch_mod" = 'yes' ] ; then - if [ -z "$(env | grep SCOTCH_PATH)" ] ; then - echo '' - echo "[ERROR] SCOTCH_PATH is not defined" - exit 1 - fi - echo "link with scotch" - libs="$libs $SCOTCH_PATH/lib/libptscotchparmetisv3.a $SCOTCH_PATH/lib/libptscotch.a $SCOTCH_PATH/lib/libptscotcherr.a $SCOTCH_PATH/lib/libscotch.a" - fi - fi - - - # parmetis library - if [ "$prog" = 'ww3_shel' ] || [ "$prog" = 'ww3_multi' ] || [ "$prog" = 'ww3_sbs1' ] ; then - if [ "$metis_mod" = 'yes' ] ; then - if [ -z "$(env | grep METIS_PATH)" ] ; then - echo '' - echo "[ERROR] METIS_PATH is not defined" - exit 1 - fi - echo "link with parmetis" - libs="$libs $METIS_PATH/lib/libparmetis.a $METIS_PATH/lib/libmetis.a" - fi - fi - - # OMP support - if [ "$omp_mod" = 'yes' ] ; then - opt="$opt " - fi - - opt="$opt $EXTRA_LINK_OPTIONS" - -# 3.b Link - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rprfx="-Wl,-rpath," - rpath= - for path in $libs - do - if [ "${path:0:2}" = '-L' ] - then - rpath="$rpath ${rprfx}${path//-L/}" - fi - done - - $comp $opt $objects $libs $rpath > link.out 2> link.err - OK="$?" - -# --------------------------------------------------------------------------- # -# 4. Postprocessing # -# --------------------------------------------------------------------------- # - - if [ "$OK" != '0' ] - then - echo " *** error in linking ***" - echo ' ' - cat link.out - echo ' ' - cat link.err - echo ' ' - rm -f link.??? - rm -f $prog - exit $OK - else - if [ ! -f $prog ] - then - echo " *** program $prog not found ***" - echo ' ' - cat link.out - echo ' ' - cat link.err - echo ' ' - rm -f link.??? - exit 1 - else - mv $prog $main_dir/exe/. - rm -f link.??? - fi - fi - -# end of link --------------------------------------------------------------- # diff --git a/model/bin/make_makefile.sh b/model/bin/make_makefile.sh deleted file mode 100755 index 7f436487e..000000000 --- a/model/bin/make_makefile.sh +++ /dev/null @@ -1,520 +0,0 @@ -#!/bin/bash -e -# --------------------------------------------------------------------------- # -# make_makefile.sh : Generates the makefile for WAVEWATCH based on switch # -# settings # -# This script is called by w3_make and therefore does # -# not print header information. # -# # -# programs used : w3_new Touches the correct files if compiler switches # -# have been changed. # -# build_utils.sh functions that are used for building ww3 # -# w3_setenv Sets environment variables for ww3 # -# # -# error codes : all error output goes directly to screen in w3_make. # -# # -# Hendrik L. Tolman # -# May 2009 # -# March 2014 # -# # -# Copyright 2009-2014 National Weather Service (NWS), # -# National Oceanic and Atmospheric Administration. All rights # -# reserved. WAVEWATCH III is a trademark of the NWS. # -# No unauthorized use without permission. # -# # -# --------------------------------------------------------------------------- # - -# --------------------------------------------------------------------------- # -# 1. Preparations # -# --------------------------------------------------------------------------- # - - -# 1.a ID header - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - echo ' ' - echo ' *****************************' - echo ' *** WAVEWATCH III makefile ***' - echo ' *****************************' - echo ' ' - -# 1.b Get data from setup file - - - - - - - - - - - - - - - - - - - - - - - - - - source $(dirname $0)/w3_setenv - main_dir=$WWATCH3_DIR - temp_dir=$WWATCH3_TMP - list=$WWATCH3_LIST - -# 1.c Source the utility functions - - - - - - - - - - - - - - - - - - - - - - - -. ${main_dir}/bin/build_utils.sh - - -# 1.d Go to temp dir - cd $temp_dir - - -# --------------------------------------------------------------------------- # -# 2. Part 1, subroutine dependencies # -# --------------------------------------------------------------------------- # - -# 2.a Get info from switch file - - - - - - - - - - - - - - - - - - - - - - - - - if [ -z "$(env | grep switch_file)" ] - then - switch_file=$main_dir/bin/switch - fi - - switch=$switch_file - old_sw=${switch_file}.old - new_sw=$main_dir/bin/w3_new - - if [ ! -f $old_sw ] - then - old_sw=$switch - $new_sw all - fi - - echo switch = $switch - -# 2.b Check switches - - check_switches - -# 2.c Get list of file names from switches - - switch_files - - -# 3.b Internal variables for makefile - - - - - - - - - - - - - - - - - - - - - - - # ar_cmd - os=`uname -s 2>/dev/null` - if [ "$os" = "AIX" ] - then - ar_cmd="ar -X32_64 rv" - else - ar_cmd="ar rv" - fi - - -# 3.c Create makefile header - - - - - - - - - - - - - - - - - - - - - - - - - - - echo '# -------------------------' > makefile - echo '# WAVEWATCH III makefile ' >> makefile - echo '# -------------------------' >> makefile - - -# 3.d Go through programs to create file list - - - - - - - - - - - - - - - - - echo ' ' >> makefile - echo '# WAVEWATCH III executables' >> makefile - echo '# -------------------------' >> makefile - - rm -f filelist.tmp - - - - progs="ww3_grid ww3_strt ww3_prep ww3_prnc ww3_shel ww3_multi ww3_sbs1 - ww3_outf ww3_outp ww3_trck ww3_trnc ww3_grib gx_outf gx_outp ww3_ounf - ww3_ounp ww3_gspl ww3_gint ww3_bound ww3_bounc ww3_systrk $tideprog" - progs="$progs ww3_multi_esmf ww3_uprstr" - progs="$progs libww3" - progs="$progs libww3.so" - - for prog in $progs - do - - # Get file - the list of files to be compiled - # and filel - list of files for linking a particular prog - create_file_list - - case $prog in - ww3_grid) IDstring='Grid preprocessor' ;; - ww3_strt) IDstring='Initial conditions program' ;; - ww3_bound) IDstring='boundary conditions program' ;; - ww3_bounc) IDstring='NetCDF boundary conditions program' ;; - ww3_prep) IDstring='Field preprocessor' ;; - ww3_prnc) IDstring='NetCDF field preprocessor' ;; - ww3_prtide) IDstring='Tide prediction' ;; - ww3_shel) IDstring='Generic shell' ;; - ww3_multi) IDstring='Multi-grid shell' ;; - ww3_multi_esmf) IDstring='Multi-grid ESMF module' ;; - ww3_sbs1) IDstring='Multi-grid shell sbs version' ;; - ww3_outf) IDstring='Gridded output' ;; - ww3_ounf) IDstring='Gridded NetCDF output' ;; - ww3_outp) IDstring='Point output' ;; - ww3_ounp) IDstring='Point NetCDF output' ;; - ww3_trck) IDstring='Track output post' ;; - ww3_trnc) IDstring='Track NetCDF output post' ;; - ww3_grib) IDstring='Gridded output (GRIB)' ;; - ww3_gspl) IDstring='Grid splitting' ;; - ww3_gint) IDstring='Grid Interpolation' ;; - gx_outf) IDstring='GrADS input file generation (gridded fields)' ;; - gx_outp) IDstring='GrADS input file generation for point output' ;; - ww3_systrk) IDstring='Wave system tracking postprocessor' ;; - libww3) IDstring='Object file archive' ;; - libww3.so) IDstring='Object file archive' ;; - ww3_uprstr) IDstring='Update Restart File' ;; - esac - - - echo "# $IDstring" >> makefile - echo ' ' >> makefile - - # if esmf is included in program name or if - # the target is compile and create archive - if [ -n "`echo $prog | grep esmf 2>/dev/null`" ] - then - d_string="$prog"' : $(aPo)/' - # if program name is libww3, then - # the target is compile and create archive - elif [ "$prog" = "libww3" ] || [ "$prog" = "libww3.so" ] - then - d_string="$prog"' : $(aPo)/' - else - d_string='$(aPe)/'"$prog"' : $(aPo)/' - fi - - - for file in $files - do - echo "$d_string$file.o" >> makefile - if [ -z "`echo $file | grep scrip 2>/dev/null`" ] - then - echo "$file" >> filelist.tmp - fi - done - - # if esmf is included in program name, then - # the target is compile and create archive - if [ -n "`echo $prog | grep esmf 2>/dev/null`" ] - then - lib=lib$prog.a - objs="" - for file in $filesl - do - objs="$objs $file.o" - done - echo " @cd \$(aPo); $ar_cmd $lib $objs" >> makefile - echo ' ' >> makefile - # if program name is libww3, then - # the target is compile and create archive - elif [ "$prog" = "libww3" ] - then - lib=$prog.a - objs="" - for file in $filesl - do - objs="$objs $file.o" - done - echo " @cd \$(aPo); $ar_cmd $lib $objs" >> makefile - echo ' ' >> makefile - # if program name is libww3.so, then - # the target is compile and create archive - elif [ "$prog" = "libww3.so" ] - then - lib=$prog - objs="" - for file in $filesl - do - objs="$objs $file.o" - done - echo " @cd \$(aPo); ld -o $lib -shared $objs" >> makefile - echo ' ' >> makefile - - else - echo ' @$(aPb)/link '"$filesl" >> makefile - echo ' ' >> makefile - fi - - done - - sort -u filelist.tmp > filelist - rm -f filelist.tmp - -# --------------------------------------------------------------------------- # -# 3. Part 2, includes in subroutines # -# --------------------------------------------------------------------------- # -# 3.a File ID - - echo ' Checking all subroutines for modules (this may take a while) ...' - - echo ' ' >> makefile - echo '# WAVEWATCH III subroutines' >> makefile - echo '# -------------------------' >> makefile - echo ' ' >> makefile - -# 3.b Loop over files - - for file in `cat filelist` - do - - suffixes="ftn f F f90 F90 c" - fexti=none - ispdlibi=no - for s in $suffixes - do - if [ -f $main_dir/src/$file.$s ] - then - fexti=$s - break - fi - if [ -f $main_dir/src/PDLIB/$file.$s ] - then - fexti=$s - ispdlibi=yes - break - fi - done - if [ "$fexti" = 'none' ] - then - echo ' *** make_makefile.sh error ***' - echo " Source file $main_dir/src/$file.* " - echo " or $main_dir/src/PDLIB/$file.* not found" - echo " Source file suffixes checked: $suffixes" - exit 2 - fi - if [ "$fexti" = 'ftn' ] - then - fexto=F90 - else - fexto=$fexti - fi - - string1='$(aPo)/'$file'.o : '$file.$fexti' 'w3macros.h' ' - string2=' @$(aPb)/ad3'" $file" - string3="$NULL" - - if [ "$ispdlibi" = 'yes' ] - then - string1='$(aPo)/'$file'.o : PDLIB/'$file.$fexti' ' - fi - - $main_dir/bin/ad3 $file 0 1 > ad3.out 2>&1 - - if [ -n "`grep error ad3.out`" ] - then - cat ad3.out - exit 20 - fi - rm -f ad3.out - - if [ "$fexto" = 'c' ] - then - touch check_file - else - check_file=`grep -i '^[[:blank:]]*use' $file.$fexto | awk '{print toupper($2)}' | \ - sed -e 's/,//' | sort -u` - fi - rm -f $file.$fexto - - for mod in $check_file - do - modfound=yes - case $mod in - 'W3UOSTMD' ) modtest=w3uostmd.o ;; - 'W3INITMD' ) modtest=w3initmd.o ;; - 'W3WAVEMD' ) modtest=w3wavemd.o ;; - 'W3WDASMD' ) modtest=w3wdasmd.o ;; - 'W3UPDTMD' ) modtest=w3updtmd.o ;; - 'W3FLDSMD' ) modtest=w3fldsmd.o ;; - 'W3CSPCMD' ) modtest=w3cspcmd.o ;; - 'MALLOCINFO_M' ) modtest=w3meminfo.o ;; - 'W3GDATMD' ) modtest=w3gdatmd.o ;; - 'W3WDATMD' ) modtest=w3wdatmd.o ;; - 'W3ADATMD' ) modtest=w3adatmd.o ;; - 'W3ODATMD' ) modtest=w3odatmd.o ;; - 'W3IDATMD' ) modtest=w3idatmd.o ;; - 'W3FLD1MD' ) modtest=w3fld1md.o ;; - 'W3FLD2MD' ) modtest=w3fld2md.o ;; - 'W3IOGRMD' ) modtest=w3iogrmd.o ;; - 'W3IOGOMD' ) modtest=w3iogomd.o ;; - 'W3IOPOMD' ) modtest=w3iopomd.o ;; - 'W3IOTRMD' ) modtest=w3iotrmd.o ;; - 'W3IORSMD' ) modtest=w3iorsmd.o ;; - 'W3IOBCMD' ) modtest=w3iobcmd.o ;; - 'W3IOSFMD' ) modtest=w3iosfmd.o ;; - 'W3PARTMD' ) modtest=w3partmd.o ;; - 'W3BULLMD' ) modtest=w3bullmd.o ;; - 'W3TIDEMD' ) modtest=w3tidemd.o ;; - 'W3CANOMD' ) modtest=w3canomd.o ;; - 'W3GIG1MD' ) modtest=w3gig1md.o ;; - 'W3STRKMD' ) modtest=w3strkmd.o ;; - 'W3PRO1MD' ) modtest=w3pro1md.o ;; - 'W3PRO2MD' ) modtest=w3pro2md.o ;; - 'W3PRO3MD' ) modtest=w3pro3md.o ;; - 'W3UQCKMD' ) modtest=w3uqckmd.o ;; - 'W3UNO2MD' ) modtest=w3uno2md.o ;; - 'W3PSMCMD' ) modtest=w3psmcmd.o ;; - 'W3PROFSMD' ) modtest=w3profsmd.o ;; - 'W3SRCEMD' ) modtest=w3srcemd.o ;; - 'W3FLX1MD' ) modtest=w3flx1md.o ;; - 'W3FLX2MD' ) modtest=w3flx2md.o ;; - 'W3FLX3MD' ) modtest=w3flx3md.o ;; - 'W3FLX4MD' ) modtest=w3flx4md.o ;; - 'W3FLX5MD' ) modtest=w3flx5md.o ;; - 'W3SLN1MD' ) modtest=w3sln1md.o ;; - 'W3SRC0MD' ) modtest=w3src0md.o ;; - 'W3SRC1MD' ) modtest=w3src1md.o ;; - 'W3SRC2MD' ) modtest=w3src2md.o ;; - 'W3SRC3MD' ) modtest=w3src3md.o ;; - 'W3SRC4MD' ) modtest=w3src4md.o ;; - 'W3SRC6MD' ) modtest=w3src6md.o ;; - 'W3SNL1MD' ) modtest=w3snl1md.o ;; - 'W3SNL2MD' ) modtest=w3snl2md.o ;; - 'W3SNL3MD' ) modtest=w3snl3md.o ;; - 'W3SNL4MD' ) modtest=w3snl4md.o ;; - 'W3SNL5MD' ) modtest=w3snl5md.o ;; - 'W3SNLSMD' ) modtest=w3snlsmd.o ;; - 'M_XNLDATA' ) modtest=mod_xnl4v5.o ;; - 'SERV_XNL4V5' ) modtest=serv_xnl4v5.o ;; - 'M_FILEIO' ) modtest=mod_fileio.o ;; - 'M_CONSTANTS' ) modtest=mod_constants.o ;; - 'W3SWLDMD' ) modtest=w3swldmd.o ;; - 'W3SBT1MD' ) modtest=w3sbt1md.o ;; - 'W3SBT4MD' ) modtest=w3sbt4md.o ;; - 'W3SBT8MD' ) modtest=w3sbt8md.o ;; - 'W3SBT9MD' ) modtest=w3sbt9md.o ;; - 'W3SDB1MD' ) modtest=w3sdb1md.o ;; - 'W3STR1MD' ) modtest=w3str1md.o ;; - 'W3SBS1MD' ) modtest=w3sbs1md.o ;; - 'W3SIC1MD' ) modtest=w3sic1md.o ;; - 'W3SIC2MD' ) modtest=w3sic2md.o ;; - 'W3SIC3MD' ) modtest=w3sic3md.o ;; - 'W3SIC4MD' ) modtest=w3sic4md.o ;; - 'W3SIC5MD' ) modtest=w3sic5md.o ;; - 'W3SIS1MD' ) modtest=w3sis1md.o ;; - 'W3SIS2MD' ) modtest=w3sis2md.o ;; - 'W3REF1MD' ) modtest=w3ref1md.o ;; - 'CONSTANTS' ) modtest=constants.o ;; - 'W3SERVMD' ) modtest=w3servmd.o ;; - 'W3TIMEMD' ) modtest=w3timemd.o ;; - 'W3ARRYMD' ) modtest=w3arrymd.o ;; - 'W3DISPMD' ) modtest=w3dispmd.o ;; - 'W3GSRUMD' ) modtest=w3gsrumd.o ;; - 'W3TRIAMD' ) modtest=w3triamd.o ;; - 'WMINITMD' ) modtest=wminitmd.o ;; - 'WMWAVEMD' ) modtest=wmwavemd.o ;; - 'WMFINLMD' ) modtest=wmfinlmd.o ;; - 'WMMDATMD' ) modtest=wmmdatmd.o ;; - 'WMGRIDMD' ) modtest=wmgridmd.o ;; - 'WMUPDTMD' ) modtest=wmupdtmd.o ;; - 'WMINIOMD' ) modtest=wminiomd.o ;; - 'WMUNITMD' ) modtest=wmunitmd.o ;; - 'WMIOPOMD' ) modtest=wmiopomd.o ;; - 'WMSCRPMD' ) modtest=wmscrpmd.o ;; - 'WMESMFMD' ) modtest=wmesmfmd.o ;; - 'W3GETMEM' ) modtest=w3getmem.o ;; - 'WW_CC' ) modtest=ww.comm.o ;; - 'CMP_COMM' ) modtest=cmp.comm.o ;; - 'W3OACPMD' ) modtest=w3oacpmd.o ;; - 'W3AGCMMD' ) modtest=w3agcmmd.o ;; - 'W3OGCMMD' ) modtest=w3ogcmmd.o ;; - 'W3IGCMMD' ) modtest=w3igcmmd.o ;; - 'W3NMLMULTIMD' ) modtest=w3nmlmultimd.o ;; - 'W3NMLPRNCMD' ) modtest=w3nmlprncmd.o ;; - 'W3NMLOUNFMD' ) modtest=w3nmlounfmd.o ;; - 'W3NMLOUNPMD' ) modtest=w3nmlounpmd.o ;; - 'W3NMLTRNCMD' ) modtest=w3nmltrncmd.o ;; - 'W3NMLBOUNCMD' ) modtest=w3nmlbouncmd.o ;; - 'W3NMLBOUNDMD' ) modtest=w3nmlboundmd.o ;; - 'W3NMLSHELMD' ) modtest=w3nmlshelmd.o ;; - 'W3NMLGRIDMD' ) modtest=w3nmlgridmd.o ;; - 'W3NMLUPRSTRMD' ) modtest=w3nmluprstrmd.o ;; - 'YOWFUNCTION' ) modtest=yowfunction.o ;; - 'YOWDATAPOOL' ) modtest=yowdatapool.o ;; - 'YOWNODEPOOL' ) modtest=yownodepool.o ;; - 'YOWSIDEPOOL' ) modtest=yowsidepool.o ;; - 'YOWRANKMODULE' ) modtest=yowrankModule.o ;; - 'YOWERR' ) modtest=yowerr.o ;; - 'YOWELEMENTPOOL' ) modtest=yowelementpool.o ;; - 'YOWEXCHANGEMODULE' ) modtest=yowexchangeModule.o ;; - 'YOWPDLIBMAIN' ) modtest=yowpdlibmain.o ;; - 'PDLIB_FIELD_VEC' ) modtest=pdlib_field_vec.o ;; - 'PDLIB_W3PROFSMD' ) modtest=w3profsmd_pdlib.o ;; - 'W3PARALL' ) modtest=w3parall.o ;; - 'W3SMCOMD' ) modtest=w3smcomd.o ;; - 'W3OUNFMETAMD' ) modtest=w3ounfmetamd.o ;; - 'W3METAMD' ) modtest=w3metamd.o ;; - 'W3GRIDMD' ) modtest=w3gridmd.o ;; - * ) modfound=no ;; - esac - - if [ "$modfound" == "yes" ] - then - if [ "$modtest" != "$file.o" ] - then - string3="$string3 "'$(aPo)/'"$modtest" - fi - fi - done - rm -f check_file - - string_scripnc='$(aPo)/scrip_netcdfmod.o $(aPo)/scrip_remap_write.o $(aPo)/scrip_remap_read.o' - if [ "$scrip" = 'SCRIP' ] && [ "$file" = 'wmscrpmd' ] - then - S_string2='$(aPo)/scrip_constants.o $(aPo)/scrip_grids.o $(aPo)/scrip_iounitsmod.o $(aPo)/scrip_remap_vars.o $(aPo)/scrip_timers.o $(aPo)/scrip_errormod.o $(aPo)/scrip_interface.o $(aPo)/scrip_kindsmod.o $(aPo)/scrip_remap_conservative.o' - if [ "$scripnc" = 'SCRIPNC' ] - then - S_string2="$S_string2 $string_scripnc" - fi - string3="$string3 $S_string2" - fi - - if [ "$scrip" = 'SCRIP' ] && [ "$file" = 'wmgridmd' ] - then - S_string2='$(aPo)/scrip_constants.o $(aPo)/scrip_grids.o $(aPo)/scrip_iounitsmod.o $(aPo)/scrip_remap_vars.o $(aPo)/scrip_timers.o $(aPo)/scrip_errormod.o $(aPo)/scrip_interface.o $(aPo)/scrip_kindsmod.o $(aPo)/scrip_remap_conservative.o' - if [ "$scripnc" = 'SCRIPNC' ] - then - S_string2="$S_string2 $string_scripnc" - fi - string3="$string3 $S_string2" - fi - - echo "$string1$string3" >> makefile - echo "$string2" >> makefile - echo ' ' >> makefile - - done - - echo '# end of WAVEWATCH III subroutines' >> makefile - rm -f filelist - - if [ "$scrip" = 'SCRIP' ] - then - echo ' ' >> makefile - echo ' ' >> makefile - echo '# SCRIP subroutines' >> makefile - echo '# -----------------' >> makefile - echo ' ' >> makefile - - scrip_dir=$main_dir/src/SCRIP - if [ ! -d $scrip_dir ] - then - echo "*** SCRIP directory $scrip_dir not found ***" - exit 21 - fi - - if [ "$scripnc" = 'SCRIPNC' ] - then - scrip_mk=$scrip_dir/SCRIP_NC.mk - else - scrip_mk=$scrip_dir/SCRIP.mk - fi - if [ ! -e $scrip_mk ] - then - echo "*** SCRIP makefile fragment $scrip_mk not found ***" - exit 22 - fi - - cat $scrip_mk >> makefile - - echo '# end of SCRIP subroutines' >> makefile - fi - -# --------------------------------------------------------------------------- # -# 4. Move makefile to proper place # -# --------------------------------------------------------------------------- # - - mv makefile $main_dir/src/makefile - -# end of script ------------------------------------------------------------- # diff --git a/model/bin/sort_all_switches b/model/bin/sort_all_switches deleted file mode 100755 index ade2142f7..000000000 --- a/model/bin/sort_all_switches +++ /dev/null @@ -1,173 +0,0 @@ -#!/bin/bash -# --------------------------------------------------------------------------- # -# sort_all_switches: Run sort_switch on known switch files. # -# # -# use : sort_all_switches [options] switch_file # -# See usage function for options. # -# # -# error codes : Program ends if error occurs in sort_switch. # -# # -# remarks: # -# * Use all_switches to update data in 1.a.6. # -# # -# Hendrik L. Tolman # -# November 2013 # -# # -# Copyright 2013 National Weather Service (NWS), # -# National Oceanic and Atmospheric Administration. All rights # -# reserved. WAVEWATCH III is a trademark of the NWS. # -# No unauthorized use without permission. # -# # -# --------------------------------------------------------------------------- # - - -# --------------------------------------------------------------------------- # -# 1. Preparations # -# --------------------------------------------------------------------------- # -# 1.a Internal variables - - set -e - home_dir=`pwd` - -# 1.a.2 Usage function - - scriptname="`basename $0`" - optstr="hu" - - usage () -{ -cat 2>&1 << EOF - -Usage: $scriptname [options] -Options: - -h : help, print this. - -u : allow updating (adding) switches, - otherwise this gives an error exit -EOF -} - -# 1.a.3 Process input (part 1) - - args=`getopt $optstr $*` - - if [ $? != 0 ] - then - usage - exit 1 - fi - - set -- $args - - while : - do - case "$1" in - -h) help=1 ;; - -u) update=1 ;; - --) break ;; - esac - shift - done - shift - - if [ $help ] - then - usage - exit 1 - fi - -# 1.a.4 Get data from setup file - - - - - - - - - - - - - - - - - - - - - - - - - - source $(dirname $0)/w3_setenv - main_dir=$WWATCH3_DIR - temp_dir=$WWATCH3_TMP - source=$WWATCH3_SOURCE - list=$WWATCH3_LIST - -# 1.a.5 Other parameters - - options='-s -r' - - if [ "$update" ] ; then - options="$options -u" ; fi - - i_count='0' - -# 1.b ID header - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - echo ' ' - echo ' ********************************************' - echo ' *** sorting most WAVEWATCH III switch files ***' - echo ' *******************************************' - echo ' ' - echo " Main directory : $main_dir" - echo " sort_switch options : $options" - echo ' ' - -# --------------------------------------------------------------------------- # -# 2. Switches in bin directory # -# --------------------------------------------------------------------------- # - - echo ' ' - echo " WAVEWATCH III bin directory ..." - echo " -------------------------------" - cd $main_dir/bin - - for file in switch* - do - echo " processing $file ..." - ./sort_switch $options $file - if [ "$?" != '0' ] ; then - exit 1 ; fi - i_count=$(($i_count + 1)) - done - -# --------------------------------------------------------------------------- # -# 3. Switches in regtests directory # -# --------------------------------------------------------------------------- # - - echo ' ' - echo " WAVEWATCH III regtests directory ..." - echo " ------------------------------------" - cd $main_dir/regtests - - for dir1 in `ls` - do - if [ -d $dir1 ] && [ "$dir1" != 'bin' ] - then - echo " Directory $dir1 ..." - cd $dir1 - for dir2 in `ls -d input*` - do - echo " Directory $dir2 ..." - cd $dir2 - for file in switch* - do - echo " processing $file ..." - ./sort_switch $options $file - if [ "$?" != '0' ] ; then - exit 1 ; fi - i_count=$(($i_count + 1)) - done - cd .. - done - cd .. - fi - done - -# --------------------------------------------------------------------------- # -# x. End of program ID / clean up # -# --------------------------------------------------------------------------- # - -# cd $home_dir -# rm -rf $temp_dir - - echo ' ' - echo " A total of $i_count switch files processed." - echo ' ' - echo ' ' - echo ' *************************' - echo ' *** end of switch sorting ***' - echo ' *************************' - echo ' ' - -# End of sort_all_switches -------------------------------------------------- # diff --git a/model/bin/sort_switch b/model/bin/sort_switch deleted file mode 100755 index 5167fbba2..000000000 --- a/model/bin/sort_switch +++ /dev/null @@ -1,562 +0,0 @@ -#!/bin/bash -e -# --------------------------------------------------------------------------- # -# sort_switch: Script to unify the way the switches are ordered in the switch # -# file, while checking and correcting for missing switches. # -# # -# use : sort_switch [options] switch_file # -# See usage function for options. # -# # -# error codes : Various error outputs with explanaition. # -# # -# scripts used : # -# build_utils.sh Script with all mandatory switches defined. # -# # -# remarks: # -# * Use all_switches to update data in 1.a.6. # -# # -# Hendrik L. Tolman # -# November 2013 # -# # -# Copyright 2013 National Weather Service (NWS), # -# National Oceanic and Atmospheric Administration. All rights # -# reserved. WAVEWATCH III is a trademark of the NWS. # -# No unauthorized use without permission. # -# # -# --------------------------------------------------------------------------- # - - -# --------------------------------------------------------------------------- # -# 1. Preparations # -# --------------------------------------------------------------------------- # -# 1.a Internal variables - - set -e - home_dir=`pwd` - -# 1.a.2 Usage function - - scriptname="`basename $0`" - optstr="a:e:ho:rsuv" - - usage () -{ -cat 2>&1 << EOF - -Usage: $scriptname [options] switch_file -Required: - switch_file: name of switch file to be processed -Options: - -a switch_add : switch to add to file. - -e switch_ext : switch to extract from file. - -h : help, print this. - -o output_file : name of output file - * default is switch_file.new - -r : replace old file - * overrides -o - -s : silent mode, no output at all - * overrides -v - -u : allow updating (adding) switches, - otherwse this gives an error exit - -v : verbose, show program output -EOF -} - -# 1.a.3 Process input (part 1) - - args=`getopt $optstr $*` - - if [ $? != 0 ] - then - usage - exit 1 - fi - - set -- $args - not_silent=1 - - while : - do - case "$1" in - -a) shift; add=$1 ;; - -e) shift; extract=$1 ;; - -h) help=1 ;; - -o) shift; outp_file="$1" ;; - -r) replace=1 ;; - -s) not_silent=$NULL ;; - -u) update=1 ;; - -v) verbose=1 ;; - --) break ;; - esac - shift - done - shift - - if [ -z "$not_silent" ] ; then - verbose=$NULL ; fi - - if [ $help ] - then - usage - exit 1 - fi - - if [ ! $# = 0 ] - then - switch_file="$1" ; shift - if [ -z "$outp_file" ] ; then - outp_file=$switch_file.new ; fi - if [ "$replace" ] ; then - outp_file=$switch_file ; fi - else - usage - exit 2 - fi - -# 1.a.4 Get data from setup file - - - - - - - - - - - - - - - - - - - - - - - - - - source $(dirname $0)/w3_setenv - main_dir=$WWATCH3_DIR - temp_dir=$WWATCH3_TMP - source=$WWATCH3_SOURCE - list=$WWATCH3_LIST - -# 1.a.5 Process input (part 2) - - bin_dir="$main_dir/exe" - script="$main_dir/bin/build_utils.sh" - shorts="build_utils.stripped" - - mkdir -p $temp_dir - - if [ ! -f $switch_file ] ; then - echo " *** cannot find $switch_file ***" ; exit 4 ; fi - - if [ ! -f $script ] ; then - echo " *** cannot find $script ***" ; exit 5 ; fi - -# 1.a.6 Additional setups - - outs="O0 O1 O2 O2a O2b O2c O3 O4 O5 O6 O7 O7a O7b O8 O9 O10 O11 O12 O13 O14 O15 O16" - trace="S" - tests="T T0 T1 T1a T2 T3 T38 T4 T5 T6 T7 T8 T9 MPIT TIDET SCRIPTST" - -# 1.b ID header - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if [ "$not_silent" ] - then - echo ' ' - echo ' **************************************' - echo ' *** sorting WAVEWATCH III switch file ***' - echo ' *************************************' - echo ' ' - echo " Switch file : $switch_file" - echo " Output file : $outp_file" - echo " Local directory : $home_dir" - echo " Main directory : $main_dir" - echo " Scratch directory : $temp_dir" - echo " Base script : $script" - if [ -n "$add" ] ; then - echo " Add : $add" ; fi - if [ -n "$extract" ] ; then - echo " Extract : $extract" ; fi - echo ' ' - fi - -# 1.d Set up work space - - - - - - - - - - - - - - - - - - - - - - - - - - - - - cd $temp_dir - - rm -f tempfile* - -# --------------------------------------------------------------------------- # -# 2. Setting up processing # -# --------------------------------------------------------------------------- # -# 2.a Unpack switch file - - if [ "$not_silent" ] - then - echo " Reading $switch_file ..." - fi - - old_switches="`head -1 $home_dir/$switch_file`" - -# add switch as requested - - found=0 - if [ -n "add" ] - then - work_sw="$old_switches" - for sw in $work_sw - do - if [ "$sw" = "$add" ] ; then - found=$(($found + 1)) ; fi - done - if [ "$found" = '0' ] ; then - old_switches="$old_switches $add" ; fi - fi - -# remove switch as requested - - if [ -n "extract" ] - then - work_sw="$old_switches" - old_switches= - for sw in $work_sw - do - if [ "$sw" != "$extract" ] - then - if [ -z "$old_switches" ] - then - old_switches="$sw" - else - old_switches="$old_switches $sw" - fi - fi - done - fi - -# spaces added to old_switches start and end to make searching easy - - old_switches=" $old_switches " - - work_sw="$old_switches" - new_switches= - i_tot='0' - i_add='0' - i_lft=`echo $old_switches | wc -w | awk '{ print $1 }'` - i_old=$i_lft - -# 2.b Getting keywords from build_utils.sh - - if [ "$not_silent" ] - then - echo " Keywords from $script ..." - fi - - sed -n /'for type in'/,/'do'/p $script > tempfile.$$ - - sed -e 's/for type in//g' \ - -e 's/do//g' \ - -e 's/\\//g' \ - -e 's/\n//g' tempfile.$$ > tempfile2.$$ - - set `cat tempfile2.$$` - keywords="$*" - - rm -f tempfile.$$ tempfile2.$$ - -# 2.c Strip build_utils.sh - - sed -n /'for type in'/,/'esac'/p $script > tempfile.$$ - - sed -n /'case'/,/'esac'/p tempfile.$$ > $shorts - rm -f tempfile.$$ - -# --------------------------------------------------------------------------- # -# 3. Looping over keywords # -# --------------------------------------------------------------------------- # -# 3.a start of keyword loop - - if [ "$not_silent" ] - then - echo ' ' - echo " Looping over keywords ..." - fi - - for key in $keywords - do - -# 3.b Find setup in script - - sed -n /sort:$key:/,/\;\;/p $shorts | \ - sed -e "s/$key//g" -e 's/)//g' -e 's/\;//g' > tempfile.$$ - - lines=`wc -l tempfile.$$ | awk '{ print $1}'` - if [ "$lines" = '0' ] ; then - echo "keyword $key not found, abort" ; exit 6 ; fi - - . ./tempfile.$$ - - rm -f tempfile.$$ - -# 3.c Process switches for keyword - - i_fnd='0' - found= - msg= - - for sw in $OK - do - for avail in $work_sw - do - if [ "$sw" = "$avail" ] - then - i_fnd=$(($i_fnd + 1)) - if [ "$i_fnd" = '1' ] - then - found="$sw" - else - found="$found $sw" - fi - fi - done - - done - - if [ "$verbose" ] - then - echo " $key $i_fnd $found [$OK]" - fi - -# 3.d Too many switches found (error) - - case $TY in - 'upto2' ) i_tst='2' ;; - * ) i_tst='1' ;; - esac - - if [ "$i_fnd" -gt "$i_tst" ] ; then - echo "keyword $key $i_fnd hits (>1) [$found], abort" ; exit 7 ; fi - -# 3.e process types - case $TY in - -# 3.e.1 process type 'one' - - 'one' ) - if [ "$i_fnd" = '0' ] - then - i_sec='0' - for sw in $OK - do - for swf in $new_switches - do - if [ "$sw" = "$swf" ] - then - i_sec=$(($i_sec + 1)) - found="$sw" - fi - done - done - if [ "$i_sec" = '0' ] - then - i_fnd='1' - found=`echo $OK | awk '{ print $1}'` - msg=' (added)' - i_add=$(($i_add + 1)) - else - msg=' (dual use)' - fi - fi ;; - -# 3.e.2 process type 'upto1' - - 'upto1' ) - ;; - -# 3.e.3 process type 'upto2' - - 'upto2' ) - ;; - -# 3.e.4 unknown default - - * ) echo "[error in sort_switch] unknown type $TY" ; exit 99 ;; - esac - - if [ "$verbose" ] - then - string=`echo "$key $i_fnd" | awk '{ printf "%-10.10s %1.1s", $1, $2 }'` - echo " $string $found$msg" - fi - -# 3.f Add to new_switches - - if [ "$i_fnd" != '0' ] - then - if [ -z "$new_switches" ] - then - new_switches="$found" - i_tot="$i_fnd" - else - for pfnd in $found - do - lines=`echo $new_switches |grep $pfnd | wc -l | awk '{ print $1}'` - if [ "$lines" = '0' ] - then - new_switches="$new_switches $pfnd" - i_tot=$(($i_tot + 1)) - fi - done - fi - fi - -# if [ "$verbose" ] -# then -# echo " $i_tot $i_add $new_switches" -# fi - -# 3.g Remove from old_switches - - if [ "$i_fnd" != '0' ] - then - for pfnd in $found - do - temp_sw=`echo "$work_sw" | sed -e "s/ $pfnd / /g"` - work_sw=$temp_sw - done - i_lft=`echo $work_sw | wc -w | awk '{ print $1 }' ` - fi - -# if [ "$verbose" ] -# then -# echo " $work_sw" -# fi - -# 3.h End of keyword loop 3.a - - done - - rm -f $shorts - - if [ "$verbose" ] - then - echo ' ' - echo " Looping over keywords finished" - fi - - if [ "$not_silent" ] - then - echo " Found $i_tot, $i_add of which added to list, $i_lft left." - fi - -# --------------------------------------------------------------------------- # -# 4. Dealing with left over switches # -# --------------------------------------------------------------------------- # -# 4.a Loop over additional types - - for type in out strace test - do - -# 4.b Identify type - - case $type in - out ) switches=$outs - ID='output options' ;; - strace ) switches=$trace - ID='subr. tracing' ;; - test ) switches=$tests - ID='test output' ;; - esac - - if [ "$not_silent" ] - then - echo ' ' - echo " Processing $ID ..." - fi - -# 4.c Loop over switchs - - for sw in $switches - do - i_fnd='0' - found= - for avail in $work_sw - do - if [ "$sw" = "$avail" ] - then - if [ "$i_fnd" = '0' ] - then - i_fnd='1' - found="$sw" - fi - fi - done - -# 4.d Switch found, process - - if [ "$i_fnd" = '1' ] - then - i_tot=$(($i_tot + 1)) - new_switches="$new_switches $found" - temp_sw=`echo "$work_sw" | sed -e "s/ $found / /g"` - work_sw=$temp_sw - i_lft=`echo $work_sw | wc -w | awk '{ print $1 }' ` - fi - - if [ "$verbose" ] - then - string=`echo "$sw $i_fnd" | awk '{ printf "%-10.10s %1.1s", $1, $2 }'` - echo " $string $found" - fi - - done - -# 4.e End of main loop, generate output - - if [ "$verbose" ] - then - echo ' ' - echo " Looping for $ID finished" - fi - - if [ "$not_silent" ] - then - echo " Found $i_tot, $i_add of which added to list, $i_lft left." - fi - - done - -# --------------------------------------------------------------------------- # -# 5. Processing done, last checks and output # -# --------------------------------------------------------------------------- # - - if [ "$i_lft" != '0' ] - then - if [ "$not_silent" ] - then - echo ' ' - fi - echo "sort_switch: could not process all switches [$work_sw] abort." - exit 8 - fi - - if [ "$i_tot" != "$i_old" ] && [ ! "$update" ] - then - if [ "$not_silent" ] - then - echo ' ' - fi - echo "sort_switch: number of switches not conserved [$i_old,$i_tot]." - exit 8 - fi - - if [ "$not_silent" ] - then - echo ' ' - echo " Processing done, saving in $outp_file." - if [ "$i_tot" != "$i_old" ] - then - echo " Added $i_add switches." - fi - fi - - echo "$new_switches" > $home_dir/$outp_file - -# --------------------------------------------------------------------------- # -# 6. End of program ID / clean up # -# --------------------------------------------------------------------------- # - -# cd $home_dir -# rm -rf $temp_dir - - if [ "$not_silent" ] - then - echo ' ' - echo ' *************************' - echo ' *** end of switch sorting ***' - echo ' *************************' - echo ' ' - fi - -# End of sort_switch -------------------------------------------------------- # diff --git a/model/bin/w3_automake b/model/bin/w3_automake deleted file mode 100755 index 916324c22..000000000 --- a/model/bin/w3_automake +++ /dev/null @@ -1,416 +0,0 @@ -#!/bin/bash -e -# --------------------------------------------------------------------------- # -# w3_automake : Script to manage consecutive compiling of parallel and # -# sequential programs of WAVEWATCH III using w3_make scripts. # -# # -# use : w3_automake [program [...]] # -# program: program name of WAVEWATCH III (sub)program. # -# # -# M. Accensi # -# March 2018 # -# # -# Copyright 2010-2018 National Weather Service (NWS), # -# National Oceanic and Atmospheric Administration. All rights # -# reserved. WAVEWATCH III is a trademark of the NWS. # -# No unauthorized use without permission. # -# # -# --------------------------------------------------------------------------- # - - -# --------------------------------------------------------------------------- # -# 1. Preparations # -# --------------------------------------------------------------------------- # - -# 1.a ID header - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - echo ' ' - echo ' *****************************' - echo ' *** WAVEWATCH III automake ***' - echo ' *****************************' - echo ' ' - - - -# 1.b Input arguments - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if [ $# -eq 0 ] - then - all_programs="" - else - all_programs="$*" - fi - - -# 1.c Get data from setup file - - - - - - - - - - - - - - - - - - - - - - - - - - source $(dirname $0)/w3_setenv - main_dir=$WWATCH3_DIR - temp_dir=$WWATCH3_TMP - source=$WWATCH3_SOURCE - list=$WWATCH3_LIST - - -# 1.d Check / make directories - - - - - - - - - - - - - - - - - - - - - - - - - # bin dir - if [ ! -d $main_dir/bin ] - then - echo ' ' - echo "[ERROR] Directory $main_dir/bin not found" - echo ' Please check the content of your directory model' - exit 1 - fi - - # switch file - switch_file=$main_dir/bin/switch - if [ ! -e $switch_file ] || [ ! -r $switch_file ] - then - echo ' ' - echo "[ERROR] switch file $switch_file not found" - echo " Please run $main_dir/bin/w3_setup -c -s " - exit 1 - fi - cp $switch_file $main_dir/exe/ - - # comp file - comp_file=$main_dir/bin/comp - if [ ! -e $comp_file ] || [ ! -r $comp_file ] - then - echo ' ' - echo "[ERROR] comp file $comp_file not found" - echo " Please run $main_dir/bin/w3_setup -c -s " - exit 1 - fi - - # link file - link_file=$main_dir/bin/link - if [ ! -e $link_file ] || [ ! -r $link_file ] - then - echo ' ' - echo "[ERROR] link file $comp_file not found" - echo " Please run $main_dir/bin/w3_setup -c -s " - exit 1 - fi - - # src dir - makefile=$main_dir/src/makefile - if [ ! -d $main_dir/src ] - then - echo ' ' - echo "[ERROR] Directory $main_dir/src not found" - echo ' Please check the content of your directory model' - exit 1 - fi - rm -f $makefile - - # exe dir - if [ ! -d $main_dir/exe ] - then - mkdir -p $main_dir/exe - fi - - # work dir - if [ ! -d $main_dir/work ] - then - mkdir -p $main_dir/work - fi - - -# 1.e Set regular and netCDF progs - - - - - - - - - - - - - - - - - - - - - - - - #STRT BOUND OUTF OUTP TRCK GRIB GINT GX* UPRSTR - reg_programs="ww3_strt" - reg_programs="$reg_programs ww3_bound" - reg_programs="$reg_programs ww3_outf" - reg_programs="$reg_programs ww3_outp" - reg_programs="$reg_programs ww3_trck" - reg_programs="$reg_programs ww3_grib" - reg_programs="$reg_programs ww3_gint" - reg_programs="$reg_programs gx_outf" - reg_programs="$reg_programs gx_outp" - reg_programs="$reg_programs ww3_uprstr" - - # PRNC OUNF OUNP BOUNC TRNC - cdf_programs="ww3_prnc" - cdf_programs="$cdf_programs ww3_ounf" - cdf_programs="$cdf_programs ww3_ounp" - cdf_programs="$cdf_programs ww3_bounc" - cdf_programs="$cdf_programs ww3_trnc" - - # PRTIDE - if [ -n "`grep TIDE $switch_file`" ] - then - cdf_programs="$cdf_programs ww3_prtide" - fi - - # MULTI MULTI_ESMF SBS1 LIBWW3 - if [ -n "`grep SCRIPNC $switch_file`" ] || [ -n "`grep OASIS $switch_file`" ] || [ -n "`grep PDLIB $switch_file`" ] - then - cdf_programs="$cdf_programs ww3_grid" - cdf_programs="$cdf_programs ww3_multi" - cdf_programs="$cdf_programs ww3_sbs1" - cdf_programs="$cdf_programs libww3" - if [ $ESMFMKFILE ] - then - cdf_programs="$cdf_programs ww3_multi_esmf" - fi - else - reg_programs="$reg_programs ww3_grid" - reg_programs="$reg_programs ww3_multi" - reg_programs="$reg_programs ww3_sbs1" - reg_programs="$reg_programs libww3" - if [ $ESMFMKFILE ] - then - reg_programs="$reg_programs ww3_multi_esmf" - fi - fi - - # SYSTRK - if [ -n "`grep TRKNC $switch_file`" ] - then - cdf_programs="$cdf_programs ww3_systrk" - else - reg_programs="$reg_programs ww3_systrk" - fi - - # PREP GSPL - if [ -n "`grep OASIS $switch_file`" ] || [ -n "`grep PDLIB $switch_file`" ] - then - cdf_programs="$cdf_programs ww3_gspl" - cdf_programs="$cdf_programs ww3_prep" - else - reg_programs="$reg_programs ww3_gspl" - reg_programs="$reg_programs ww3_prep" - fi - - #SHEL - if [ -n "`grep OASIS $switch_file`" ] || [ -n "`grep PDLIB $switch_file`" ] - then - cdf_programs="$cdf_programs ww3_shel" - else - reg_programs="$reg_programs ww3_shel" - fi - - #Shared Object - if [ -n "`grep -nri fPIC $comp_file`" ] - then - reg_programs="$reg_programs libww3.so" - else - echo 'Shared Object : No' - fi - -# 1.f sort sequential and parallel programs - - - - - - - - - - - - - - - - - - - - # if no progs in argument - if [ -z "$all_programs" ] - then - if [ -z "$WWATCH3_NETCDF" ] - then - all_programs="$reg_programs" - else - all_programs="$reg_programs $cdf_programs" - fi - fi - echo ' ' - echo "[INFO] list of the programs selected : $all_programs" - - for prog in $all_programs - do - # skip to next prog if no NETCDF env and prog in cdf_programs list - if [ -z "$WWATCH3_NETCDF" ] && [ ! -z "$(echo $cdf_programs | grep $prog)" ] - then - echo "[WARNING] $prog is skipped because it need netCDF lib which is not set up" - continue - fi - - # sort in seq or mpi programs - par_programs="ww3_shel ww3_multi ww3_sbs1" - if [ -n "$(grep TIDE $switch_file)" ] - then - par_programs="$par_programs ww3_prtide ww3_prnc" - fi - if [ $ESMFMKFILE ] - then - par_programs="$par_programs ww3_multi_esmf" - fi - if [ -n "$(grep OASIS $switch_file)" ] - then - par_programs="$par_programs ww3_prnc ww3_prep ww3_prtide" - fi - if [ -n "$(grep MPI $switch_file)" ] || [ -n "$(grep OMPG $switch_file)" ] || [ -n "$(grep PDLIB $switch_file)"] - then - if [ ! -z "$(echo $par_programs | grep $prog)" ] - then - par_progs="$par_progs $prog" - else - seq_progs="$seq_progs $prog" - fi - # add seq compilation of ww3_prnc if already compiled in par for TIDE - if [ "$(echo $prog)" == "ww3_prnc" ] && [ -n "$(grep TIDE $switch_file)" ] - then - seq_progs="$seq_progs ww3_prnc" - fi - else - seq_progs="$seq_progs $prog" - fi - done - - -# --------------------------------------------------------------------------- # -# 2. Process switch files # -# --------------------------------------------------------------------------- # - - # "DIST MPI" - if [ -n "$(grep MPI $switch_file)" ] && [ ! -n "$(grep OMPG $switch_file)" ] - then - MODES="MPI" - fi -# "SHRD OMPG" - if [ ! -n "$(grep MPI $switch_file)" ] && [ -n "$(grep OMPG $switch_file)" ] - then - MODES="OMP" - fi -# "DIST MPI OMPG OMPH" - if [ -n "$(grep MPI $switch_file)" ] && [ -n "$(grep OMPG $switch_file)" ] - then - MODES="HYB" - fi -# "SHRD" - if [ ! -n "$(grep MPI $switch_file)" ] && [ ! -n "$(grep OMPG $switch_file)" ] - then - MODES="SEQ" - fi - - # set sequential switch if parallel mode - cd $main_dir/bin - mkdir -p $main_dir/work_$MODES - cp switch $main_dir/work_$MODES/switch.$MODES - - # if parallel switch and no parallel prog selected : unset parallel mode - if [ "$MODES" != "SEQ" ] && [ -z "$par_progs" ] - then - MODES="" - fi - - # if parallel switch and sequential prog selected : add sequential mode - if [ "$MODES" != "SEQ" ] && [ ! -z "$seq_progs" ] - then - MODES="SEQ $MODES" - fi - - # create sequential switch if needed - if [ "$MODES" != "SEQ" ] - then - mkdir -p $main_dir/work_SEQ - ./sort_switch -s -r switch - sed -e 's/DIST/SHRD/g' \ - -e 's/PDLIB //g' \ - -e 's/METIS //g' \ - -e 's/SCOTCH //g' \ - -e 's/OMPG //g' \ - -e 's/PDLIB //g' \ - -e 's/OMPH //g' \ - -e 's/MPI //g' switch > $main_dir/work_SEQ/switch.SEQ - fi - - exec_type_file=$main_dir/exe/exec_type - switch_file_old=$main_dir/bin/switch.old - - -# --------------------------------------------------------------------------- # -# 3. Compile sequential and/or parallel codes # -# --------------------------------------------------------------------------- # - - for MODE in $MODES - do - - if [ "$MODE" == "SEQ" ] - then - progs=$seq_progs - else - progs=$par_progs - fi - - if [ "$MODES" == "SEQ" ] - then - progs="$seq_progs $par_progs" - fi - - echo ' ' - echo "[INFO] $MODE progs : $progs" - echo ' ' - - # clean up mod and obj - rm -rf $main_dir/obj - rm -rf $main_dir/mod - mkdir -p $main_dir/obj_$MODE - mkdir -p $main_dir/mod_$MODE - ln -sf $main_dir/obj_$MODE $main_dir/obj - ln -sf $main_dir/mod_$MODE $main_dir/mod - - # clean up tmp - mkdir -p $temp_dir - cd $temp_dir - if [ "$source" != 'yes' ] - then - rm -f *.f *.F *.f90 *.F90 - fi - if [ "$list" != 'yes' ] - then - rm -f *.l - fi - - # clean up ftp - rm -f $main_dir/src/makefile - - # clean up exe - mkdir -p $main_dir/exe - - - # make progs - cd $main_dir/work_$MODE - ln -sfn switch.$MODE switch - switch_file=$main_dir/work_$MODE/switch.$MODE - export switch_file - # TODO: to not use w3_make - # need to integrate the make_makefile/netcdf check/esmf/exec_type - $main_dir/bin/w3_make $progs - - # save exe and tmp - cp $main_dir/bin/comp $main_dir/exe/comp_$MODE - cp $main_dir/bin/link $main_dir/exe/link_$MODE - mv ../exe/exec_type ../exe/exec_type_$MODE - mv switch.$MODE $main_dir/exe/ - rm -rf $main_dir/exe_$MODE - mv $main_dir/exe $main_dir/exe_$MODE - rm -rf ${temp_dir}_$MODE - mv $temp_dir ${temp_dir}_$MODE - - # add seq compilation of ww3_prnc if already compiled in par for TIDE - if [ "$MODE" == "MPI" ] && [ "$(ls $main_dir/exe_$MODE | grep "ww3_prnc")" == "ww3_prnc" ] && [ -n "$(grep TIDE $main_dir/exe_$MODE/switch.$MODE)" ] - then - mv $main_dir/exe_$MODE/ww3_prnc $main_dir/exe_$MODE/ww3_prnc.$MODE - fi - done - - - # sync exe and link tmp and switch - for MODE in $MODES - do - rsync -a $main_dir/exe_$MODE/ $main_dir/exe/ - rm -rf $main_dir/exe_$MODE - done - - -# --------------------------------------------------------------------------- # -# 4. End of program ID. # -# --------------------------------------------------------------------------- # - - echo ' ' - echo ' ' - echo ' *******************************' - echo ' *** End of program ***' - echo ' *******************************' - echo ' ' - -# end of script ------------------------------------------------------------- # diff --git a/model/bin/w3_clean b/model/bin/w3_clean deleted file mode 100755 index ef7d3f0b1..000000000 --- a/model/bin/w3_clean +++ /dev/null @@ -1,377 +0,0 @@ -#!/bin/bash -e -# --------------------------------------------------------------------------- # -# w3_clean : Clean-up the work, test and scratch directories by removing the # -# files generated by WAVEWATCH III and its compilation system. # -# # -# use : w3_clean [options] # -# -c: "clobber", also clean-up model & regtests directories # -# -m: also clean-up model directories # -# -r: also clean-up regtests directories # -# # -# Hendrik L. Tolman # -# Jan. 2014 # -# # -# Copyright 2009-2014 National Weather Service (NWS), # -# National Oceanic and Atmospheric Administration. All rights # -# reserved. WAVEWATCH III is a trademark of the NWS. # -# No unauthorized use without permission. # -# # -# --------------------------------------------------------------------------- # - -# --------------------------------------------------------------------------- # -# 0. Process command line arguments # -# --------------------------------------------------------------------------- # - -myname="`basename $0`" #name of script - -# 0.a Error message function - errmsg () - { - echo "" 2>&1 - while [ $# != 0 ] - do - echo "$myname: ERROR: $1" 2>&1 - shift - done - echo "" 2>&1 - } - -# 0.b Usage function - optstr="hcmr" #option string for getopt function - usage () - { -cat 2>&1 << EOF - -Usage: $myname [options] -Required: none -Options: - -c : "clobber", also clean-up model & regtests directories - -m : also clean-up model directories - -r : also clean-up regtests directories - -h : print usage and exit - -EOF - } - -# 0.c Setup array of command-line arguments - args=`getopt $optstr $*` - if [ $? != 0 ] - then - usage - exit 1 - fi - set -- $args - -# 0.d Process command-line options - while : - do - case "$1" in - -c) cleanup_model=1; cleanup_regtests=1 ;; - -h) help=1 ;; - -m) cleanup_model=1 ;; - -r) cleanup_regtests=1 ;; - --) break ;; - esac - shift - done - shift #remove the trailing -- - if [ $help ] - then - usage - exit 1 - fi - - -# --------------------------------------------------------------------------- # -# 1. Preparations # -# --------------------------------------------------------------------------- # - - -# 1.a ID header - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - echo ' ' - echo ' *****************************' - echo ' *** WAVEWATCH III clean ***' - echo ' *****************************' - echo ' ' - - - -# 1.b Read data from the environment file - - - - - - - - - - - - - - - - - - - - source $(dirname $0)/w3_setenv - # source again in case of updated wwatch3.env - source $(dirname $0)/w3_setenv - main_dir=$WWATCH3_DIR - temp_dir=$WWATCH3_TMP - source=$WWATCH3_SOURCE - list=$WWATCH3_LIST - -# --------------------------------------------------------------------------- # -# 2. Scratch directory # -# --------------------------------------------------------------------------- # - - if [ -d $temp_dir ] - then - cd $temp_dir - echo " Clean up $temp_dir" - rm -f core - rm -f core.* - rm -fr coredir.* - rm -f *.c - rm -f *.f - rm -f *.f90 - rm -f *.F90 - rm -f *.l - rm -f *.o - rm -f *.out - rm -f *.err - rm -f *.ps - rm -f *.eps - rm -f *.ww3 - rm -f *.mww3 - rm -f mod_def.* - rm -f out_pnt.* - rm -f out_grd.* - rm -f restart*.* - rm -f partition*.* - rm -f buoy_log*.* - rm -f log.* - rm -f test.* - rm -f test???.* - rm -f w3list - rm -f ww3.????????.* - rm -f xnl4v5* - rm -f quad* - rm -f prf.*.mww3 - rm -f plot.grads* - rm -f buoy.data - rm -f fort.* - rm -f times.* - rm -f *.grads - rm -f *.ctl - rm -f map.gs - rm -f ww3_mask.* - rm -rf ww3_gspl.temp - rm -f ww3.ww3_gspl - - set +e - files=`ls ww3_multi.* 2> /dev/null` - set -e - if [ -n "$files" ] - then - for file in $files - do - if [ "$file" != 'ww3_multi.inp' ] - then - rm -f $file - fi - done - fi - - # remove tmp folder if empty - cd $main_dir - if [ "$(ls -A $temp_dir 2> /dev/null)" = "" ] - then - rm -r $temp_dir - fi - fi - -# --------------------------------------------------------------------------- # -# 3. Work and test directories # -# --------------------------------------------------------------------------- # - - if [ -d $main_dir/work ] - then - echo " Clean up $main_dir/work" - for dir in $main_dir/work - do - cd $dir - rm -f core - rm -f core.* - rm -fr coredir.* - rm -f *.f - rm -f *.f90 - rm -f *.l - rm -f *.o - rm -f *.out - rm -f *.err - rm -f *.ps - rm -f *.eps - rm -f *.ww3 - rm -f *.mww3 - rm -f mod_def.* - rm -f out_pnt.* - rm -f out_grd.* - rm -f restart*.* - rm -f partition*.* - rm -f buoy_log*.* - rm -f log.* - rm -f test.* - rm -f test???.* - rm -f w3list - rm -f ww3.????????.* - rm -f xnl4v5* - rm -f quad* - rm -f prf.*.mww3 - rm -f plot.grads* - rm -f buoy.data - rm -f fort.* - rm -f times.* - rm -f *.grads - rm -f *.ctl - rm -f map.gs - rm -f ww3_mask.* - rm -rf ww3_gspl.temp - rm -f ww3.ww3_gspl - - set +e - files=`ls ww3_multi.* 2> /dev/null` - set -e - if [ -n "$files" ] - then - for file in $files - do - if [ "$file" != 'ww3_multi.inp' ] - then - rm -f $file - fi - done - fi - done - - # remove work folder if empty - cd $main_dir - if [ "$(ls -A $main_dir/work 2> /dev/null)" = "" ] - then - rm -r $main_dir/work - fi - fi - -# --------------------------------------------------------------------------- # -# 4. Model directories # -# --------------------------------------------------------------------------- # - - if [ -d $main_dir ] - then - if [ -e $main_dir/nuopc.mk ] - then - rm -f $main_dir/nuopc.mk - fi - # clean up bin - if [ -d $main_dir/bin ] - then - echo " Clean up $main_dir/bin" - cd $main_dir/bin - rm -f switch.old switch.HOLD switch.hold - for type in DIST SHRD OMP HYB MPI SEQ - do - rm -f switch.old_${type} switch.${type} - done - fi - # clean up ftn & tools - for folder in ftn tools - do - if [ -d $main_dir/$folder ] - then - echo " Clean up $main_dir/$folder" - rm -f $main_dir/$folder/makefile - for type in DIST SHRD OMP HYB MPI SEQ - do - rm -f $main_dir/$folder/makefile_${type} - done - fi - done - # clean up work & mod & obj & tmp - for folder in work mod obj tmp - do - if [ -d $main_dir/$folder ] || [ -L $main_dir/$folder ] - then - echo " Remove $main_dir/$folder" - rm -fr $main_dir/$folder - fi - for type in DIST SHRD OMP HYB MPI SEQ - do - if [ -d $main_dir/${folder}_${type} ] - then - echo " Remove $main_dir/${folder}_${type}" - rm -fr $main_dir/${folder}_${type} - fi - done - done - - else - echo " Directory does not exist: $main_dir" - fi - -# --------------------------------------------------------------------------- # -# 5. Setup settings # -# --------------------------------------------------------------------------- # - - if [ $cleanup_model ] - then - if [ -d $main_dir ] - then - if [ -d $main_dir/bin ] - then - echo " Clean up $main_dir/bin" - cd $main_dir/bin - rm -f w3adc w3list w3prnt w3split - rm -f comp link switch - fi - # clean up exe - for folder in exe - do - if [ -d $main_dir/$folder ] || [ -L $main_dir/$folder ] - then - echo " Remove $main_dir/$folder" - rm -fr $main_dir/$folder - fi - for type in DIST SHRD OMP HYB MPI SEQ - do - if [ -d $main_dir/${folder}_${type} ] - then - echo " Remove $main_dir/${folder}_${type}" - rm -fr $main_dir/${folder}_${type} - fi - done - done - - else - echo " Directory does not exist: $main_dir" - fi - fi - -# --------------------------------------------------------------------------- # -# 6. Regtests directories # -# --------------------------------------------------------------------------- # - - if [ $cleanup_regtests ] - then - if [ -d $main_dir ] - then - if [ -d $main_dir/../regtests ] - then - echo " Clean up $main_dir/../regtests" - cd $main_dir/../regtests - for work in $(find . -type d -name "work*") - do - echo " Remove $work" - rm -fr $work - done - if [ -d $main_dir/../regtests/ww3_tp2.14 ] - then - cd $main_dir/../regtests/ww3_tp2.14 - rm -f input/oasis3-mct/util/make_dir/cmplr - rm -f input/toy/toy_model - rm -f input/toy/*__*.f90 - rm -f input/toy/*__*.mod - rm -f input/toy/*.o - rm -f input/ww3_shel.inp - rm -f input/ww3_shel.nml - fi - fi - fi - fi - -# End of w3_clean ----------------------------------------------------------- # diff --git a/model/bin/w3_make b/model/bin/w3_make deleted file mode 100755 index aacc2f82c..000000000 --- a/model/bin/w3_make +++ /dev/null @@ -1,659 +0,0 @@ -#!/bin/bash -e -# --------------------------------------------------------------------------- # -# w3_make : Compile and link WAVEWATCH III programs using standard make and # -# makefile methods. # -# # -# use : w3_make [program [...]] # -# program: program name of WAVEWATCH III (sub)program. # -# # -# error codes : Program ends if error occurs in make_makefile.sh. # -# # -# programs used : # -# make_makefile.sh : Makes the makefile. # -# # -# programs called from the makefile : # -# ad3 : script to execute preprocessor and to compile. # -# link : linker script. # -# # -# Hendrik L. Tolman # -# May 2009 # -# March 2014 # -# # -# Copyright 2009-2013 National Weather Service (NWS), # -# National Oceanic and Atmospheric Administration. All rights # -# reserved. WAVEWATCH III is a trademark of the NWS. # -# No unauthorized use without permission. # -# # -# --------------------------------------------------------------------------- # - - -# --------------------------------------------------------------------------- # -# 1. Preparations # -# --------------------------------------------------------------------------- # - - -# 1.a ID header - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - echo ' ' - echo ' *****************************' - echo ' *** WAVEWATCH III make ***' - echo ' *****************************' - echo ' ' - - -# 1.b Input arguments - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if [ $# -eq 0 ] - then - default_mode=1 - all_programs="" - else - default_mode=0 - all_programs="$*" - fi - - -# 1.c Get data from setup file - - - - - - - - - - - - - - - - - - - - - - - - - - source $(dirname $0)/w3_setenv - main_dir=$WWATCH3_DIR - temp_dir=$WWATCH3_TMP - source=$WWATCH3_SOURCE - list=$WWATCH3_LIST - - echo "Main directory : $main_dir" - echo "Scratch directory : $temp_dir" - echo "Save source codes : $source" - echo "Save listings : $list" - -# 1.d Check / make directories - - - - - - - - - - - - - - - - - - - - - - - - - # bin dir - if [ ! -d $main_dir/bin ] - then - echo ' ' - echo "[ERROR] Directory $main_dir/bin not found" - echo ' Please check the content of your directory model' - exit 1 - fi - - # exe dir - if [ ! -d $main_dir/exe ] - then - mkdir -p $main_dir/exe - fi - - # switch file - if [ -z "$(env | grep switch_file)" ] - then - switch_file=$main_dir/bin/switch - fi - if [ ! -e $switch_file ] || [ ! -r $switch_file ] - then - echo ' ' - echo "[ERROR] switch file $switch_file not found" - echo " Please run $main_dir/bin/w3_setup -c -s " - exit 1 - fi - cp $switch_file $main_dir/exe/ - - # comp file - comp_file=$main_dir/bin/comp - if [ ! -e $comp_file ] || [ ! -r $comp_file ] - then - echo ' ' - echo "[ERROR] comp file $comp_file not found" - echo " Please run $main_dir/bin/w3_setup -c -s " - exit 1 - fi - - # link file - link_file=$main_dir/bin/link - if [ ! -e $link_file ] || [ ! -r $link_file ] - then - echo ' ' - echo "[ERROR] link file $comp_file not found" - echo " Please run $main_dir/bin/w3_setup -c -s " - exit 1 - fi - - # src dir - makefile=$main_dir/src/makefile - if [ ! -d $main_dir/src ] - then - echo ' ' - echo "[ERROR] Directory $main_dir/src not found" - echo ' Please check the content of your directory model' - exit 1 - fi - rm -f $makefile - -# 1.e Set regular and netCDF progs - - - - - - - - - - - - - - - - - - - - - - -# reg_programs = non-NetCDF programs -# cdf_programs = NetCDF programs - - #STRT BOUND OUTF OUTP TRCK GRIB GINT GX* UPRSTR - reg_programs="ww3_strt" - reg_programs="$reg_programs ww3_bound" - reg_programs="$reg_programs ww3_outf" - reg_programs="$reg_programs ww3_outp" - reg_programs="$reg_programs ww3_trck" - reg_programs="$reg_programs ww3_grib" - reg_programs="$reg_programs ww3_gint" - reg_programs="$reg_programs gx_outf" - reg_programs="$reg_programs gx_outp" - reg_programs="$reg_programs ww3_uprstr" - - # PRNC OUNF OUNP BOUNC TRNC - cdf_programs="ww3_prnc" - cdf_programs="$cdf_programs ww3_ounf" - cdf_programs="$cdf_programs ww3_ounp" - cdf_programs="$cdf_programs ww3_bounc" - cdf_programs="$cdf_programs ww3_trnc" - - # PRTIDE - if [ -n "`grep TIDE $switch_file`" ] - then - cdf_programs="$cdf_programs ww3_prtide" - fi - - # MULTI MULTI_ESMF SBS1 LIBWW3 - if [ -n "`grep SCRIPNC $switch_file`" ] || [ -n "`grep OASIS $switch_file`" ] || [ -n "`grep PDLIB $switch_file`" ] - then - cdf_programs="$cdf_programs ww3_grid" - cdf_programs="$cdf_programs ww3_multi" - cdf_programs="$cdf_programs ww3_sbs1" - cdf_programs="$cdf_programs libww3" - if [ $ESMFMKFILE ] - then - cdf_programs="$cdf_programs ww3_multi_esmf" - fi - else - reg_programs="$reg_programs ww3_grid" - reg_programs="$reg_programs ww3_multi" - reg_programs="$reg_programs ww3_sbs1" - reg_programs="$reg_programs libww3" - if [ $ESMFMKFILE ] - then - reg_programs="$reg_programs ww3_multi_esmf" - fi - fi - - # SYSTRK - if [ -n "`grep TRKNC $switch_file`" ] - then - cdf_programs="$cdf_programs ww3_systrk" - else - reg_programs="$reg_programs ww3_systrk" - fi - - # PREP GSPL - if [ -n "`grep OASIS $switch_file`" ] || [ -n "`grep PDLIB $switch_file`" ] - then - cdf_programs="$cdf_programs ww3_gspl" - cdf_programs="$cdf_programs ww3_prep" - else - reg_programs="$reg_programs ww3_gspl" - reg_programs="$reg_programs ww3_prep" - fi - - #SHEL - if [ -n "`grep OASIS $switch_file`" ] || [ -n "`grep PDLIB $switch_file`" ] - then - cdf_programs="$cdf_programs ww3_shel" - else - reg_programs="$reg_programs ww3_shel" - fi - - #Shared Object - if [ -n "`grep -nri fPIC $comp_file`" ] - then - reg_programs="$reg_programs libww3.so" - else - echo 'Shared Object : No' - fi - -# 1.f Set sequential or parallel folders - - - - - - - - - - - - - - - - - - - - - flag_SHRD=`grep SHRD $switch_file | wc -l | awk '{ print $1}'` - flag_OMPH=`grep OMPH $switch_file | wc -l | awk '{ print $1}'` - - switch_file_old=$main_dir/bin/switch.old - exec_type_file=$main_dir/exe/exec_type - - here=`pwd` - - - if [ "$flag_SHRD" -gt '0' ] - then - pres_type='SEQ' - flag_OMP=`grep OMP $switch_file | wc -l | awk '{ print $1}'` - if [ "$flag_OMP" -gt '0' ] - then - pres_type='OMP' - fi - else - if [ "$flag_OMPH" -gt '0' ] - then - pres_type='HYB' - else - pres_type='MPI' - fi - fi - - rm -rf $main_dir/obj - rm -rf $main_dir/mod - if [ -f ${switch_file_old}_$pres_type ] ; then - cp ${switch_file_old}_$pres_type $switch_file_old - fi - if [ -f ${makefile}_$pres_type ] ; then - cp ${makefile}_$pres_type $makefile - fi - cd $main_dir - mkdir -p obj_$pres_type mod_$pres_type - ln -sf obj_$pres_type obj - ln -sf mod_$pres_type mod - cd $here - - - -# 1.g Setup for NetCDF compile - - - - - - - - - - - - - - - - - - - - - - - - - -# 1.g.1 NetCDF compile message function - - netcdf_compile_message () { - - cat 2>&1 << 'EOF' - -*********************************************************************** -*** WAVEWATCH III NetCDF Compile Instructions *** -*********************************************************************** - -For compiling with NetCDF, the following environment variable -is required: - - NETCDF_CONFIG = - -The nc-config utility (part of the NetCDF-4 install) is used to -determine the appropriate compile and link flags. - -For NetCDF routines to compile, WAVEWATCH III requires -NetCDF version 4.1.1 or higher. Use "nc-config --version" to check -the version of the installed NetCDF. It is also required for NetCDF -to be compiled with the NetCDF-4 API enabled. Use "nc-config --has-nc4" -to check if the installed NetCDF has the NetCDF-4 API enabled. - -*********************************************************************** - -EOF - - } - -# 1.g.2 NetCDF check compile environment function - - netcdf_check_compile () { - - mode=$1 #must be ERROR or WARNING - - if [ -z "$NETCDF_CONFIG" ] - then - netcdf_compile_message - echo "$mode: NETCDF_CONFIG not defined"; echo ' ' - return 1 - fi - if [ ! -x "$NETCDF_CONFIG" ] - then - netcdf_compile_message - echo "$mode: $NETCDF_CONFIG does not exist or is not executable"; echo ' ' - return 1 - fi - netcdf_version=`$NETCDF_CONFIG --version | awk '{print $2}'` - if [ -z "`echo $netcdf_version | cut -d. -f3`" ] - then - netcdf_version="$netcdf_version.0" - fi - if [ `echo $netcdf_version | tr -d . | tr -d - | tr -d 'A-Z a-z'` -lt 411 ] - then - netcdf_compile_message - echo "$mode: NetCDF version $netcdf_version < 4.1.1"; echo ' ' - return 1 - fi - - return 0 - } - -# 1.g.3 Check for NetCDF compile - - if [ $default_mode -eq 1 ] - then - if ! netcdf_check_compile WARNING - then - echo "NetCDF enabled programs ($cdf_programs)" - echo "will not be compiled unless NetCDF compile environment is properly set."; echo ' ' - echo "Continuing with compile of non-NetCDF programs ..."; echo ' ' - all_programs="$reg_programs" - else - all_programs="$reg_programs $cdf_programs" - fi - else - nc_compile=0 - for prog in $cdf_programs - do - if [ -n "`echo $progs | grep $prog`" ] - then - nc_compile=1 - fi - done - if [ $nc_compile -eq 1 ] - then - if ! netcdf_check_compile ERROR - then - echo "NetCDF enabled programs ($cdf_programs)" - echo "will not be compiled unless NetCDF compile environment is properly set."; echo ' ' - echo "Now exiting ..."; echo ' ' - exit 1 - fi - fi - fi - - echo ' ' - echo "[INFO] list of the programs selected : $all_programs" - - -# 1.h set progs list - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # no filtering is done to distinguish sequential to parallel programs - progs=$all_programs - -# 1.i Prepare scratch directory - - - - - - - - - - - - - - - - - - - - - - - - - if test ! -d $temp_dir - then - if ! `mkdir -p $temp_dir` - then - echo ' ' ; echo " *** Cannot create $temp_dir ***" ; echo ' ' - exit 1 - fi - fi - - cd $temp_dir - if [ "$source" != 'yes' ] - then - rm -f *.f *.F *.f90 *.F90 - fi - if [ "$list" != 'yes' ] - then - rm -f *.l - fi - cd $main_dir/src - -# 1.j Prepare makefile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - make_make='y' - if test -f $switch_file_old - then - if test -f $main_dir/src/makefile && \ - test -z "`diff $switch_file $switch_file_old`" - then - make_make='n' - fi - fi - - if test "$make_make" = 'y' - then - echo 'Making makefile ...' - if $main_dir/bin/make_makefile.sh - then - if [ "$flag_SHRD" -gt '0' ] - then - if [ "$flag_OMP" -gt '0' ] - then - cp $switch_file ${switch_file_old}_OMP - cp $makefile ${makefile}_OMP - else - cp $switch_file ${switch_file_old}_SEQ - cp $makefile ${makefile}_SEQ - fi - else - if [ "$flag_OMPH" -gt '0' ] - then - cp $switch_file ${switch_file_old}_HYB - cp $makefile ${makefile}_HYB - else - cp $switch_file ${switch_file_old}_MPI - cp $makefile ${makefile}_MPI - fi - fi - else - exit 1 - fi - fi - echo ' ' - -# 1.k Export paths - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - aPb="$main_dir/bin" # path containing shell scripts - aPo="$main_dir/obj" # path containing .o files - aPm="$main_dir/mod" # path containing .mod files - aPe="$main_dir/exe" # path containing executables - - export aPb aPo aPm aPe - -# --------------------------------------------------------------------------- # -# 2. Run make for all requests # -# --------------------------------------------------------------------------- # -# 2.a Loop over all requests - - for prog in $progs - do - echo "Processing $prog" - echo "---------------------" - -# 2.b Check input - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - OK='n' - for check in $all_programs - do - if test "$prog" = "$check" - then - OK='y' - fi - done - if test "$OK" = 'n' - then - echo " *** Program name not recognized ***" - echo ' ' - exit 1 - -# 2.c Run make - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - else - - netcdf_compile=no - if [ -n "`echo $cdf_programs | grep $prog`" ] - then - netcdf_compile=yes - fi - export netcdf_compile - - mpi_mod=no - if [ -n "`grep MPI $switch_file`" ] - then - mpi_mod=yes - fi - export mpi_mod - - omp_mod=no - if [ -n "`grep OMP $switch_file`" ] - then - omp_mod=yes - fi - export omp_mod - - oasis_mod=no - if [ -n "`grep OASIS $switch_file`" ] - then - export oasis_mod='yes' - fi - export oasis_mod - - pdlib_mod=no - metis_mod=no - scotch_mod=no - - esmfpdlib='' - if [ -n "`grep PDLIB $switch_file`" ] - then - export pdlib_mod='yes' - if [ -n "`grep METIS $switch_file`" ] - then - export metis_mod='yes' - esmfpdlib="$METIS_PATH/lib/libparmetis.a $METIS_PATH/lib/libmetis.a" - fi - if [ -n "`grep SCOTCH $switch_file`" ] - then - export scotch_mod='yes' - esmfpdlib="$SCOTCH_PATH/lib/libptscotchparmetisv3.a $SCOTCH_PATH/lib/libptscotch.a \ - $SCOTCH_PATH/lib/libptscotcherr.a $SCOTCH_PATH/lib/libscotch.a" - fi - fi - export pdlib_mod - export metis_mod - export scotch_mod - - # NCEP GRIB - export ncep_grib_compile="no" - #check for switch file: - if [ -n "`grep NCEP $switch_file`" ] - then - #only set to yes if compiling ww3_grib: - if [ -n "`echo $prog | grep ww3_grib`" ] - then - export ncep_grib_compile="yes" - fi - fi - - # if esmf is included in program name, then the compile - # requires DIST switch and the ESMFMKFILE is - # processed to get required ESMF compile options - if [ -n "`echo $prog | grep esmf 2>/dev/null`" ] - then - if [ -z "`grep DIST $switch_file`" ] - then - echo ' ' - echo "*** DIST switch must be set when compiling with ESMF ***" - echo ' ' - exit 1 - fi - ESMF_F90COMPILEPATHS= - if [ $ESMFMKFILE ] - then - if [ ! -r $ESMFMKFILE ] - then - echo ' ' - echo "*** ESMFMKFILE does not exist or is not readable: $ESMFMKFILE ***" - echo ' ' - exit 1 - fi - ESMF_F90COMPILEPATHS=`cat $ESMFMKFILE | grep '^ *ESMF_F90COMPILEPATHS' | sed 's/^ *ESMF_F90COMPILEPATHS *=//g'` - else - echo ' ' - echo "*** ESMFMKFILE must be defined when compiling with ESMF ***" - echo ' ' - exit 1 - fi - fi - export ESMF_F90COMPILEPATHS - - # if esmf is included in program name, then - # the target is compile and create archive - if [ -n "`echo $prog | grep esmf 2>/dev/null`" ] - then - target="$prog" - # if program name is libww3, then - # the target is compile and create archive - elif [ "$prog" = "libww3" ] - then - target="$prog" - elif [ "$prog" = "libww3.so" ] - then - target="$prog" - else - target="$aPe/$prog" - fi - - if [ ! -f $exec_type_file ] ; then - touch $exec_type_file ; fi - - if [ `grep $prog $exec_type_file | wc -l | awk '{ print $1}'` != '0' ] - then - exec_type=`grep $prog $exec_type_file | tail -1 | awk '{ print $2}'` - fi - if [ "$exec_type" != "$pres_type" ] ; then - rm -f $main_dir/exe/$prog ; fi - - cp $exec_type_file tempfile - sed -n "/$prog/!p" tempfile > $exec_type_file - rm -f tempfile - - path_m=$main_dir/mod - export path_m - # WW3_PARCOMPN is an environment variable to set the parallel make tasks - # it defaults to 4 - if make -j ${WW3_PARCOMPN:-4} -f makefile $target - then - echo ' ' - else - exit 1 - fi - - echo "$prog $pres_type" >> $exec_type_file - - # if esmf is included in program name, then create $main_dir/nuopc.mk - if [ -n "`echo $prog | grep esmf 2>/dev/null`" ] - then - mkfile=$main_dir/nuopc.mk - if [ -n "`grep OMP $switch_file`" ] - then - mod_dir=$main_dir/mod_HYB - obj_dir=$main_dir/obj_HYB - else - mod_dir=$main_dir/mod_MPI - obj_dir=$main_dir/obj_MPI - fi - rm -f $mkfile - touch $mkfile - echo "#-----------------------------------------------" >> $mkfile - echo "# NUOPC/ESMF self-describing build dependency" >> $mkfile - echo "# makefile fragment for Wavewatch III" >> $mkfile - echo "#-----------------------------------------------" >> $mkfile - echo "# component module name" >> $mkfile - echo "ESMF_DEP_FRONT := WMESMFMD" >> $mkfile - echo "# component module path" >> $mkfile - echo "ESMF_DEP_INCPATH := $mod_dir" >> $mkfile - echo "# component module objects" >> $mkfile - echo "ESMF_DEP_CMPL_OBJS := $obj_dir/lib$prog.a(wmesmfmd.o)" >> $mkfile - echo "# component object/archive list" >> $mkfile - echo "ESMF_DEP_LINK_OBJS := $obj_dir/lib$prog.a $esmfpdlib" >> $mkfile - fi - - fi - - done - -# 2.d copy comp and link - - cp $main_dir/bin/comp $main_dir/exe/ - cp $main_dir/bin/link $main_dir/exe/ - -# --------------------------------------------------------------------------- # -# 3. End of program ID. # -# --------------------------------------------------------------------------- # - - echo ' ' - echo ' **********************' - echo ' *** end of compilation ***' - echo ' **********************' - echo ' ' - -# End of w3_make ------------------------------------------------------------ # diff --git a/model/bin/w3_new b/model/bin/w3_new deleted file mode 100755 index 89f89b29a..000000000 --- a/model/bin/w3_new +++ /dev/null @@ -1,439 +0,0 @@ -#!/bin/bash -e -# --------------------------------------------------------------------------- # -# w3_new : Touch and/or remove files to assure that make updates the # -# correct subroutines after the switches in switch have been # -# changed. # -# # -# use : w3_new keyword # -# # -# used by : w3_make # -# # -# keyword : all : redo entire compilation. # -# ... : see make_makefile.prog # -# # -# error codes : 1 : no environment file $ww3_env found. # -# # -# programs used : # -# # -# Hendrik L. Tolman # -# November 2013 # -# # -# Copyright 2009-2013 National Weather Service (NWS), # -# National Oceanic and Atmospheric Administration. All rights # -# reserved. WAVEWATCH III is a trademark of the NWS. # -# No unauthorized use without permission. # -# # -# --------------------------------------------------------------------------- # -# 0. Process command line arguments # -# --------------------------------------------------------------------------- # - - if test "$#" -lt '1' - then - keys='all' - else - keys="$*" - fi - -# --------------------------------------------------------------------------- # -# 1. Preparations # -# --------------------------------------------------------------------------- # - - -# 1.a ID header - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -# echo ' ' -# echo ' *****************************' -# echo ' *** WAVEWATCH III new ***' -# echo ' *****************************' -# echo ' ' - - -# 1.b Read data from the environment file - - - - - - - - - - - - - - - - - - - - source $(dirname $0)/w3_setenv - main_dir=$WWATCH3_DIR - temp_dir=$WWATCH3_TMP - list=$WWATCH3_LIST - - -# --------------------------------------------------------------------------- # -# 2. Process keywords. # -# --------------------------------------------------------------------------- # - - for key in $keys - do - case $key in - 'all' ) cd $main_dir ; rm -f obj_*/*.o - rm -f mod_*/*.mod - rm -f exe/ww3_* - rm -f exe/gx_* - rm -f exe/exec_type ;; - 'nco' ) cd $main_dir/src ; touch w3bullmd.F90 - touch ww3_prep.F90 - touch ww3_shel.F90 - touch ww3_ounp.F90 - touch ww3_prnc.F90 - touch ww3_outp.F90 - touch ww3_prtide.F90 - touch ww3_grib.F90 ;; - 'grib' ) cd $main_dir/src ; touch ww3_grib.F90 ;; - 'netcdf' ) cd $main_dir/src ; touch ww3_ounf.F90 - touch ww3_ounp.F90 - touch ww3_bounc.F90 - touch ww3_systrk.F90 - touch ww3_prnc.F90 - touch ww3_trnc.F90 ;; - 'scrip' ) cd $main_dir/src ; touch wmgridmd.F90 - touch wmscrpmd.F90 - touch w3gridmd.F90 - cd $main_dir/src/SCRIP ; touch scrip_interface.F90 ;; - 'scripnc') cd $main_dir/src ; touch wmgridmd.F90 - cd $main_dir/src/SCRIP ; touch scrip_interface.F90 ;; - 'trknc' ) cd $main_dir/src ; touch ww3_systrk.F90 ;; - 'shared' ) ;; - 'mpp' );; - 'mpiexp' ) cd $main_dir/src ; touch wmgridmd.F90 ;; - 'thread' ) cd $main_dir/src ; touch w3wavemd.F90 - touch w3canomd.F90 - touch w3fld1md.F90 - touch w3fld2md.F90 - touch w3iogomd.F90 - touch w3pro1md.F90 - touch w3pro2md.F90 - touch w3pro3md.F90 - touch w3psmcmd.F90 - touch w3srcemd.F90 - touch w3pro1md.F90 - touch w3pro2md.F90 - touch w3pro3md.F90 - touch w3updtmd.F90 - touch wmgridmd.F90 - touch w3uno2md.F90 - touch w3updtmd.F90 - touch w3uqckmd.F90 - touch w3iogomd.F90 - touch ww3_multi.F90 - touch ww3_shel.F90 ;; - 'GSE' ) cd $main_dir/src ; touch w3gdatmd.F90 - touch w3adatmd.F90 - touch w3idatmd.F90 - touch w3iogrmd.F90 - touch w3updtmd.F90 - touch w3wavemd.F90 - touch w3triamd.F90 - touch wmgridmd.F90 - touch ww3_gspl.F90 - touch ww3_shel.F90 - touch w3gridmd.F90 ;; - 'prop' ) cd $main_dir/src ; touch w3gdatmd.F90 - touch w3adatmd.F90 - touch w3idatmd.F90 - touch w3iogrmd.F90 - touch w3wavemd.F90 - touch w3pro2md.F90 - touch w3pro3md.F90 - touch wmgridmd.F90 - touch w3updtmd.F90 - touch ww3_shel.F90 - touch w3gridmd.F90 - touch ww3_gspl.F90 ;; - 'stress' ) cd $main_dir/src ; touch w3srcemd.F90 - touch w3gdatmd.F90 - touch w3iogrmd.F90 - touch ww3_outp.F90 - touch ww3_ounp.F90 - touch w3gridmd.F90 - touch gx_outp.F90 ;; - 'dstress') cd $main_dir/src ; touch w3srcemd.F90 - touch w3gdatmd.F90 - touch w3iogrmd.F90 - touch w3fld1md.F90 - touch w3fld2md.F90 - touch w3gridmd.F90 ;; - 's_ln' ) cd $main_dir/src ; touch w3gdatmd.F90 - touch w3srcemd.F90 - touch w3iogrmd.F90 - touch w3iorsmd.F90 - touch w3adatmd.F90 - touch w3iogrmd.F90 - touch wminitmd.F90 - touch w3gridmd.F90 - touch ww3_outp.F90 - touch ww3_ounp.F90 - touch ww3_prep.F90 - touch ww3_prnc.F90 - touch ww3_prtide.F90 - touch ww3_strt.F90 - touch gx_outp.F90 ;; - 'sterm' ) cd $main_dir/src ; touch w3gdatmd.F90 - touch w3srcemd.F90 - touch w3flx1md.F90 - touch w3flx2md.F90 - touch w3flx3md.F90 - touch w3updtmd.F90 - touch w3iogrmd.F90 - touch w3iogomd.F90 - touch w3updtmd.F90 - touch wmesmfmd.F90 - touch w3gridmd.F90 - touch ww3_outp.F90 - touch ww3_ounp.F90 - touch ww3_ounf.F90 - touch gx_outp.F90 ;; - 'stab' ) cd $main_dir/src ; touch w3updtmd.F90 - touch w3src3md.F90 - touch w3src4md.F90 - touch w3gridmd.F90 - touch ww3_outp.F90 - touch ww3_ounp.F90 - touch gx_outp.F90 ;; - 's_nl' ) cd $main_dir/src ; touch w3gdatmd.F90 - touch w3adatmd.F90 - touch w3srcemd.F90 - touch w3iogrmd.F90 - touch wminitmd.F90 - touch w3gridmd.F90 - touch ww3_prep.F90 - touch ww3_outp.F90 - touch ww3_ounp.F90 - touch ww3_prnc.F90 - touch ww3_strt.F90 - touch ww3_prtide.F90 - touch gx_outp.F90 ;; - 'snls' ) cd $main_dir/src ; touch w3gdatmd.F90 - touch w3srcemd.F90 - touch w3iogrmd.F90 - touch w3gridmd.F90 - touch ww3_outp.F90 - touch gx_outp.F90 ;; - 's_bot' ) cd $main_dir/src ; touch w3gdatmd.F90 - touch w3odatmd.F90 - touch w3srcemd.F90 - touch w3iogrmd.F90 - touch w3iogomd.F90 - touch w3profsmd_pdlib.F90 - touch w3sic4md.F90 - touch w3wavemd.F90 - touch w3gridmd.F90 - touch ww3_gint.F90 - touch ww3_outp.F90 - touch ww3_outf.F90 - touch ww3_ounp.F90 - touch ww3_ounf.F90 - touch ww3_shel.F90 - touch gx_outp.F90 ;; - 's_db' ) cd $main_dir/src ; touch w3gdatmd.F90 - touch w3srcemd.F90 - touch w3iogrmd.F90 - touch w3profsmd_pdlib.F90 - touch w3gridmd.F90 - touch ww3_outp.F90 - touch ww3_ounp.F90 - touch gx_outp.F90 ;; - 'miche' ) cd $main_dir/src ; touch w3gdatmd.F90 - touch w3srcemd.F90 - touch w3gridmd.F90 ;; - 's_tr' ) cd $main_dir/src ; touch w3gdatmd.F90 - touch w3srcemd.F90 - touch w3iogrmd.F90 - touch w3profsmd_pdlib.F90 - touch w3gridmd.F90 - touch ww3_outp.F90 - touch ww3_ounp.F90 - touch gx_outp.F90 ;; - 's_bs' ) cd $main_dir/src ; touch w3gdatmd.F90 - touch w3srcemd.F90 - touch w3iogrmd.F90 - touch w3profsmd_pdlib.F90 - touch w3gridmd.F90 - touch ww3_outp.F90 - touch ww3_ounp.F90 - touch gx_outp.F90 ;; - 's_ice' ) cd $main_dir/src ; touch w3iogrmd.F90 - touch w3gdatmd.F90 - touch w3adatmd.F90 - touch w3profsmd_pdlib.F90 - touch w3updtmd.F90 - touch w3wavemd.F90 - touch w3srcemd.F90 - touch w3gridmd.F90 - touch ww3_outp.F90 - touch ww3_ounp.F90 - touch ww3_shel.F90 - touch gx_outp.F90 ;; - 's_is' ) cd $main_dir/src ; touch w3srcemd.F90 - touch w3iogrmd.F90 - touch w3gdatmd.F90 - touch w3iogomd.F90 - touch w3odatmd.F90 - touch w3sic2md.F90 - touch w3wavemd.F90 - touch ww3_gint.F90 - touch w3gridmd.F90 - touch ww3_ounf.F90 - touch ww3_outf.F90 - touch ww3_shel.F90 - touch ww3_outp.F90 - touch ww3_ounp.F90 - touch gx_outf.F90 - touch gx_outp.F90 ;; -'reflection' )cd $main_dir/src ; touch w3gdatmd.F90 - touch w3iogrmd.F90 - touch w3iorsmd.F90 - touch w3profsmd.F90 - touch w3profsmd_pdlib.F90 - touch w3srcemd.F90 - touch w3triamd.F90 - touch w3updtmd.F90 - touch w3wavemd.F90 - touch w3gridmd.F90 ;; - 'wind' ) cd $main_dir/src ; touch w3updtmd.F90 - touch ww3_prnc.F90 - touch ww3_prep.F90 ;; - 'windx' ) cd $main_dir/src ; touch wmupdtmd.F90 ;; - 'rwind' ) cd $main_dir/src ; touch w3updtmd.F90 - touch w3gdatmd.F90 - touch w3iogrmd.F90 - touch w3gridmd.F90 ;; - 'wcor' ) cd $main_dir/src ; touch w3updtmd.F90 - touch w3gdatmd.F90 - touch w3iogrmd.F90 - touch w3gridmd.F90 ;; - 'rstwind') cd $main_dir/src ; touch wmesmfmd.F90 - touch w3idatmd.F90 - touch w3iorsmd.F90 ;; - 'curr' ) cd $main_dir/src ; touch w3updtmd.F90 - touch ww3_prnc.F90 - touch ww3_prep.F90 ;; - 'currx' ) cd $main_dir/src ; touch wmupdtmd.F90 ;; - 'mgwind' ) cd $main_dir/src ; touch w3updtmd.F90 - touch wminitmd.F90 - touch ww3_shel.F90 ;; - 'mgprop' ) cd $main_dir/src ; touch w3pro1md.F90 - touch w3pro2md.F90 - touch w3pro3md.F90 - touch w3profsmd.F90 - touch w3profsmd_pdlib.F90 - touch w3psmcmd.F90 - touch wminitmd.F90 - touch ww3_shel.F90 ;; - 'mggse' ) cd $main_dir/src ; touch w3pro3md.F90 - touch w3gridmd.F90 - touch ww3_shel.F90 ;; - 'subsec' ) cd $main_dir/src ; touch w3gdatmd.F90 - touch w3iogrmd.F90 - touch w3wavemd.F90 - touch w3gridmd.F90 ;; - 'tdyn' ) cd $main_dir/src ; touch w3pro2md.F90 - touch w3psmcmd.F90 ;; - 'dss0' ) cd $main_dir/src ; touch w3pro2md.F90 - touch w3psmcmd.F90 ;; - 'pdif' ) cd $main_dir/src ; touch w3pro2md.F90 - touch w3psmcmd.F90 ;; - 'tide' ) cd $main_dir/src ; touch w3updtmd.F90 - touch w3idatmd.F90 - touch w3fldsmd.F90 - touch ww3_prnc.F90 - touch ww3_shel.F90 ;; - 'refrx' ) cd $main_dir/src ; touch w3wavemd.F90 - touch w3parall.F90 - touch w3pro1md.F90 - touch w3pro2md.F90 - touch w3pro3md.F90 ;; - 'ig' ) cd $main_dir/src ; touch w3gdatmd.F90 - touch w3iogomd.F90 - touch w3iogrmd.F90 - touch w3ref1md.F90 - touch w3src4md.F90 - touch w3srcemd.F90 - touch w3gridmd.F90 - touch ww3_ounp.F90 - touch ww3_outp.F90 ;; - 'rotag' ) cd $main_dir/src ; touch w3gdatmd.F90 - touch w3iobcmd.F90 - touch w3iogomd.F90 - touch w3iogrmd.F90 - touch w3iopomd.F90 - touch w3updtmd.F90 - touch ww3_grib.F90 - touch ww3_ounf.F90 - touch ww3_ounp.F90 - touch ww3_outf.F90 - touch w3gridmd.F90 ;; - 'nnt' ) cd $main_dir/src ; touch w3srcemd.F90 ;; - 'mprf' ) cd $main_dir/src ; touch wmmdatmd.F90 - touch wminitmd.F90 - touch wmwavemd.F90 - touch wmfinlmd.F90 ;; - 'cou' ) cd $main_dir/src ; touch w3iogomd.F90 - touch w3nmlmultimd.F90 - touch w3nmlshelmd.F90 - touch w3wavemd.F90 - touch wminitmd.F90 - touch ww3_shel.F90 ;; - 'oasis' ) cd $main_dir/src ; touch w3oacpmd.F90 - touch w3fldsmd.F90 - touch w3wavemd.F90 - touch w3wdatmd.F90 - touch ww3_shel.F90 ;; - 'agcm' ) cd $main_dir/src ; touch w3agcmmd.F90 - touch w3fldsmd.F90 - touch w3iogomd.F90 - touch w3oacpmd.F90 - touch w3wavemd.F90 - touch ww3_shel.F90 ;; - 'ogcm' ) cd $main_dir/src ; touch w3ogcmmd.F90 - touch w3fldsmd.F90 - touch w3iogomd.F90 - touch w3oacpmd.F90 - touch w3updtmd.F90 - touch w3wavemd.F90 - touch ww3_shel.F90 ;; - 'igcm' ) cd $main_dir/src ; touch w3igcmmd.F90 - touch w3fldsmd.F90 - touch w3oacpmd.F90 - touch w3wavemd.F90 - touch ww3_shel.F90 ;; - 'setup' ) cd $main_dir/src ; touch w3initmd.F90 - touch w3iogomd.F90 - touch w3iopomd.F90 - touch w3odatmd.F90 - touch w3updtmd.F90 - touch w3wavemd.F90 - touch w3wdatmd.F90 - touch ww3_ounf.F90 - touch ww3_ounp.F90;; - 'pdlib' ) cd $main_dir/src ; touch w3adatmd.F90 - touch w3gdatmd.F90 - touch w3initmd.F90 - touch w3iorsmd.F90 - touch w3parall.F90 - touch w3srcemd.F90 - touch w3triamd.F90 - touch w3wavemd.F90 - touch w3wdatmd.F90 - touch wminiomd.F90 - touch wmmdatmd.F90 - touch ww3_shel.F90 ;; - 'memck' ) cd $main_dir/src ; touch w3adatmd.F90 - touch w3gdatmd.F90 - touch w3initmd.F90 - touch w3iogrmd.F90 - touch w3profsmd_pdlib.F90 - touch w3wavemd.F90 - touch ww3_shel.F90 ;; - 'uost' ) cd $main_dir/src ; touch w3gdatmd.F90 - touch w3initmd.F90 - touch w3iogrmd.F90 - touch w3srcemd.F90 - touch w3wavemd.F90 - touch ww3_grid.F90 ;; - 'smcg' ) cd $main_dir/src ; touch w3psmcmd.F90 - touch w3smcomd.F90 ;; - 'b4b' ) cd $main_dir/src ; touch w3psmcmd.F90 ;; - * ) echo "w3_new: keyword [$key] not recognized" ;; - esac - done - - -# End of w3_new ------------------------------------------------------------- # diff --git a/model/bin/w3_setenv b/model/bin/w3_setenv deleted file mode 100755 index 7e13e1609..000000000 --- a/model/bin/w3_setenv +++ /dev/null @@ -1,222 +0,0 @@ -#!/bin/bash -e -# --------------------------------------------------------------------------- # -# w3_setenv : Set wwatch3 env and verify the consistency of the paths used # -# # -# use : w3_setenv [options] # -# -q: "quiet", do not ask for updating the WWATCH3 path # -# # -# programs used : # -# w3_clean # -# w3_setup # -# w3_make # -# w3_new # -# w3_source # -# w3_automake # -# make_MPI # -# make_OMP # -# make_HYB # -# link.* # -# list # -# ln3 # -# ad3 # -# all_switches # -# sort_all_switches # -# find_switch # -# sort_switch # -# make_makefile.sh # -# ww3_gspl.sh # -# matrix_datarmor # -# # -# # -# M. Accensi # -# March 2018 # -# # -# Copyright 2009-2018 National Weather Service (NWS), # -# National Oceanic and Atmospheric Administration. All rights # -# reserved. WAVEWATCH III is a trademark of the NWS. # -# No unauthorized use without permission. # -# # -# --------------------------------------------------------------------------- # - -# --------------------------------------------------------------------------- # -# 0. Process command line arguments # -# --------------------------------------------------------------------------- # - -myname="`basename $0`" #name of script - -# 0.a Error message function - errmsg () - { - echo "" 2>&1 - while [ $# != 0 ] - do - echo "$myname: ERROR: $1" 2>&1 - shift - done - echo "" 2>&1 - } - -# 0.b Usage function - optstr="q" #option string for getopt function - usage () - { -cat 2>&1 << EOF - -Usage: $myname [options] -Required: none -Options: - -q : "quiet", do not ask for updating the WWATCH3 path - -EOF - } - -# 0.c Setup array of command-line arguments - args=`getopt $optstr $*` - if [ $? != 0 ] - then - usage - exit 1 - fi - set -- $args - -# 0.d Process command-line options - while : - do - case "$1" in - -q) quiet=1 ;; - --) break ;; - esac - shift - done - shift #remove the trailing -- - if [ $help ] - then - usage - exit 1 - fi - - -# --------------------------------------------------------------------------- # -# 1. Preparations # -# --------------------------------------------------------------------------- # - -# 1.a Input arguments - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - path_bin="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -# 1.b Set wwatch3.env - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - info=0 - if [ -e $path_bin/wwatch3.env ] - then - ww3_env=$path_bin/wwatch3.env - if [ $info = 1 ];then echo "[INFO] local env file wwatch3.env found in $ww3_env" ;fi - elif [ -e ${HOME}/.wwatch3.env ] - then - cp ${HOME}/.wwatch3.env $path_bin/wwatch3.env - ww3_env=$path_bin/wwatch3.env - if [ $info = 1 ];then echo "[INFO] global env file wwatch3.env copied in $ww3_env" ;fi - elif [ ${WWATCH3_ENV} ] - then - if [ -e ${WWATCH3_ENV} ] - then - ww3_env=${WWATCH3_ENV} - if [ $info = 1 ];then echo "[INFO] user defined env file wwatch3.env found in $ww3_env" ;fi - else - echo "[ERROR] WWATCH3_ENV variable define a non existing wwatch3.env file" - echo " Please unset or update this env variable" - exit 1 - fi - else - echo "[ERROR] no env file wwatch3.env found." - echo " Please run $path_bin/w3_setup -c -s " - exit 1 - fi - -# 1.c Get data from setup file - - - - - - - - - - - - - - - - - - - - - - - - - - set `grep WWATCH3_DIR $ww3_env` ; shift - main_dir="$*" - export WWATCH3_DIR=$main_dir - set `grep WWATCH3_TMP $ww3_env` ; shift - temp_dir="$*" - export WWATCH3_TMP=$temp_dir - set `grep WWATCH3_SOURCE $ww3_env` ; shift - source="$*" - export WWATCH3_SOURCE=$source - set `grep WWATCH3_LIST $ww3_env` ; shift - list="$*" - export WWATCH3_LIST=$list - - path_mod="$(cd $(dirname $path_bin) 1>/dev/null 2>&1 && pwd)" - - if [ ! $quiet ] - then - if [ -z "$(echo $path_mod | grep $main_dir)" ] - then - echo "" - echo "[WARNING] WWATCH3_DIR does not match current path" - echo " CURRENT DIR = $path_mod" - echo " WWATCH3_DIR = $main_dir" - echo "" - echo "Update WWATCH3_DIR [u] or keep [k] or exit [e] ?" - read OK - case $OK in - 'u'|'U') do_set='y' ;; - 'k'|'K') do_set='n' ;; - 'e'|'E') exit ;; - esac - if [ "$do_set" = 'y' ] - then - $path_bin/w3_setup -t "$path_mod/tmp" $path_mod - temp_dir=$path_mod/tmp - main_dir=$path_mod - fi - fi - - if [ -z "$(echo $temp_dir | grep $main_dir)" ] - then - echo "" - echo "[WARNING] WWATCH3_TMP does not match WWATCH3_DIR" - echo " WWATCH3_TMP = $temp_dir" - echo " WWATCH3_DIR = $main_dir" - echo "" - echo "Update WWATCH3_DIR [u] or keep [k] or exit [e] ?" - read OK - case $OK in - 'u'|'U') do_set='y' ;; - 'k'|'K') do_set='n' ;; - 'e'|'E') exit ;; - esac - if [ "$do_set" = 'y' ] - then - $path_bin/w3_setup -t "$path_mod/tmp" $path_mod - temp_dir=$path_mod/tmp - main_dir=$path_mod - fi - fi - fi - - # main dir - if [ ! -d $main_dir ] - then - echo ' ' - echo "[ERROR] Directory $main_dir not found" - echo " Please run $path_bin/w3_setup -c -s " - exit 1 - fi - - # tmp dir - if [ ! -d $temp_dir ] - then - mkdir -p $temp_dir - fi - - if [ -z ${WWATCH3_ENV} ] - then - # env file - echo " Exporting WWATCH3_ENV=$path_bin/wwatch3.env" - export WWATCH3_ENV=$path_bin/wwatch3.env - fi - -# End of w3_setenv ----------------------------------------------------------- # diff --git a/model/bin/w3_setup b/model/bin/w3_setup deleted file mode 100755 index 790c9c23a..000000000 --- a/model/bin/w3_setup +++ /dev/null @@ -1,470 +0,0 @@ -#!/bin/bash -e -# --------------------------------------------------------------------------- # -# # -# Script for setting up (installing) WAVEWATCH III. # -# # -# --------------------------------------------------------------------------- # - -# --------------------------------------------------------------------------- # -# 0. Process command line arguments # -# --------------------------------------------------------------------------- # - -# 0.a Error message function -errmsg () -{ - echo "" 2>&1 - while [ $# != 0 ] - do - echo "ERROR: $1" 2>&1 - shift - done - echo "" 2>&1 -} - -# 0.b Usage function -myname="`basename $0`" #name of script -optstr="c:hqs:et:" #option string for getopt function -usage () -{ -cat 2>&1 << EOF - -Usage: $myname source_dir Options -Required: - source_dir : path to model dir of WW3 source -Options: - -c cmplr : setup comp & link files for specified cmplr (see manual section 5.6) - -s swtch : setup switch file for specified swtch (see manual section 5.8) - -h : print usage and exit - -q : do not prompt for changes to existing WW3 environment - -e : edit switch file - -t tdir : set path for scratch directory to tdir - -EOF -} - -# 0.c Setup array of command-line arguments -args=`getopt $optstr $*` -if [ $? != 0 ] -then - usage - exit 1 -fi -set -- $args - -# 0.d Process command-line options -while : -do - case "$1" in - -c) shift; cmplr="$1" ;; - -h) help=1 ;; - -q) no_prompt=1 ;; - -s) shift; swtch="$1" ;; - -e) edit=1 ;; - -t) shift; tdir="$1" ;; - --) break ;; - esac - shift -done -shift #remove the trailing -- -if [ $help ] -then - usage - exit 1 -fi - -# 0.e Get required arguments -if [ ! $# = 0 ] -then - path_s="$1" ; shift -else - usage - exit 1 -fi - - -# --------------------------------------------------------------------------- # -# 1. Preparations # -# --------------------------------------------------------------------------- # - - -# 1.a ID header - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - echo ' ' - echo ' *****************************' - echo ' *** WAVEWATCH III setup ***' - echo ' *****************************' - echo ' ' - - -# 1.b Convert source path from "relative" to "absolute" -if [ ! -d $path_s ] -then - errmsg "$path_s not found" - usage - exit 1 -fi -path_s="`cd $path_s 1>/dev/null 2>&1 && pwd`" - -# 1.c Paths to source subdirectories -path_b="$path_s/bin" -if [ ! -d $path_b ] -then - errmsg "$path_b not found" - exit 1 -fi -path_a="$path_s/tools" -if [ ! -d $path_a ] -then - errmsg "$path_a not found" - exit 1 -fi - - -# --------------------------------------------------------------------------- # -# 2. Set up WWATCH3 environment # -# --------------------------------------------------------------------------- # -# 2.a Environment file - -if [[ "$0" = /* ]] -then - path_bin=$(dirname $0) -else - path_bin="${PWD}/$(dirname $0)" -fi -path_bin="`cd $path_bin 1>/dev/null 2>&1 && pwd`" - -echo ' ' -if [ -e $path_bin/wwatch3.env ] -then - ww3_env=$path_bin/wwatch3.env - echo "[INFO] local env file wwatch3.env found in $ww3_env" -elif [ -e ${HOME}/.wwatch3.env ] -then - cp ${HOME}/.wwatch3.env $path_bin/wwatch3.env - ww3_env=$path_bin/wwatch3.env - echo "[INFO] global env file wwatch3.env copied in $ww3_env" -elif [ ! -z ${WWATCH3_ENV} ] -then - ww3_env=${WWATCH3_ENV} - echo "[INFO] user defined env file wwatch3.env found in $ww3_env" -else - ww3_env=$path_bin/wwatch3.env - echo "[INFO] local env file wwatch3.env created in $ww3_env" -fi - -# 2.b Check for existing environment and set defaults -if [ -f $ww3_env ] -then - echo " Setup file $ww3_env found" - - echo " Source directory : $path_s" - - set `grep WWATCH3_TMP $ww3_env` ; shift - if [ $tdir ] - then - temp_dir=$tdir - else - temp_dir="$*" - fi - echo " Scratch directory : $temp_dir" - - set `grep WWATCH3_SOURCE $ww3_env` ; shift - source="$*" - echo " Save source code : $source" - - set `grep WWATCH3_LIST $ww3_env` ; shift - list="$*" - echo " Save listings : $list" - -else - echo " Setup file $ww3_env not found" - - if [ $tdir ] - then - temp_dir=$tdir - else - temp_dir=$(dirname $path_bin)/tmp - fi - source=yes - list=yes - - echo ' ' - echo " Default set up :" - echo " Scratch directory : $temp_dir" - echo " Save sources : $source" - echo " Save listings : $list" -fi - - -if [ $no_prompt ] -then - do_set='n' -else - OK="$NULL" - until [ "$OK" = 'y' ] || [ "$OK" = 'Y' ] || \ - [ "$OK" = 'n' ] || [ "$OK" = 'N' ] - do - echo -n " Update settings ? [y/n] " - read OK - case $OK in - 'y'|'Y') do_set='y' ;; - 'n'|'N') do_set='n' ;; - esac - done -fi - - - -# 2.c Get user input for new environment -if [ "$do_set" = 'y' ] -then - - # Get user input for new set-up - echo ' ' - echo " Creating new set-up :" - OK="$NULL" - until [ "$OK" = 'y' ] || [ "$OK" = 'Y' ] - do - echo ' ' - - OK="$NULL" - until [ "$OK" = 'y' ] - do - echo -n " Scratch space [$temp_dir] : " - instr="$NULL" ; read instr - if [ -n "$instr" ] - then - temp_dir="$instr" - fi - if [ -n "$temp_dir" ] - then - if [ -d $temp_dir ] - then - OK='y' - else - if `mkdir $temp_dir` 2> /dev/null - then - OK='y' - fi - rmdir $temp_dir - fi - fi - done - - echo -n " Save source code files (*.f) [$source] : " - instr="$NULL" ; read instr - if [ -n "$instr" ] - then - if [ "$instr" = 'yes' ] || [ "$instr" = 'YES' ] - then - source='yes' - else - source='no' - fi - fi - - echo -n " Save listing files [$list] : " - instr="$NULL" ; read instr - if [ -n "$instr" ] - then - if [ "$instr" = 'yes' ] || [ "$instr" = 'YES' ] - then - list='yes' - else - list='no' - fi - fi - - echo ' ' - echo " Modified set up :" - echo " Scratch directory : $temp_dir" - echo " Save sources : $source" - echo " Save listings : $list" - echo -n " New settings OK ? [y/n] " - read OK - done - -fi - -# 2.d Create new environment file -rm -f $ww3_env -echo '#' > $ww3_env -echo '# Environment variables for wavewatch III' >> $ww3_env -echo '# ---------------------------------------' >> $ww3_env -echo '#' >> $ww3_env -echo ' ' >> $ww3_env -echo "WWATCH3_DIR $path_s" >> $ww3_env -echo "WWATCH3_TMP $temp_dir" >> $ww3_env -echo "WWATCH3_SOURCE $source" >> $ww3_env -echo "WWATCH3_LIST $list" >> $ww3_env -echo ' ' >> $ww3_env - -# --------------------------------------------------------------------------- # -# 3. Set up other WWATCH3 files # -# --------------------------------------------------------------------------- # - -# 3.c Setup comp & link files -if [ $cmplr ] -then - echo ' ' - echo ' Setup comp & link files' - if [ -f $path_b/comp.$cmplr ] - then - rm -f $path_b/comp - cp -f $path_b/comp.$cmplr $path_b/comp - echo " copy $path_b/comp.$cmplr => $path_b/comp" - elif [ "$cmplr" == "mpt" ] || [ "$cmplr" == "mpt_debug" ] || \ - [ "$cmplr" == "datarmor_mpt" ] || [ "$cmplr" == "datarmor_mpt_debug" ] || \ - [ "$cmplr" == "intel" ] || [ "$cmplr" == "intel_debug" ] || \ - [ "$cmplr" == "so_intel" ] || [ "$cmplr" == "so_intel_debug" ] || \ - [ "$cmplr" == "datarmor_intel" ] || [ "$cmplr" == "datarmor_intel_debug" ] || \ - [ "$cmplr" == "gnu" ] || [ "$cmplr" == "gnu_debug" ] || \ - [ "$cmplr" == "hera.intel" ] || [ "$cmplr" == "orion.intel" ] || \ - [ "$cmplr" == "hera.gnu" ] || [ "$cmplr" == "jet.intel" ] || \ - [ "$cmplr" == "stampede.intel" ] || [ "$cmplr" == "gaea.intel" ] || \ - [ "$cmplr" == "wcoss2" ] || [ "$cmplr" == "s4.intel" ] || \ - [ "$cmplr" == "expanse.intel" ] || \ - [ "$cmplr" == "cheyenne.intel" ] || [ "$cmplr" == "cheyenne.gnu" ] || \ - [ "$cmplr" == "wcoss_cray" ] || [ "$cmplr" == "wcoss_dell_p3" ] || \ - [ "$cmplr" == "datarmor_gnu" ] || [ "$cmplr" == "datarmor_gnu_debug" ] || \ - [ "$cmplr" == "pgi" ] || [ "$cmplr" == "pgi_debug" ] || \ - [ "$cmplr" == "datarmor_pgi" ] || [ "$cmplr" == "datarmor_pgi_debug" ] || \ - [ "$cmplr" == "ukmo_cray" ] || [ "$cmplr" == "ukmo_cray_debug" ] || \ - [ "$cmplr" == "ukmo_cray_gnu" ] || [ "$cmplr" == "ukmo_cray_gnu_debug" ] || \ - [ "$cmplr" == "ukmo_cray_intel" ] || [ "$cmplr" == "ukmo_cray_intel_debug" ]; then - source $path_b/cmplr.env - sed -e "s//$optc/" -e "s//$comp_seq/" -e "s//$comp_mpi/" -e "s//$optomp/" -e "s//$err_pattern/" -e "s//$warn_pattern/" $path_b/comp.tmpl > $path_b/comp - echo " sed $path_b/comp.tmpl => $path_b/comp" - else - errmsg "$path_b/comp.$cmplr not found" - exit 1 - fi - if [ -f $path_b/link.$cmplr ] - then - rm -f $path_b/link - cp -f $path_b/link.$cmplr $path_b/link - echo " copy $path_b/link.$cmplr => $path_b/link" - elif [ "$cmplr" == "mpt" ] || [ "$cmplr" == "mpt_debug" ] || \ - [ "$cmplr" == "datarmor_mpt" ] || [ "$cmplr" == "datarmor_mpt_debug" ] || \ - [ "$cmplr" == "intel" ] || [ "$cmplr" == "intel_debug" ] || \ - [ "$cmplr" == "so_intel" ] || [ "$cmplr" == "so_intel_debug" ] || \ - [ "$cmplr" == "datarmor_intel" ] || [ "$cmplr" == "datarmor_intel_debug" ] || \ - [ "$cmplr" == "gnu" ] || [ "$cmplr" == "gnu_debug" ] || \ - [ "$cmplr" == "hera.intel" ] || [ "$cmplr" == "orion.intel" ] || \ - [ "$cmplr" == "hera.gnu" ] || [ "$cmplr" == "jet.intel" ] || \ - [ "$cmplr" == "stampede.intel" ] || [ "$cmplr" == "gaea.intel" ] || \ - [ "$cmplr" == "wcoss2" ] || [ "$cmplr" == "s4.intel" ] || \ - [ "$cmplr" == "expanse.intel" ] || \ - [ "$cmplr" == "cheyenne.intel" ] || [ "$cmplr" == "cheyenne.gnu" ] || \ - [ "$cmplr" == "wcoss_cray" ] || [ "$cmplr" == "wcoss_dell_p3" ] || \ - [ "$cmplr" == "datarmor_gnu" ] || [ "$cmplr" == "datarmor_gnu_debug" ] || \ - [ "$cmplr" == "pgi" ] || [ "$cmplr" == "pgi_debug" ] || \ - [ "$cmplr" == "datarmor_pgi" ] || [ "$cmplr" == "datarmor_pgi_debug" ] || \ - [ "$cmplr" == "ukmo_cray" ] || [ "$cmplr" == "ukmo_cray_debug" ] || \ - [ "$cmplr" == "ukmo_cray_gnu" ] || [ "$cmplr" == "ukmo_cray_gnu_debug" ] || \ - [ "$cmplr" == "ukmo_cray_intel" ] || [ "$cmplr" == "ukmo_cray_intel_debug" ]; then - source $path_b/cmplr.env - sed -e "s//$optl/" -e "s//$comp_seq/" -e "s//$comp_mpi/" -e "s//$optomp/" $path_b/link.tmpl > $path_b/link - echo " sed $path_b/link.tmpl => $path_b/link" - else - errmsg "$path_b/link.$cmplr not found" - exit 1 - fi - if [ -f $path_b/ad3.$cmplr ] - then - rm -f $path_b/ad3 - cp -f $path_b/ad3.$cmplr $path_b/ad3 - echo " copy $path_b/ad3.$cmplr => $path_b/ad3" - elif [ "$cmplr" == "mpt" ] || [ "$cmplr" == "mpt_debug" ] || \ - [ "$cmplr" == "datarmor_mpt" ] || [ "$cmplr" == "datarmor_mpt_debug" ] || \ - [ "$cmplr" == "intel" ] || [ "$cmplr" == "intel_debug" ] || \ - [ "$cmplr" == "so_intel" ] || [ "$cmplr" == "so_intel_debug" ] || \ - [ "$cmplr" == "datarmor_intel" ] || [ "$cmplr" == "datarmor_intel_debug" ] || \ - [ "$cmplr" == "gnu" ] || [ "$cmplr" == "gnu_debug" ] || \ - [ "$cmplr" == "hera.intel" ] || [ "$cmplr" == "orion.intel" ] || \ - [ "$cmplr" == "hera.gnu" ] || [ "$cmplr" == "jet.intel" ] || \ - [ "$cmplr" == "stampede.intel" ] || [ "$cmplr" == "gaea.intel" ] || \ - [ "$cmplr" == "wcoss2" ] || [ "$cmplr" == "s4.intel" ] || \ - [ "$cmplr" == "cheyenne.intel" ] || [ "$cmplr" == "cheyenne.gnu" ] || \ - [ "$cmplr" == "wcoss_cray" ] || [ "$cmplr" == "wcoss_dell_p3" ] || \ - [ "$cmplr" == "datarmor_gnu" ] || [ "$cmplr" == "datarmor_gnu_debug" ] || \ - [ "$cmplr" == "pgi" ] || [ "$cmplr" == "pgi_debug" ] || \ - [ "$cmplr" == "datarmor_pgi" ] || [ "$cmplr" == "datarmor_pgi_debug" ] || \ - [ "$cmplr" == "ukmo_cray" ] || [ "$cmplr" == "ukmo_cray_debug" ] || \ - [ "$cmplr" == "ukmo_cray_gnu" ] || [ "$cmplr" == "ukmo_cray_gnu_debug" ] || \ - [ "$cmplr" == "ukmo_cray_intel" ] || [ "$cmplr" == "ukmo_cray_intel_debug" ]; then - source $path_b/cmplr.env - sed -e "s//$comp_seq/" -e "s//$cppad3procflag/" -e "s//$cppad3flag2/" -e "s//$cppad3flag3/" -e "s//$cppad3flag4/" -e "s//${endian}/" $path_b/ad3.tmpl > $path_b/ad3 - echo " sed $path_b/ad3.tmpl => $path_b/ad3" - else - errmsg "$path_b/ad3.$cmplr not found" - exit 1 - fi - chmod 775 $path_b/comp $path_b/link $path_b/ad3 -fi -# 3.d Setup switch file -if [ $swtch ] -then - echo ' ' - echo ' Setup switch file' - if [ -f $path_b/switch_$swtch ] - then - rm -f $path_b/switch - cp -f $path_b/switch_$swtch $path_b/switch - echo " $path_b/switch_$swtch => $path_b/switch" - else - errmsg "$path_b/switch_$swtch not found" - exit 1 - fi -fi - -# 3.e Edit switch file -if [ $edit ] - then - echo " Edit $path_b/switch" - if [ ! -f $path_b/switch ] - then - errmsg "$path_b/switch not found" - exit 1 - fi - if [ $EDITOR ] - then - if $EDITOR $path_b/switch - then : - else - errmsg "Error occured during edit of $path_b/switch" - exit 1 - fi - else - errmsg "the EDITOR environment variable must be set" - exit 1 - fi -fi - -# --------------------------------------------------------------------------- # -# 4. Create WWATCH3 required model subdirectories # -# --------------------------------------------------------------------------- # -echo ' ' -echo ' Create required model subdirectories' -if [ ! -d $path_s/exe ] -then - mkdir $path_s/exe -fi -if [ ! -d $path_s/obj ] -then - mkdir $path_s/obj -fi -if [ ! -d $path_s/mod ] -then - mkdir $path_s/mod -fi - -# --------------------------------------------------------------------------- # -echo ' ' -echo 'Finished setting up WAVEWATCH III' -echo ' ' - -# --------------------------------------------------------------------------- # -# End of script # -# --------------------------------------------------------------------------- # - diff --git a/model/src/SCRIP/SCRIP.mk b/model/src/SCRIP/SCRIP.mk deleted file mode 100644 index 9932807d1..000000000 --- a/model/src/SCRIP/SCRIP.mk +++ /dev/null @@ -1,55 +0,0 @@ -$(aPo)/scrip_kindsmod.o: SCRIP/scrip_kindsmod.f90 - @$(aPb)/ad3 scrip_kindsmod - -$(aPo)/scrip_constants.o: SCRIP/scrip_constants.f \ - $(aPo)/scrip_kindsmod.o - @$(aPb)/ad3 scrip_constants - -$(aPo)/scrip_iounitsmod.o: SCRIP/scrip_iounitsmod.f90 \ - $(aPo)/scrip_kindsmod.o - @$(aPb)/ad3 scrip_iounitsmod - -$(aPo)/scrip_errormod.o: SCRIP/scrip_errormod.f90 \ - $(aPo)/scrip_kindsmod.o \ - $(aPo)/scrip_iounitsmod.o - @$(aPb)/ad3 scrip_errormod - -$(aPo)/scrip_grids.o: SCRIP/scrip_grids.f \ - $(aPo)/scrip_kindsmod.o \ - $(aPo)/scrip_constants.o \ - $(aPo)/scrip_iounitsmod.o \ - $(aPo)/scrip_errormod.o - @$(aPb)/ad3 scrip_grids - -$(aPo)/scrip_remap_vars.o: SCRIP/scrip_remap_vars.f \ - $(aPo)/scrip_kindsmod.o \ - $(aPo)/scrip_constants.o \ - $(aPo)/scrip_grids.o \ - $(aPo)/scrip_errormod.o \ - $(aPo)/scrip_iounitsmod.o - @$(aPb)/ad3 scrip_remap_vars - -$(aPo)/scrip_remap_conservative.o: SCRIP/scrip_remap_conservative.f \ - $(aPo)/scrip_kindsmod.o \ - $(aPo)/scrip_constants.o \ - $(aPo)/scrip_timers.o \ - $(aPo)/scrip_remap_vars.o \ - $(aPo)/scrip_grids.o \ - $(aPo)/scrip_errormod.o \ - $(aPo)/scrip_iounitsmod.o - @$(aPb)/ad3 scrip_remap_conservative - -$(aPo)/scrip_timers.o: SCRIP/scrip_timers.f \ - $(aPo)/scrip_kindsmod.o - @$(aPb)/ad3 scrip_timers - -$(aPo)/scrip_interface.o: SCRIP/scrip_interface.F90 \ - $(aPo)/scrip_kindsmod.o \ - $(aPo)/scrip_constants.o \ - $(aPo)/scrip_timers.o \ - $(aPo)/scrip_remap_vars.o \ - $(aPo)/scrip_grids.o \ - $(aPo)/scrip_remap_conservative.o \ - $(aPo)/scrip_iounitsmod.o \ - $(aPo)/scrip_errormod.o - @$(aPb)/ad3 scrip_interface diff --git a/model/src/SCRIP/SCRIP_NC.mk b/model/src/SCRIP/SCRIP_NC.mk deleted file mode 100644 index 700dafe36..000000000 --- a/model/src/SCRIP/SCRIP_NC.mk +++ /dev/null @@ -1,86 +0,0 @@ -$(aPo)/scrip_kindsmod.o: SCRIP/scrip_kindsmod.f90 - @$(aPb)/ad3 scrip_kindsmod - -$(aPo)/scrip_constants.o: SCRIP/scrip_constants.f \ - $(aPo)/scrip_kindsmod.o - @$(aPb)/ad3 scrip_constants - -$(aPo)/scrip_iounitsmod.o: SCRIP/scrip_iounitsmod.f90 \ - $(aPo)/scrip_kindsmod.o - @$(aPb)/ad3 scrip_iounitsmod - -$(aPo)/scrip_errormod.o: SCRIP/scrip_errormod.f90 \ - $(aPo)/scrip_kindsmod.o \ - $(aPo)/scrip_iounitsmod.o - @$(aPb)/ad3 scrip_errormod - -$(aPo)/scrip_netcdfmod.o: SCRIP/scrip_netcdfmod.f90 \ - $(aPo)/scrip_kindsmod.o \ - $(aPo)/scrip_errormod.o - @$(aPb)/ad3 scrip_netcdfmod - -$(aPo)/scrip_grids.o: SCRIP/scrip_grids.f \ - $(aPo)/scrip_kindsmod.o \ - $(aPo)/scrip_constants.o \ - $(aPo)/scrip_iounitsmod.o \ - $(aPo)/scrip_netcdfmod.o \ - $(aPo)/scrip_errormod.o - @$(aPb)/ad3 scrip_grids - -$(aPo)/scrip_remap_vars.o: SCRIP/scrip_remap_vars.f \ - $(aPo)/scrip_kindsmod.o \ - $(aPo)/scrip_constants.o \ - $(aPo)/scrip_grids.o \ - $(aPo)/scrip_errormod.o \ - $(aPo)/scrip_netcdfmod.o \ - $(aPo)/scrip_iounitsmod.o - @$(aPb)/ad3 scrip_remap_vars - -$(aPo)/scrip_remap_conservative.o: SCRIP/scrip_remap_conservative.f \ - $(aPo)/scrip_kindsmod.o \ - $(aPo)/scrip_constants.o \ - $(aPo)/scrip_timers.o \ - $(aPo)/scrip_remap_vars.o \ - $(aPo)/scrip_grids.o \ - $(aPo)/scrip_errormod.o \ - $(aPo)/scrip_netcdfmod.o \ - $(aPo)/scrip_iounitsmod.o - @$(aPb)/ad3 scrip_remap_conservative - -$(aPo)/scrip_timers.o: SCRIP/scrip_timers.f \ - $(aPo)/scrip_kindsmod.o - @$(aPb)/ad3 scrip_timers - -$(aPo)/scrip_remap_write.o: SCRIP/scrip_remap_write.f \ - $(aPo)/scrip_kindsmod.o \ - $(aPo)/scrip_constants.o \ - $(aPo)/scrip_netcdfmod.o \ - $(aPo)/scrip_remap_vars.o \ - $(aPo)/scrip_grids.o \ - $(aPo)/scrip_errormod.o \ - $(aPo)/scrip_iounitsmod.o - @$(aPb)/ad3 scrip_remap_write - -$(aPo)/scrip_remap_read.o: SCRIP/scrip_remap_read.f \ - $(aPo)/scrip_kindsmod.o \ - $(aPo)/scrip_constants.o \ - $(aPo)/scrip_netcdfmod.o \ - $(aPo)/scrip_remap_vars.o \ - $(aPo)/scrip_grids.o \ - $(aPo)/scrip_errormod.o \ - $(aPo)/scrip_iounitsmod.o - @$(aPb)/ad3 scrip_remap_read - -$(aPo)/scrip_interface.o: SCRIP/scrip_interface.F90 \ - $(aPo)/scrip_kindsmod.o \ - $(aPo)/scrip_constants.o \ - $(aPo)/scrip_timers.o \ - $(aPo)/scrip_remap_vars.o \ - $(aPo)/scrip_grids.o \ - $(aPo)/scrip_remap_conservative.o \ - $(aPo)/scrip_netcdfmod.o \ - $(aPo)/scrip_remap_write.o \ - $(aPo)/scrip_remap_read.o \ - $(aPo)/scrip_iounitsmod.o \ - $(aPo)/scrip_errormod.o - @$(aPb)/ad3 scrip_interface diff --git a/regtests/bin/matrix_cmake_datarmor b/regtests/bin/matrix_cmake_datarmor deleted file mode 100755 index f8ffaaa63..000000000 --- a/regtests/bin/matrix_cmake_datarmor +++ /dev/null @@ -1,195 +0,0 @@ -#!/bin/bash -# --------------------------------------------------------------------------- # -# matrix_datarmor: Run matrix of regression tests on target machine. # -# # -# Remarks: # -# - This version is set up for automatic w3_setenv script and for the # -# IFREMER HPC 'datarmor'. When using this for your own setup and # -# computer, please copy rather than modify. # -# # -# Hendrik L. Tolman # -# Mickael Accensi # -# # -# August 2013 # -# December 2013 # -# April 2018 # -# October 2021 # -# Feb 2022 # -# # -# Copyright 2013 National Weather Service (NWS), # -# National Oceanic and Atmospheric Administration. All rights # -# reserved. WAVEWATCH III is a trademark of the NWS. # -# No unauthorized use without permission. # -# # -# --------------------------------------------------------------------------- # - -usage () -{ -cat 2>&1 << EOF - -Usage: $myname model_dir -Required: - model_dir : path to model dir of WW3 source -EOF -} - - -# 0.e Get required arguments -if [ ! $# = 0 ] -then - main_dir="$1" ; shift -else - usage - exit 1 -fi - -#convert main_dir to absolute path -main_dir="`cd $main_dir 1>/dev/null 2>&1 && pwd`" - - cmplr=datarmor_intel - - - -# 1. Set up - - export np='28' #number of mpi tasks - export npl='28' #number of mpi tasks for ufs applications and large setups - export npl1='20' #number of mpi tasks for ufs/large setups (b4b check) - export nr='4' #number of mpi tasks for hybrid - export nth='7' #number of threads - export nth1='6' #number of threads (b4b check) - -# 1.a Computer/ user dependent set up - - echo '#!/bin/bash' > matrix.head - echo ' ' >> matrix.head - echo '#PBS -q mpi_1' >> matrix.head - echo "#PBS -l select=1:ncpus=28:mpiprocs=$nr:ompthreads=$nth:mem=20G" >> matrix.head - echo '#PBS -l walltime=12:00:00' >> matrix.head - echo "#PBS -N $(basename $(dirname $(dirname $PWD)))" >> matrix.head - echo '#PBS -j oe' >> matrix.head - echo '#PBS -o matrix.out' >> matrix.head - echo ' ' >> matrix.head - - echo " cd $(dirname $main_dir)/regtests" >> matrix.head - echo ' ' >> matrix.head - -# Netcdf, grib and Parmetis modules - - echo ' source /usr/share/Modules/3.2.10/init/bash' >> matrix.head - echo ' module purge' >> matrix.head - - if [ $cmplr = "datarmor_intel_debug" ] || [ $cmplr = "datarmor_intel" ] - then - COMP='INTEL' - echo ' module load intel-comp/18' >> matrix.head - echo ' module load impi/2018.1.163' >> matrix.head - echo ' export CC=mpiicc' >> matrix.head - echo ' export FC=mpiifort' >> matrix.head - elif [ $cmplr = "datarmor_mpt_debug" ] || [ $cmplr = "datarmor_mpt" ] - then - COMP='MPT' - echo ' module load intel-comp/18' >> matrix.head - echo ' module load mpt/2.18' >> matrix.head - echo " export CC='icc -lmpi'" >> matrix.head - echo " export FC='ifort -lmpi'" >> matrix.head - elif [ $cmplr = "datarmor_gnu_debug" ] | [ $cmplr = "datarmor_gnu" ] - then - COMP='GNU' - echo ' module load impi/2018.1.163' >> matrix.head - echo ' export CC=mpigcc' >> matrix.head - echo ' export FC=mpif90' >> matrix.head - elif [ $cmplr = "datarmor_pgi_debug" ] || [ $cmplr = "datarmor_pgi" ] - then - COMP='PGI' - echo ' module load pgi/17.10' >> matrix.head - fi - - echo " export PATH=\${PATH}:/home/datawork-wave/CMAKE2022/cmake-3.22.1/bin" >> matrix.head - echo " export PATH=\${PATH}:/home/datawork-wave/NETCDF2019/${COMP}/bin" >> matrix.head - echo " export CPATH=\${CPATH}:/home/datawork-wave/NETCDF2019/${COMP}/include" >> matrix.head - echo " export LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:/home/datawork-wave/NETCDF2019/${COMP}/lib" >> matrix.head - echo " export NETCDF_CONFIG=/home/datawork-wave/NETCDF2019/${COMP}/bin/nc-config" >> matrix.head - echo " export NetCDF_ROOT=/home/datawork-wave/NETCDF2019/${COMP}" >> matrix.head - echo " export METIS_PATH=/home/datawork-wave/PARMETIS2019/${COMP}" >> matrix.head - echo " export WW3_PARCOMPN=4" >> matrix.head - echo " export G2_LIB4=/home/datawork-wave/NCEPLIBS/${COMP}/g2-3.4.5/lib64/libg2_4.a" >> matrix.head - echo " export BACIO_LIB4=/home/datawork-wave/NCEPLIBS/${COMP}/bacio-2.4.1/lib/libbacio_4.a" >> matrix.head - echo " export JASPER_LIB=/home/datawork-wave/NETCDF2019/${COMP}/lib/libjasper.so" >> matrix.head - echo " export PNG_LIB=/home/datawork-wave/NETCDF2019/${COMP}/lib/libpng.so" >> matrix.head - echo " export Z_LIB=/lib64/libz.so.1" >> matrix.head - echo " # cmake dependencies" >> matrix.head - echo " export CMAKE_PREFIX_PATH=/home/datawork-wave/NETCDF2019/${COMP}" >> matrix.head - echo " export g2_DIR=/home/datawork-wave/NCEPLIBS/${COMP}/g2-3.4.5/lib64/cmake/g2" >> matrix.head - echo " export bacio_DIR=/home/datawork-wave/NCEPLIBS/${COMP}/bacio-2.4.1/lib/cmake/bacio" >> matrix.head - echo " export w3emc_DIR=/home/datawork-wave/NCEPLIBS/${COMP}/w3emc-2.9.2/lib/cmake/w3emc" >> matrix.head - echo ' ' - - export mpi='$MPI_LAUNCH' - -# Compile option - opt="-f -N -S -T" - -# Base run_test command line - export rtst="./bin/run_cmake_test $opt" - - export ww3='../model' - -# 1.b Flags to do course selection - - - - - - - - - - - - - - - - - - - - - - -# Addition selection by commenting out lines as below - - export shrd='y' # Do shared architecture tests - export dist='y' # Do distributed architecture (MPI) tests - export omp='y' # Threaded (OpenMP) tests - export hybd='y' # Hybrid options - - export prop1D='y' # 1-D propagation tests (ww3_tp1.X) - export prop2D='y' # 2-D propagation tests (ww3_tp2.X) - export time='y' # time linmited growth - export fetch='y' # fetch linmited growth - export hur1mg='y' # Hurricane with one moving grid - export shwtr='y' # shallow water tests - export unstr='y' # unstructured grid tests - export pdlib='y' # unstr with pdlib for domain decomposition and implicit solver - export smcgr='y' # SMC grid test - export rtd='y' # Rotated pole test - export mudice='y' # Mud/Ice and wave interaction tests - export infgrv='y' # Second harmonic generation tests - export uost='y' # ww3_ts4 Unresolved Obstacles Source Term (UOST) - export assim='y' # Restart spectra update - export oasis='y' # Atmosphere, ocean, and ice coupling using OASIS - export calendar='y' # Calendar type - export confignc='y' # Configurable netCDF meta data (ww3_ounf) - - export multi01='y' # mww3_test_01 (wetting and drying) - export multi02='y' # mww3_test_02 (basic two-way nesting test)) - export multi03='y' # mww3_test_03 (three high and three low res grids). - export multi04='y' # mww3_test_04 (swell on sea mount and/or current) - export multi05='y' # mww3_test_05 (three-grid moving hurricane) - export multi06='y' # mww3_test_06 (curvilinear grid tests) - export multi07='y' # mww3_test_07 (unstructured grid tests) - export multi08='y' # mww3_test_08 (wind and ice tests) - export multi09='y' # mww3_test_09 (SMC multi grid test) - export ufs='n' # The Unified Forecast System - export ufscoarse='n' # Option for small PCs - export grib='y' # grib file field output - export rstrt_b4b='y' # Restart Reproducibility - export npl_b4b='y' # MPI task Reproducibility - export nth_b4b='y' # Thread Reproducibility - export esmf='n' # ESMF coupling -# export filter='PR3 ST2 UQ' - # The filter does a set of consecutive greps on the - # command lines generated by filter.base with the above - # selected options. - -# --------------------------------------------------------------------------- # -# 2. Execute matrix.base ... # -# --------------------------------------------------------------------------- # - - $main_dir/../regtests/bin/matrix.base - - $main_dir/../regtests/bin/matrix_divider_cmake.sh - -# --------------------------------------------------------------------------- # -# End to the matrix # -# --------------------------------------------------------------------------- # diff --git a/regtests/bin/matrix_cmake_milhydro b/regtests/bin/matrix_cmake_milhydro deleted file mode 100755 index 8213b9b33..000000000 --- a/regtests/bin/matrix_cmake_milhydro +++ /dev/null @@ -1,153 +0,0 @@ -#!/bin/bash -# --------------------------------------------------------------------------- # -# matrix.go: Run matrix of regression tests on target machine. # -# # -# Remarks: # -# - This version is set up for automatic w3_setenv script and for the # -# NOAA RDHPC 'zeus' system. When using this for your own setup and # -# computer, please copy rather than modify. # -# # -# Hendrik L. Tolman # -# August 2013 # -# December 2013 # -# April 2018 # -# # -# Copyright 2013 National Weather Service (NWS), # -# National Oceanic and Atmospheric Administration. All rights # -# reserved. WAVEWATCH III is a trademark of the NWS. # -# No unauthorized use without permission. # -# # -# --------------------------------------------------------------------------- # -usage () -{ - cat 2>&1 << EOF - - Usage: $myname model_dir - Required: - model_dir : path to model dir of WW3 source -EOF -} - - -# Get required arguments - if [ ! $# = 0 ] - then - main_dir="$1" ; shift - else - usage - exit 1 - fi - -# Convert main_dir to absolute path - main_dir="`cd $main_dir 1>/dev/null 2>&1 && pwd`" - -# Set batchq queue, choose modules and other custom variables to fit system and -# to define headers etc (default to original version if empty) -# 1. Set up -# 1.a Computer/ user dependent set up - - echo '#!/bin/sh ' > matrix.head - echo ' ' >> matrix.head - echo " cd $(dirname $main_dir)/regtests" >> matrix.head - echo ' ' >> matrix.head - -# Netcdf and Parmetis modules & variables - echo " export NetCDF_ROOT=/home/thesser/tools/GNU " >> matrix.head - echo " export METIS_PATH=/home/thesser/public/parmetis " >> matrix.head - echo " export PATH=/home/thesser/tools/cmake/bin:$PATH" >> matrix.head -echo " export path_build_root=$(dirname $main_dir)/regtests/buildmatrix" >> matrix.head - echo ' [[ -d ${path_build_root} ]] && rm -rf ${path_build_root}' >> matrix.head - - echo ' ' - - if [ "$batchq" = 'slurm' ] - then - export mpi='mpirun' - else - export mpi='mpirun' - fi - export np='24' - export nr='0' - export nth='0' -# Compile option - opt="-o netcdf -S -T -N" -# Batch queue option - if [ "$batchq" = 'slurm' ] - then - opt="-b $batchq $opt" - fi - -# Base run_test command line - export rtst="./bin/run_cmake_test $opt" - - export ww3='../model' - -# 1.b Flags to do course selection - - - - - - - - - - - - - - - - - - - - - - -# Addition selection by commenting out lines as below - export shrd='y' # Do shared architecture tests - export dist='y' # Do distributed architecture (MPI) tests - export omp='y' # Threaded (OpenMP) tests - export hybd='y' # Hybrid options - - export prop1D='y' # 1-D propagation tests (ww3_tp1.X) - export prop2D='y' # 2-D propagation tests (ww3_tp2.X) - export time='y' # time linmited growth - export fetch='y' # fetch linmited growth - export hur1mg='y' # Hurricane with one moving grid - export shwtr='y' # shallow water tests - export unstr='y' # unstructured grid tests - export pdlib='y' # unstr with pdlib for domain decomposition and implicit solver - export smcgr='y' # SMC grid test - export rtd='y' # Rotated pole test - export mudice='y' # Mud/Ice and wave interaction tests - export infgrv='y' # Second harmonic generation tests - export uost='y' # ww3_ts4 Unresolved Obstacles Source Term (UOST) - export assim='y' # Restart spectra update - export oasis='y' # Atmosphere, ocean, and ice coupling using OASIS - export calendar='y' # Calendar type - export confignc='y' # Configurable netCDF meta data (ww3_ounf) - - export multi01='y' # mww3_test_01 (wetting and drying) - export multi02='y' # mww3_test_02 (basic two-way nesting test)) - export multi03='y' # mww3_test_03 (three high and three low res grids). - export multi04='y' # mww3_test_04 (swell on sea mount and/or current) - export multi05='y' # mww3_test_05 (three-grid moving hurricane) - export multi06='y' # mww3_test_06 (curvilinear grid tests) - export multi07='y' # mww3_test_07 (unstructured grid tests) - export multi08='y' # mww3_test_08 (wind and ice tests) - export multi09='y' # mww3_test_09 (SMC multi grid test) - - export ufs='n' # The Unified Forecast System - export ufscoarse='n' # Option for small PCs - export grib='n' # grib file field output - export rstrt_b4b='n' # Restart Reproducibility - export npl_b4b='n' # MPI task Reproducibility - export nth_b4b='n' # Thread Reproducibility - export esmf='n' # ESMF coupling - # The filter does a set of consecutinve greps on the - # command lines generated by filter.base with the above - # selected options. - -# --------------------------------------------------------------------------- # -# 2. Execute matrix.base ... # -# --------------------------------------------------------------------------- # - - - $main_dir/../regtests/bin/matrix.base - - $main_dir/../regtests/bin/matrix_divider_cmake.sh - - - echo "#submit all of the diveded matrix files" > msuball.sh - if [ $batchq = "slurm" ] - then - files=`ls matrix??` - for file in $files - do - echo "sbatch < $file" >> msuball.sh - done - fi - -# --------------------------------------------------------------------------- # -# End to the matrix # -# --------------------------------------------------------------------------- # diff --git a/regtests/bin/matrix_cmake_ncep b/regtests/bin/matrix_cmake_ncep deleted file mode 100755 index 19ce9c5e1..000000000 --- a/regtests/bin/matrix_cmake_ncep +++ /dev/null @@ -1,259 +0,0 @@ -#!/bin/bash -# --------------------------------------------------------------------------- # -# matrix.go: Run matrix of regression tests on target machine. # -# # -# Remarks: # -# - This version is set up for automatic w3_setenv script and for the # -# NOAA RDHPC systems. When using this for your own setup and # -# computer, please copy rather than modify. # -# # -# Hendrik L. Tolman # -# August 2013 # -# Last update: May 2022 # -# # -# Copyright 2013 National Weather Service (NWS), # -# National Oceanic and Atmospheric Administration. All rights # -# reserved. WAVEWATCH III is a trademark of the NWS. # -# No unauthorized use without permission. # -# # -# --------------------------------------------------------------------------- # - -usage () -{ - cat 2>&1 << EOF - - Usage: $myname model_dir - Required: - model_dir : path to model dir of WW3 source -EOF -} - - -# Get required arguments - if [ ! $# = 0 ] - then - main_dir="$1" ; shift - else - usage - exit 1 - fi - -# Convert main_dir to absolute path - main_dir="`cd $main_dir 1>/dev/null 2>&1 && pwd`" - -# Module Versions from HPC-Stack that are common for all platforms - modnetcdf='netcdf/4.7.4' - modjasper='jasper/2.0.25' - modzlib='zlib/1.2.11' - modpng='libpng/1.6.37' - modhdf5='hdf5/1.10.6' - modbacio='bacio/2.4.1' - modg2='g2/3.4.5' - modw3emc='w3emc/2.9.2' - modesmf='esmf/8.3.0b09' - -# Set batchq queue, choose modules and other custom variables to fit system and -# to define headers etc (default to original version if empty) - ishera=`hostname | grep hfe` - isorion=`hostname | grep Orion` - if [ $ishera ] - then - # If no other h, assuming Hera - batchq='slurm' - basemodcomp='intel/2022.1.2' - basemodmpi='impi/2022.1.2' - hpcstackpath='/scratch1/NCEPDEV/nems/role.epic/hpc-stack/libs/intel-2022.1.2/modulefiles/stack' - hpcstackversion='hpc/1.2.0' - modcomp='hpc-intel/2022.1.2' - modmpi='hpc-impi/2022.1.2' - scotchpath='/scratch1/NCEPDEV/climate/Matthew.Masarik/waves/opt/hpc-stack/scotch-v7.0.3/install' - metispath='/scratch1/NCEPDEV/climate/Matthew.Masarik/waves/opt/hpc-stack/parmetis-4.0.3/install' - modcmake='cmake/3.20.1' - elif [ $isorion ] - then - batchq='slurm' - basemodcomp='intel/2022.1.2' - basemodmpi='impi/2022.1.2' - hpcstackpath='/work/noaa/epic-ps/hpc-stack/libs/intel/2022.1.2/modulefiles/stack' - hpcstackversion='hpc/1.2.0' - modcomp='hpc-intel/2022.1.2' - modmpi='hpc-impi/2022.1.2' - scotchpath='/work2/noaa/marine/mmasarik/waves/opt/hpc-stack/scotch-v7.0.3/install' - metispath='/work2/noaa/marine/mmasarik/waves/opt/hpc-stack/parmetis-4.0.3/install' - modcmake='cmake/3.22.1' - else - batchq= - fi - -# 1. Set up - - export np='24' #number of mpi tasks - export npl='140' #number of mpi tasks for ufs applications and large setups - export npl1='100' #number of mpi tasks for ufs/large setups (b4b check) - export nr='4' #number of mpi tasks for hybrid - export nth='6' #number of threads - export nth1='4' #number of threads (b4b check) - -# 1.a Computer/ user dependent set up - - echo '#!/bin/sh --login' > matrix.head - echo ' ' >> matrix.head - if [ $batchq = "slurm" ] && [ $isorion ] - then - echo "#SBATCH -n ${np}" >> matrix.head - echo "##SBATCH --cpus-per-task=${nth}" >> matrix.head - echo '#SBATCH -q batch' >> matrix.head - echo '#SBATCH -t 08:00:00' >> matrix.head - echo '#SBATCH -A marine-cpu' >> matrix.head - echo '#SBATCH -J ww3_regtest' >> matrix.head - echo '#SBATCH -o matrix.out' >> matrix.head - echo '#SBATCH -p orion' >> matrix.head - echo '#SBATCH --exclusive' >> matrix.head - echo ' ' >> matrix.head - echo 'ulimit -s unlimited' >> matrix.head - echo 'ulimit -c 0' >> matrix.head - echo 'export KMP_STACKSIZE=2G' >> matrix.head - echo 'export FI_OFI_RXM_BUFFER_SIZE=128000' >> matrix.head - echo 'export FI_OFI_RXM_RX_SIZE=64000' >> matrix.head - elif [ $batchq = "slurm" ] - then - echo "#SBATCH -n ${np}" >> matrix.head - echo "##SBATCH --cpus-per-task=${nth}" >> matrix.head - echo '#SBATCH -q batch' >> matrix.head - echo '#SBATCH -t 08:00:00' >> matrix.head - echo '#SBATCH -A marine-cpu' >> matrix.head - echo '#SBATCH -J ww3_regtest' >> matrix.head - echo '#SBATCH -o matrix.out' >> matrix.head - else - echo '#PBS -l procs=24' >> matrix.head - echo '#PBS -q batch' >> matrix.head - echo '#PBS -l walltime=08:00:00' >> matrix.head - echo '#PBS -A marine-cpu' >> matrix.head - echo '#PBS -N ww3_regtest' >> matrix.head - echo '#PBS -j oe' >> matrix.head - echo '#PBS -o matrix.out' >> matrix.head - fi - echo ' ' >> matrix.head - echo " cd $(dirname $main_dir)/regtests" >> matrix.head - echo ' ' >> matrix.head - -# Netcdf, Parmetis and SCOTCH modules & variables - echo " module purge" >> matrix.head - echo " module load $modcmake" >> matrix.head - if [ ! -z $basemodcomp ]; then - echo " module load $basemodcomp" >> matrix.head - fi - if [ ! -z $basemodmpi ]; then - echo " module load $basemodmpi" >> matrix.head - fi - echo " module use $hpcstackpath" >> matrix.head - echo " module load $hpcstackversion" >> matrix.head - echo " module load $modcomp" >> matrix.head - echo " module load $modmpi" >> matrix.head - echo " module load $modpng" >> matrix.head - echo " module load $modzlib" >> matrix.head - echo " module load $modjasper" >> matrix.head - echo " module load $modhdf5" >> matrix.head - echo " module load $modnetcdf" >> matrix.head - echo " module load $modbacio" >> matrix.head - echo " module load $modg2" >> matrix.head - echo " module load $modw3emc" >> matrix.head - echo " module load $modesmf" >> matrix.head - - echo " export METIS_PATH=${metispath}" >> matrix.head - echo " export SCOTCH_PATH=${scotchpath}" >> matrix.head - echo " export path_build_root=$(dirname $main_dir)/regtests/buildmatrix" >> matrix.head - echo ' [[ -d ${path_build_root} ]] && rm -rf ${path_build_root}' >> matrix.head - echo ' ' - - if [ "$batchq" = 'slurm' ] - then - export mpi='srun' - else - export mpi='mpirun' - fi - -# Compile option - opt="-o all -S -T" - -# Batch queue option - if [ "$batchq" = 'slurm' ] - then - opt="-b $batchq $opt" - fi - -# Base run_test command line - export rtst="./bin/run_cmake_test $opt" - - export ww3='../model' - -# 1.b Flags to do course selection - - - - - - - - - - - - - - - - - - - - - - -# Addition selection by commenting out lines as below - - export shrd='y' # Do shared architecture tests - export dist='y' # Do distributed architecture (MPI) tests - export omp='y' # Threaded (OpenMP) tests - export hybd='y' # Hybrid options - - export prop1D='y' # 1-D propagation tests (ww3_tp1.X) - export prop2D='y' # 2-D propagation tests (ww3_tp2.X) - export time='y' # time linmited growth - export fetch='y' # fetch linmited growth - export hur1mg='y' # Hurricane with one moving grid - export shwtr='y' # shallow water tests - export unstr='y' # unstructured grid tests - export pdlib='y' # unstr with pdlib for domain decomposition and implicit solver - export smcgr='y' # SMC grid test - export rtd='y' # Rotated pole test - export mudice='y' # Mud/Ice and wave interaction tests - export infgrv='y' # Second harmonic generation tests - export uost='y' # ww3_ts4 Unresolved Obstacles Source Term (UOST) - export assim='y' # Restart spectra update - export oasis='y' # Atmosphere, ocean, and ice coupling using OASIS - export calendar='y' # Calendar type - export confignc='y' # Configurable netCDF meta data (ww3_ounf) - - export multi01='y' # mww3_test_01 (wetting and drying) - export multi02='y' # mww3_test_02 (basic two-way nesting test)) - export multi03='y' # mww3_test_03 (three high and three low res grids). - export multi04='y' # mww3_test_04 (swell on sea mount and/or current) - export multi05='y' # mww3_test_05 (three-grid moving hurricane) - export multi06='y' # mww3_test_06 (curvilinear grid tests) - export multi07='y' # mww3_test_07 (unstructured grid tests) - export multi08='y' # mww3_test_08 (wind and ice tests) - export multi09='y' # mww3_test_09 (SMC multi grid test) - - export ufs='y' # The Unified Forecast System - export ufscoarse='y' # Option for small PCs - export grib='y' # grib file field output - export rstrt_b4b='y' # Restart Reproducibility - export npl_b4b='y' # MPI task Reproducibility - export nth_b4b='y' # Thread Reproducibility - export esmf='n' # ESMF coupling -# export filter='PR3 ST2 UQ' - # The filter does a set of consecutive greps on the - # command lines generated by filter.base with the above - # selected options. - -# --------------------------------------------------------------------------- # -# 2. Execute matrix.base ... # -# --------------------------------------------------------------------------- # - - $main_dir/../regtests/bin/matrix.base - - $main_dir/../regtests/bin/matrix_divider_cmake.sh - - - echo "#submit all of the diveded matrix files" > msuball.sh - if [ $batchq = "slurm" ] - then - files=`ls matrix??` - for file in $files - do - echo "sbatch < $file" >> msuball.sh - done - fi - -# --------------------------------------------------------------------------- # -# End to the matrix # -# --------------------------------------------------------------------------- # diff --git a/regtests/bin/matrix_cmake_ukmo_cray b/regtests/bin/matrix_cmake_ukmo_cray deleted file mode 100755 index fc6cf64b9..000000000 --- a/regtests/bin/matrix_cmake_ukmo_cray +++ /dev/null @@ -1,183 +0,0 @@ -#!/bin/bash -# --------------------------------------------------------------------------- # -# matrix_ukmo_cray: Run matrix of regression tests on Cray XC architecture # -# as currently used at the UK Met Office. # -# -# This version runs the CMake compilation version -# # -# Remarks: # -# Currently, programs using the PDLIB switch (METIS library) crash when # -# compiled with the Cray CCE compiler. For those regtests that use PDLIB # -# it is required to use the GNU compiler. # -# # -# Chris Bunney # -# April 2022 # -# # -# Hendrik L. Tolman # -# August 2013 # -# # -# Copyright 2013 National Weather Service (NWS), # -# National Oceanic and Atmospheric Administration. All rights # -# reserved. WAVEWATCH III is a trademark of the NWS. # -# No unauthorized use without permission. # -# # -# --------------------------------------------------------------------------- # -# 0. Environment file - - -usage () -{ - cat 2>&1 << EOF - - Usage: $myname model_dir - Required: - model_dir : path to model dir of WW3 source -EOF -} - - -# Get required arguments - if [ ! $# = 0 ] - then - main_dir="$1" ; shift - else - usage - exit 1 - fi - -# Convert main_dir to absolute path - main_dir="`cd $main_dir 1>/dev/null 2>&1 && pwd`" - - - - # Set Cray compiler variant: CCE (Cray Compiler Environment) or GNU. - # - ukmo_cray[_debug] : Cray Fortan (Cray Compiler Environment) - # - ukmo_cray_gnu[_dubug] : GNU Fortran using cray wrapper - # - ukmo_cray_intel[_dubug] : Ifort using cray wrapper - # Note: currently, Cray Fortran fails with some PDLIB regrests - cmplr="ukmo_cray_gnu" - -# 1. Set up for compilation environemnt on Cray XC (broadwell processors) - echo '#!/bin/bash' > matrix.head - echo ' ' >> matrix.head - -# Run everything on single node in shared queue (compilation on compute -# nodes via parallel queue is inefficient and wasteful of resources): - echo '#PBS -l ncpus=16' >> matrix.head - echo '#PBS -l mem=16GB' >> matrix.head - echo '#PBS -q shared' >> matrix.head - echo '#PBS -l walltime=04:00:00' >> matrix.head - echo '#PBS -N ww3_regtest' >> matrix.head - echo '#PBS -j oe' >> matrix.head - echo '#PBS -o matrix.out' >> matrix.head - echo ' ' >> matrix.head - - echo " cd $(dirname $main_dir)/regtests" >> matrix.head - echo ' ' >> matrix.head - -if [[ $cmplr == "ukmo_cray" ]] || [[ $cmplr == "ukmo_cray_debug" ]]; then - # Load targetted versions of Cray Development Tools (bug in Fortran StreamIO - # for older versions) and netCDF/HDF5 modules: - echo "module load cdt/18.12" >> matrix.head - echo "module load cray-netcdf/4.6.1.3" >> matrix.head - echo "module load cray-hdf5/1.10.2.0" >> matrix.head - echo "export METIS_PATH=/home/d02/frey/WW3/ParMETIS" >> matrix.head - -elif [[ $cmplr == ukmo_cray_gnu* ]]; then - # ParMETIS library not currently working with Cray compiler. - # Use GNU compiler for programs that use PDLIB. - echo "module switch PrgEnv-cray PrgEnv-gnu/5.2.82" >> matrix.head - echo "module load cray-netcdf" >> matrix.head - echo "export METIS_PATH=/home/d02/frey/WW3/ParMETIS_GNU" >> matrix.head - -elif [[ $cmplr == ukmo_cray_intel* ]]; then - echo "module switch PrgEnv-cray PrgEnv-intel" >> matrix.head - echo "module swap intel/15.0.0.090 intel/18.0.5.274" >> matrix.head - echo "module load cdt/18.12" >> matrix.head - echo "module load cray-netcdf/4.6.1.3" >> matrix.head - echo "module load cray-hdf5/1.10.2.0" >> matrix.head - -else - echo "Unknown compiler for UKMO regression tests: $cmplr" - exit 1 -fi - -# Need newer cmake version on the XC - echo "module load cmake/3.21.3" >> matrix.head - -# SNP Launcher 7.7.4 allows -np switch: - echo "module load cray-snplauncher/7.7.4" >> matrix.head - echo "export NETCDF_CONFIG=\$(which nc-config)" >> matrix.head - -# On the Cray XC, we need to stop CMake from searching for -# the NetCDF libraries - they are provided by the ftn wrapper. - echo "export CMAKE_OPTIONS=-DEXCLUDE_FIND=\"netcdf\"" >> matrix.head - -# Resources: - export mpi='mpiexec' - export np='16' - export nr='4' - export nth='4' - - export rtst="./bin/run_cmake_test -o both -S" - - export ww3='../model' - -# 1.b Flags to do course selection - - - - - - - - - - - - - - - - - - - - - - -# Addition selection by commenting out lines as below - - export shrd='y' # Do shared architecture tests - export dist='y' # Do distributed architecture (MPI) tests - export omp='y' # Threaded (OpenMP) tests - export hybd='y' # Hybrid options - - export prop1D='y' # 1-D propagation tests (ww3_tp1.X) - export prop2D='y' # 2-D propagation tests (ww3_tp2.X) - export time='y' # time linmited growth - export fetch='y' # fetch linmited growth - export hur1mg='y' # Hurricane with one moving grid - export shwtr='y' # shallow water tests - export unstr='y' # unstructured grid tests - export pdlib='y' # unstr with pdlib for domain decomposition and implicit solver - export smcgr='y' # SMC grid test - export rtd='y' # Rotated pole test - export mudice='y' # Mud/Ice and wave interaction tests - export infgrv='y' # Second harmonic generation tests - export uost='y' # ww3_ts4 Unresolved Obstacles Source Term (UOST) - export assim='y' # Restart spectra update - export oasis='y' # Atmosphere, ocean, and ice coupling using oasis - export calendar='y' # Calendar type - export confignc='y' # Configurable netCDF meta data (ww3_ounf) - - export multi01='y' # mww3_test_01 (wetting and drying) - export multi02='y' # mww3_test_02 (basic two-way nesting test)) - export multi03='y' # mww3_test_03 (three high and three low res grids). - export multi04='y' # mww3_test_04 (swell on sea mount and/or current) - export multi05='y' # mww3_test_05 (three-grid moving hurricane) - export multi06='y' # mww3_test_06 (curvilinear grid tests) - export multi07='y' # mww3_test_07 (unstructured grid tests) - export multi08='y' # mww3_test_08 (wind and ice tests) - export multi09='y' # mww3_test_09 (SMC multi grid test) - export ufs='n' # The Unified Forecast System - export ufscoarse='n' # Option for small PCs - export grib='n' # grib file field output - export rstrt_b4b='y' # Restart Reproducibility - export npl_b4b='y' # MPI task Reproducibility - export nth_b4b='y' # Thread Reproducibility - export esmf='n' # ESMF coupling -# export filter='PR3 ST2 UQ' - # The filter does a set of consecutinve greps on the - # command lines generated by filter.base with the above - # selected options. - -# --------------------------------------------------------------------------- # -# 2. Execute matrix.base ... # -# --------------------------------------------------------------------------- # - - $main_dir/../regtests/bin/matrix.base - - $main_dir/../regtests/bin/matrix_divider_cmake.sh - -# --------------------------------------------------------------------------- # -# End to the matrix # -# --------------------------------------------------------------------------- # diff --git a/regtests/bin/matrix_datarmor b/regtests/bin/matrix_datarmor index 915cd5876..f8ffaaa63 100755 --- a/regtests/bin/matrix_datarmor +++ b/regtests/bin/matrix_datarmor @@ -14,6 +14,7 @@ # December 2013 # # April 2018 # # October 2021 # +# Feb 2022 # # # # Copyright 2013 National Weather Service (NWS), # # National Oceanic and Atmospheric Administration. All rights # @@ -21,31 +22,39 @@ # No unauthorized use without permission. # # # # --------------------------------------------------------------------------- # -# 0. Environment file - source $(dirname $0)/../../model/bin/w3_setenv - main_dir=$WWATCH3_DIR - temp_dir=$WWATCH3_TMP - source=$WWATCH3_SOURCE - list=$WWATCH3_LIST +usage () +{ +cat 2>&1 << EOF - echo "Main directory : $main_dir" - echo "Scratch directory : $temp_dir" - echo "Save source codes : $source" - echo "Save listings : $list" +Usage: $myname model_dir +Required: + model_dir : path to model dir of WW3 source +EOF +} -# Compiler option. Choose appropriate compiler and set cmplOption to -# y if using for the first time or using a different compiler + +# 0.e Get required arguments +if [ ! $# = 0 ] +then + main_dir="$1" ; shift +else + usage + exit 1 +fi + +#convert main_dir to absolute path +main_dir="`cd $main_dir 1>/dev/null 2>&1 && pwd`" cmplr=datarmor_intel - export cmplOption='y' -# 1. Set up - export cmplOption='y' + +# 1. Set up + export np='28' #number of mpi tasks - export npl='28' #number of mpi tasks for ufs applications and large setups - export npl1='20' #number of mpi tasks for ufs/large setups (b4b check) + export npl='28' #number of mpi tasks for ufs applications and large setups + export npl1='20' #number of mpi tasks for ufs/large setups (b4b check) export nr='4' #number of mpi tasks for hybrid export nth='7' #number of threads export nth1='6' #number of threads (b4b check) @@ -56,7 +65,7 @@ echo ' ' >> matrix.head echo '#PBS -q mpi_1' >> matrix.head echo "#PBS -l select=1:ncpus=28:mpiprocs=$nr:ompthreads=$nth:mem=20G" >> matrix.head - echo '#PBS -l walltime=08:00:00' >> matrix.head + echo '#PBS -l walltime=12:00:00' >> matrix.head echo "#PBS -N $(basename $(dirname $(dirname $PWD)))" >> matrix.head echo '#PBS -j oe' >> matrix.head echo '#PBS -o matrix.out' >> matrix.head @@ -67,54 +76,62 @@ # Netcdf, grib and Parmetis modules - echo ' source /usr/share/Modules/3.2.10/init/bash' >> matrix.head - echo ' module purge' >> matrix.head + echo ' source /usr/share/Modules/3.2.10/init/bash' >> matrix.head + echo ' module purge' >> matrix.head if [ $cmplr = "datarmor_intel_debug" ] || [ $cmplr = "datarmor_intel" ] then COMP='INTEL' - echo ' module load intel-comp/18' >> matrix.head - echo ' module load impi/2018.1.163' >> matrix.head + echo ' module load intel-comp/18' >> matrix.head + echo ' module load impi/2018.1.163' >> matrix.head + echo ' export CC=mpiicc' >> matrix.head + echo ' export FC=mpiifort' >> matrix.head elif [ $cmplr = "datarmor_mpt_debug" ] || [ $cmplr = "datarmor_mpt" ] then COMP='MPT' - echo ' module load intel-comp/18' >> matrix.head - echo ' module load mpt/2.18' >> matrix.head - elif [ $cmplr = "datarmor_gnu_debug" ] || [ $cmplr = "datarmor_gnu" ] + echo ' module load intel-comp/18' >> matrix.head + echo ' module load mpt/2.18' >> matrix.head + echo " export CC='icc -lmpi'" >> matrix.head + echo " export FC='ifort -lmpi'" >> matrix.head + elif [ $cmplr = "datarmor_gnu_debug" ] | [ $cmplr = "datarmor_gnu" ] then COMP='GNU' - echo ' module load impi/2018.1.163' >> matrix.head + echo ' module load impi/2018.1.163' >> matrix.head + echo ' export CC=mpigcc' >> matrix.head + echo ' export FC=mpif90' >> matrix.head elif [ $cmplr = "datarmor_pgi_debug" ] || [ $cmplr = "datarmor_pgi" ] then COMP='PGI' - echo ' module load pgi/17.10' >> matrix.head + echo ' module load pgi/17.10' >> matrix.head fi + echo " export PATH=\${PATH}:/home/datawork-wave/CMAKE2022/cmake-3.22.1/bin" >> matrix.head echo " export PATH=\${PATH}:/home/datawork-wave/NETCDF2019/${COMP}/bin" >> matrix.head echo " export CPATH=\${CPATH}:/home/datawork-wave/NETCDF2019/${COMP}/include" >> matrix.head echo " export LD_LIBRARY_PATH=\${LD_LIBRARY_PATH}:/home/datawork-wave/NETCDF2019/${COMP}/lib" >> matrix.head echo " export NETCDF_CONFIG=/home/datawork-wave/NETCDF2019/${COMP}/bin/nc-config" >> matrix.head + echo " export NetCDF_ROOT=/home/datawork-wave/NETCDF2019/${COMP}" >> matrix.head echo " export METIS_PATH=/home/datawork-wave/PARMETIS2019/${COMP}" >> matrix.head echo " export WW3_PARCOMPN=4" >> matrix.head - echo " export G2_LIB4=/home/datawork-wave/GRIB2021/${COMP}/lib/libg2.a" >> matrix.head - echo " export BACIO_LIB4=/home/datawork-wave/GRIB2021/${COMP}/lib/libbacio.a" >> matrix.head + echo " export G2_LIB4=/home/datawork-wave/NCEPLIBS/${COMP}/g2-3.4.5/lib64/libg2_4.a" >> matrix.head + echo " export BACIO_LIB4=/home/datawork-wave/NCEPLIBS/${COMP}/bacio-2.4.1/lib/libbacio_4.a" >> matrix.head echo " export JASPER_LIB=/home/datawork-wave/NETCDF2019/${COMP}/lib/libjasper.so" >> matrix.head echo " export PNG_LIB=/home/datawork-wave/NETCDF2019/${COMP}/lib/libpng.so" >> matrix.head echo " export Z_LIB=/lib64/libz.so.1" >> matrix.head + echo " # cmake dependencies" >> matrix.head + echo " export CMAKE_PREFIX_PATH=/home/datawork-wave/NETCDF2019/${COMP}" >> matrix.head + echo " export g2_DIR=/home/datawork-wave/NCEPLIBS/${COMP}/g2-3.4.5/lib64/cmake/g2" >> matrix.head + echo " export bacio_DIR=/home/datawork-wave/NCEPLIBS/${COMP}/bacio-2.4.1/lib/cmake/bacio" >> matrix.head + echo " export w3emc_DIR=/home/datawork-wave/NCEPLIBS/${COMP}/w3emc-2.9.2/lib/cmake/w3emc" >> matrix.head echo ' ' export mpi='$MPI_LAUNCH' # Compile option - if [ "$cmplOption" = 'y' ] - then - export opt="-o all -f -c $cmplr -S -T" - else - export opt="-o all -f -S -T" - fi + opt="-f -N -S -T" # Base run_test command line - export rtst="./bin/run_test $opt" + export rtst="./bin/run_cmake_test $opt" export ww3='../model' @@ -171,7 +188,8 @@ $main_dir/../regtests/bin/matrix.base - $main_dir/../regtests/bin/matrix_divider_p.sh + $main_dir/../regtests/bin/matrix_divider_cmake.sh + # --------------------------------------------------------------------------- # # End to the matrix # # --------------------------------------------------------------------------- # diff --git a/regtests/bin/matrix_divider_cmake.sh b/regtests/bin/matrix_divider.sh similarity index 98% rename from regtests/bin/matrix_divider_cmake.sh rename to regtests/bin/matrix_divider.sh index b88638911..ce2498c8e 100755 --- a/regtests/bin/matrix_divider_cmake.sh +++ b/regtests/bin/matrix_divider.sh @@ -29,7 +29,7 @@ maxlist1=48 maxlist2=35 maxlist3=104 #Put the job requirement/spec in "before" -sed -e "/run_cmake_test/,\$d" matrix.tmp > before +sed -e "/run_test/,\$d" matrix.tmp > before #Put the list of tests in "list" command egrep 'ww3_ufs1.2|ww3_ufs1.3' matrix.tmp | cat >> list_ufs command egrep 'ww3_tp2.14|ww3_tp2.15|ww3_tp2.17|ww3_tp2.21|ww3_ufs1.1' matrix.tmp | cat >> list_heavy @@ -54,7 +54,7 @@ rm list_omp matrixno2=$(ls list_omp_* | wc -l) echo "Total nummber of matrix with parallel tests with OMP/OMPH = $matrixno2; each includes $maxlist2 tests" #serial jobs -command egrep 'run_cmake_test' matrix.tmp | cat >> list_serial +command egrep 'run_test' matrix.tmp | cat >> list_serial split -dl $maxlist3 list_serial list_serial_ rm list_serial matrixno3=$(ls list_serial_* | wc -l) diff --git a/regtests/bin/matrix_divider_p.sh b/regtests/bin/matrix_divider_p.sh deleted file mode 100755 index 971baefe0..000000000 --- a/regtests/bin/matrix_divider_p.sh +++ /dev/null @@ -1,196 +0,0 @@ -#!/bin/bash -# --------------------------------------------------------------------------- # -# matrix_divider simply divides the main matrix into subsets with a given # -# number of test (i.e. maxlist1 for mpi tests, maxlist3 for OMP/OMPH tests # -# and maxlist3 for serial tests) # -# # -# Remarks: # -# - Once the matrix is generated, this script can be execute. The user should # -# define the maxlist and this script divide the matrix into matrix? and # -# submit the job using sbatch. # -# # -# Ali Abdolali # -# August 2018 # -# Updated: May 2021 # -# # -# Copyright 2013 National Weather Service (NWS), # -# National Oceanic and Atmospheric Administration. All rights # -# reserved. WAVEWATCH III is a trademark of the NWS. # -# No unauthorized use without permission. # -# # -# --------------------------------------------------------------------------- # -# --------------------------------------------------------------------------- # -# 1. clean up and definitions # -# --------------------------------------------------------------------------- # -cp matrix matrix.tmp -HOME=${PWD%/*} - -maxlist1=48 -maxlist2=52 -maxlist3=104 -#Put the job requirement/spec in "before" -sed -e "/run_test/,\$d" matrix.tmp > before -#Put the list of tests in "list" -command egrep 'ww3_ufs' matrix.tmp | cat >> list_ufs -awk '!/ww3_ufs/' matrix.tmp > tmpfile && mv tmpfile matrix.tmp -command egrep 'ww3_tp2.14|ww3_tp2.15|ww3_tp2.17|ww3_tp2.21' matrix.tmp | cat >> list_heavy -awk '!/ww3_tp2.14/' matrix.tmp > tmpfile && mv tmpfile matrix.tmp -awk '!/ww3_tp2.15/' matrix.tmp > tmpfile && mv tmpfile matrix.tmp -awk '!/ww3_tp2.17/' matrix.tmp > tmpfile && mv tmpfile matrix.tmp -awk '!/ww3_tp2.21/' matrix.tmp > tmpfile && mv tmpfile matrix.tmp -command egrep 'mpirun|mpiexec|MPI_LAUNCH|srun|\-O' matrix.tmp | cat >> list_mpi -awk '!/mpirun|mpiexec|MPI_LAUNCH|srun|\-O/' matrix.tmp > tmpfile && mv tmpfile matrix.tmp -#Separate the OMP/OMPH tests from MPI tests -command egrep '\-t|\-O' list_mpi | cat >> list_omp -awk '!/\-t|\-O/' list_mpi > tmpfile && mv tmpfile list_mpi - -split -dl $maxlist1 list_mpi list_mpi_ -rm list_mpi -matrixno1=$(ls list_mpi_* | wc -l) -echo "Total nummber of matrix with parallel tests = $(($matrixno1 + 1)); each includes $maxlist1 tests" - -split -dl $maxlist2 list_omp list_omp_ -rm list_omp -matrixno2=$(ls list_omp_* | wc -l) -echo "Total nummber of matrix with parallel tests with OMP/OMPH = $matrixno2; each includes $maxlist2 tests" -#serial jobs -command egrep 'run_test' matrix.tmp | cat >> list_serial -split -dl $maxlist3 list_serial list_serial_ -rm list_serial -matrixno3=$(ls list_serial_* | wc -l) -echo "Total nummber of matrix with serial test = $matrixno3; each includes $maxlist3 tests" -rm matrix.tmp - -# --------------------------------------------------------------------------- # -# 2. Divide and dump in subsets # -# --------------------------------------------------------------------------- # -# parallel jobs -count=0 - for i in `seq -f '%02g' 0 "$((matrixno1 - 1))"`; do -#echo $i -#Replace matrix.out > matrix?.out, model > model? - (( count = count + 1 )) - if [ -f "matrix${count}" ]; then rm -f matrix${count}; fi - cat before >> matrix$count - cat list_mpi_$i >> matrix$count - sed -i 's/'matrix.out'/'matrix${count}.out'/gI' matrix$count - sed -i 's/'model'/'model${count}'/gI' matrix$count - echo " echo ' '" >> matrix$count - echo " echo ' **************************************************************'" >> matrix$count - echo " echo ' * end of WAVEWATCH III matrix$count of regression tests *'" >> matrix$count - echo " echo ' **************************************************************'" >> matrix$count - echo " echo ' '" >> matrix$count - echo "rm -rf ${HOME}/model${count}" >> matrix$count -#make sure ../model$count does not exist and copy a fresh copy - awk '1;/cd/ && !x {print " cp -r ../model ../model'$count'"; x=1;}' matrix$count > tmpfile && mv tmpfile matrix$count - awk '1;/cd/ && !x {print " if [ -d ../model'${count}' ]; then rm -rf ../model'${count}'; fi"; x=1;}' matrix$count > tmpfile && mv tmpfile matrix$count - - echo " matrix$count prepared" - done - -# --------------------------------------------------------------------------- # - -# parallel jobs +OMP/OMPH - for i in `seq -f '%02g' 0 "$((matrixno2 - 1))"`; do -#echo $i -#Replace matrix.out > matrix?.out, model > model? - (( count = count + 1 )) - if [ -f "matrix${count}" ]; then rm -f matrix${count}; fi - cat before >> matrix$count - cat list_omp_$i >> matrix$count - sed -i 's/'matrix.out'/'matrix${count}.out'/gI' matrix$count - sed -i 's/'model'/'model${count}'/gI' matrix$count - echo " echo ' '" >> matrix$count - echo " echo ' **************************************************************'" >> matrix$count - echo " echo ' * end of WAVEWATCH III matrix$count of regression tests *'" >> matrix$count - echo " echo ' **************************************************************'" >> matrix$count - echo " echo ' '" >> matrix$count - echo "rm -rf ${HOME}/model${count}" >> matrix$count -#make sure ../model$count does not exist and copy a fresh copy - awk '1;/cd/ && !x {print " cp -r ../model ../model'$count'"; x=1;}' matrix$count > tmpfile && mv tmpfile matrix$count - awk '1;/cd/ && !x {print " if [ -d ../model'${count}' ]; then rm -rf ../model'${count}'; fi"; x=1;}' matrix$count > tmpfile && mv tmpfile matrix$count - - echo " matrix$count prepared" - done - -# --------------------------------------------------------------------------- # - -#serial jobs - for i in `seq -f '%02g' 0 "$((matrixno3 - 1))"`; do -#echo $i -#Replace matrix.out > matrix?.out, model > model? - (( count = count + 1 )) - if [ -f "matrix${count}" ]; then rm -f matrix${count}; fi - cat before >> matrix$count - cat list_serial_$i >> matrix$count - sed -i 's/'matrix.out'/'matrix${count}.out'/gI' matrix$count - sed -i 's/'model'/'model${count}'/gI' matrix$count - echo " echo ' '" >> matrix$count - echo " echo ' **************************************************************'" >> matrix$count - echo " echo ' * end of WAVEWATCH III matrix$count of regression tests *'" >> matrix$count - echo " echo ' **************************************************************'" >> matrix$count - echo " echo ' '" >> matrix$count - echo "rm -rf ${HOME}/model${count}" >> matrix$count -#make sure ../model$count does not exist and copy a fresh copy - awk '1;/cd/ && !x {print " cp -r ../model ../model'$count'"; x=1;}' matrix$count > tmpfile && mv tmpfile matrix$count - awk '1;/cd/ && !x {print " if [ -d ../model'${count}' ]; then rm -rf ../model'${count}'; fi"; x=1;}' matrix$count > tmpfile && mv tmpfile matrix$count - - echo " matrix$count prepared" - done - -# --------------------------------------------------------------------------- # - -#ww3_tp2.14 is separated, as it has dependency. -#ww3_tp2.17 and ww3_tp2.21 is separated, as it takes a long time to finish - (( count = count + 1 )) - if [ -f "matrix${count}" ]; then rm -f matrix${count}; fi - cat before >> matrix$count - cat list_heavy >> matrix$count - sed -i 's/'matrix.out'/'matrix${count}.out'/gI' matrix$count - sed -i 's/'model'/'model${count}'/gI' matrix$count - echo " echo ' '" >> matrix$count - echo " echo ' **************************************************************'" >> matrix$count - echo " echo ' * end of WAVEWATCH III matrix$count of regression tests *'" >> matrix$count - echo " echo ' **************************************************************'" >> matrix$count - echo " echo ' '" >> matrix$count - echo "rm -rf ${HOME}/model${count}" >> matrix$count -#make sure ../model$count does not exist and copy a fresh copy - awk '1;/cd/ && !x {print " cp -r ../model ../model'$count'"; x=1;}' matrix$count > tmpfile && mv tmpfile matrix$count - awk '1;/cd/ && !x {print " if [ -d ../model'${count}' ]; then rm -rf ../model'${count}'; fi"; x=1;}' matrix$count > tmpfile && mv tmpfile matrix$count - - echo " matrix$count prepared" - -# --------------------------------------------------------------------------- # - -#ncep operational tests including ww3_ufs and gfsv16 which require a large number of processor/esmf coupler and the ones for grib test are separated - (( count = count + 1 )) - if [ -f "matrix${count}" ]; then rm -f matrix${count}; fi - cat before >> matrix$count - sed -i 's/'n\ 24'/'n\ 140'/gI' matrix$count - cat list_ufs >> matrix$count - sed -i 's/'matrix.out'/'matrix${count}.out'/gI' matrix$count - sed -i 's/'model'/'model${count}'/gI' matrix$count - sed -i 's/'##SBATCH'/'#SBATCH'/gI' matrix$count - echo " echo ' '" >> matrix$count - echo " echo ' **************************************************************'" >> matrix$count - echo " echo ' * end of WAVEWATCH III matrix$count of regression tests *'" >> matrix$count - echo " echo ' **************************************************************'" >> matrix$count - echo " echo ' '" >> matrix$count - echo "rm -rf ${HOME}/model${count}" >> matrix$count -#make sure ../model$count does not exist and copy a fresh copy - awk '1;/cd/ && !x {print " cp -r ../model ../model'$count'"; x=1;}' matrix$count > tmpfile && mv tmpfile matrix$count - awk '1;/cd/ && !x {print " if [ -d ../model'${count}' ]; then rm -rf ../model'${count}'; fi"; x=1;}' matrix$count > tmpfile && mv tmpfile matrix$count - - echo " matrix$count prepared" - -# --------------------------------------------------------------------------- # - -rm before -rm list* - - echo "file matrix is divided into $count subsets ...." - -# --------------------------------------------------------------------------- # -# End to matrix_divider # -# --------------------------------------------------------------------------- # - diff --git a/regtests/bin/matrix_milhydro b/regtests/bin/matrix_milhydro index 1819084c4..8213b9b33 100755 --- a/regtests/bin/matrix_milhydro +++ b/regtests/bin/matrix_milhydro @@ -18,25 +18,28 @@ # No unauthorized use without permission. # # # # --------------------------------------------------------------------------- # -# 0. Environment file +usage () +{ + cat 2>&1 << EOF - source $(dirname $0)/../../model/bin/w3_setenv - main_dir=$WWATCH3_DIR - temp_dir=$WWATCH3_TMP - source=$WWATCH3_SOURCE - list=$WWATCH3_LIST + Usage: $myname model_dir + Required: + model_dir : path to model dir of WW3 source +EOF +} - echo "Main directory : $main_dir" - echo "Scratch directory : $temp_dir" - echo "Save source codes : $source" - echo "Save listings : $list" -# Compiler option. Choose appropriate compiler and set cmplOption to -# y if using for the first time or using a different compiler +# Get required arguments + if [ ! $# = 0 ] + then + main_dir="$1" ; shift + else + usage + exit 1 + fi -# cmplr=Gnu_matrix - cmplr=gnu - export cmplOption='y' +# Convert main_dir to absolute path + main_dir="`cd $main_dir 1>/dev/null 2>&1 && pwd`" # Set batchq queue, choose modules and other custom variables to fit system and # to define headers etc (default to original version if empty) @@ -49,8 +52,12 @@ echo ' ' >> matrix.head # Netcdf and Parmetis modules & variables + echo " export NetCDF_ROOT=/home/thesser/tools/GNU " >> matrix.head + echo " export METIS_PATH=/home/thesser/public/parmetis " >> matrix.head + echo " export PATH=/home/thesser/tools/cmake/bin:$PATH" >> matrix.head +echo " export path_build_root=$(dirname $main_dir)/regtests/buildmatrix" >> matrix.head + echo ' [[ -d ${path_build_root} ]] && rm -rf ${path_build_root}' >> matrix.head - echo " source $main_dir/bin/setpaths_milhydro3 " >> matrix.head echo ' ' if [ "$batchq" = 'slurm' ] @@ -63,12 +70,7 @@ export nr='0' export nth='0' # Compile option - if [ "$cmplOption" = 'y' ] - then - opt="-o all -c $cmplr -S -T" - else - opt="-o all -S" - fi + opt="-o netcdf -S -T -N" # Batch queue option if [ "$batchq" = 'slurm' ] then @@ -76,13 +78,12 @@ fi # Base run_test command line - export rtst="./bin/run_test $opt" + export rtst="./bin/run_cmake_test $opt" export ww3='../model' # 1.b Flags to do course selection - - - - - - - - - - - - - - - - - - - - - - # Addition selection by commenting out lines as below - export shrd='y' # Do shared architecture tests export dist='y' # Do distributed architecture (MPI) tests export omp='y' # Threaded (OpenMP) tests @@ -96,15 +97,15 @@ export shwtr='y' # shallow water tests export unstr='y' # unstructured grid tests export pdlib='y' # unstr with pdlib for domain decomposition and implicit solver - export smcgr='y' # SMC/Rotated grid test + export smcgr='y' # SMC grid test + export rtd='y' # Rotated pole test export mudice='y' # Mud/Ice and wave interaction tests export infgrv='y' # Second harmonic generation tests export uost='y' # ww3_ts4 Unresolved Obstacles Source Term (UOST) export assim='y' # Restart spectra update - export calendar='y' - export oasis='n' - export rtd='y' - export confignc='y' + export oasis='y' # Atmosphere, ocean, and ice coupling using OASIS + export calendar='y' # Calendar type + export confignc='y' # Configurable netCDF meta data (ww3_ounf) export multi01='y' # mww3_test_01 (wetting and drying) export multi02='y' # mww3_test_02 (basic two-way nesting test)) @@ -115,14 +116,14 @@ export multi07='y' # mww3_test_07 (unstructured grid tests) export multi08='y' # mww3_test_08 (wind and ice tests) export multi09='y' # mww3_test_09 (SMC multi grid test) + export ufs='n' # The Unified Forecast System export ufscoarse='n' # Option for small PCs export grib='n' # grib file field output - export rstrt_b4b='y' # Restart Reproducibility - export npl_b4b='y' # MPI task Reproducibility - export nth_b4b='y' # Thread Reproducibility + export rstrt_b4b='n' # Restart Reproducibility + export npl_b4b='n' # MPI task Reproducibility + export nth_b4b='n' # Thread Reproducibility export esmf='n' # ESMF coupling -# export filter='PR3 ST2 UQ' # The filter does a set of consecutinve greps on the # command lines generated by filter.base with the above # selected options. @@ -131,8 +132,22 @@ # 2. Execute matrix.base ... # # --------------------------------------------------------------------------- # + $main_dir/../regtests/bin/matrix.base + $main_dir/../regtests/bin/matrix_divider_cmake.sh + + + echo "#submit all of the diveded matrix files" > msuball.sh + if [ $batchq = "slurm" ] + then + files=`ls matrix??` + for file in $files + do + echo "sbatch < $file" >> msuball.sh + done + fi + # --------------------------------------------------------------------------- # # End to the matrix # # --------------------------------------------------------------------------- # diff --git a/regtests/bin/matrix_ncep b/regtests/bin/matrix_ncep index 6d5dbf5da..19ce9c5e1 100755 --- a/regtests/bin/matrix_ncep +++ b/regtests/bin/matrix_ncep @@ -9,9 +9,7 @@ # # # Hendrik L. Tolman # # August 2013 # -# December 2013 # -# April 2018 # -# March 2020 # +# Last update: May 2022 # # # # Copyright 2013 National Weather Service (NWS), # # National Oceanic and Atmospheric Administration. All rights # @@ -19,80 +17,76 @@ # No unauthorized use without permission. # # # # --------------------------------------------------------------------------- # -# 0. Environment file - source $(dirname $0)/../../model/bin/w3_setenv - main_dir=$WWATCH3_DIR - temp_dir=$WWATCH3_TMP - source=$WWATCH3_SOURCE - list=$WWATCH3_LIST +usage () +{ + cat 2>&1 << EOF - echo "Main directory : $main_dir" - echo "Scratch directory : $temp_dir" - echo "Save source codes : $source" - echo "Save listings : $list" + Usage: $myname model_dir + Required: + model_dir : path to model dir of WW3 source +EOF +} -# Compiler option. Choose appropriate compiler and set cmplOption to -# y if using for the first time or using a different compiler - cmplr=intel - export cmplOption='y' +# Get required arguments + if [ ! $# = 0 ] + then + main_dir="$1" ; shift + else + usage + exit 1 + fi + +# Convert main_dir to absolute path + main_dir="`cd $main_dir 1>/dev/null 2>&1 && pwd`" -# Set batchq queue, choose modules and other custom variables to fit system and +# Module Versions from HPC-Stack that are common for all platforms + modnetcdf='netcdf/4.7.4' + modjasper='jasper/2.0.25' + modzlib='zlib/1.2.11' + modpng='libpng/1.6.37' + modhdf5='hdf5/1.10.6' + modbacio='bacio/2.4.1' + modg2='g2/3.4.5' + modw3emc='w3emc/2.9.2' + modesmf='esmf/8.3.0b09' + +# Set batchq queue, choose modules and other custom variables to fit system and # to define headers etc (default to original version if empty) ishera=`hostname | grep hfe` isorion=`hostname | grep Orion` if [ $ishera ] then - # If no other h, assuming Hera - cmplr='hera.intel' + # If no other h, assuming Hera batchq='slurm' - hpcstackpath='/scratch1/NCEPDEV/nems/role.epic/hpc-stack/libs/intel-2022.1.2/modulefiles/stack' - hpcstackversion='hpc/1.2.0' basemodcomp='intel/2022.1.2' basemodmpi='impi/2022.1.2' + hpcstackpath='/scratch1/NCEPDEV/nems/role.epic/hpc-stack/libs/intel-2022.1.2/modulefiles/stack' + hpcstackversion='hpc/1.2.0' modcomp='hpc-intel/2022.1.2' modmpi='hpc-impi/2022.1.2' - modnetcdf='netcdf/4.7.4' - metispath='/scratch2/STI/coastal/save/Ali.Abdolali/hpc-stack/parmetis-4.0.3' - scotchpath='/scratch2/STI/coastal/save/Ali.Abdolali/hpc-stack/scotch/install' - modjasper='jasper/2.0.25' - modzlib='zlib/1.2.11' - modpng='libpng/1.6.37' - modhdf5='hdf5/1.10.6' - modbacio='bacio/2.4.1' - modg2='g2/3.4.5' - modw3emc='w3emc/2.9.2' - modesmf='esmf/8.3.0b09' - metispath='/scratch2/STI/coastal/save/Ali.Abdolali/hpc-stack/parmetis-4.0.3' + scotchpath='/scratch1/NCEPDEV/climate/Matthew.Masarik/waves/opt/hpc-stack/scotch-v7.0.3/install' + metispath='/scratch1/NCEPDEV/climate/Matthew.Masarik/waves/opt/hpc-stack/parmetis-4.0.3/install' modcmake='cmake/3.20.1' elif [ $isorion ] then - cmplr='orion.intel' batchq='slurm' + basemodcomp='intel/2022.1.2' + basemodmpi='impi/2022.1.2' hpcstackpath='/work/noaa/epic-ps/hpc-stack/libs/intel/2022.1.2/modulefiles/stack' hpcstackversion='hpc/1.2.0' modcomp='hpc-intel/2022.1.2' modmpi='hpc-impi/2022.1.2' - modnetcdf='netcdf/4.7.4' - metispath='/work/noaa/marine/ali.abdolali/Source/hpc-stack/parmetis-4.0.3' - scotchpath='/work/noaa/marine/ali.abdolali/Source/hpc-stack/scotch/install' - modjasper='jasper/2.0.25' - modzlib='zlib/1.2.11' - modpng='libpng/1.6.37' - modhdf5='hdf5/1.10.6' - modbacio='bacio/2.4.1' - modg2='g2/3.4.5' - modw3emc='w3emc/2.9.2' - modesmf='esmf/8.3.0b09' - metispath='/work/noaa/marine/ali.abdolali/Source/hpc-stack/parmetis-4.0.3' + scotchpath='/work2/noaa/marine/mmasarik/waves/opt/hpc-stack/scotch-v7.0.3/install' + metispath='/work2/noaa/marine/mmasarik/waves/opt/hpc-stack/parmetis-4.0.3/install' modcmake='cmake/3.22.1' else batchq= fi # 1. Set up - + export np='24' #number of mpi tasks export npl='140' #number of mpi tasks for ufs applications and large setups export npl1='100' #number of mpi tasks for ufs/large setups (b4b check) @@ -114,7 +108,13 @@ echo '#SBATCH -J ww3_regtest' >> matrix.head echo '#SBATCH -o matrix.out' >> matrix.head echo '#SBATCH -p orion' >> matrix.head + echo '#SBATCH --exclusive' >> matrix.head + echo ' ' >> matrix.head echo 'ulimit -s unlimited' >> matrix.head + echo 'ulimit -c 0' >> matrix.head + echo 'export KMP_STACKSIZE=2G' >> matrix.head + echo 'export FI_OFI_RXM_BUFFER_SIZE=128000' >> matrix.head + echo 'export FI_OFI_RXM_RX_SIZE=64000' >> matrix.head elif [ $batchq = "slurm" ] then echo "#SBATCH -n ${np}" >> matrix.head @@ -139,35 +139,32 @@ # Netcdf, Parmetis and SCOTCH modules & variables echo " module purge" >> matrix.head - echo " module use $hpcstackpath" >> matrix.head - echo " module load $hpcstackversion" >> matrix.head + echo " module load $modcmake" >> matrix.head if [ ! -z $basemodcomp ]; then echo " module load $basemodcomp" >> matrix.head fi if [ ! -z $basemodmpi ]; then echo " module load $basemodmpi" >> matrix.head fi + echo " module use $hpcstackpath" >> matrix.head + echo " module load $hpcstackversion" >> matrix.head echo " module load $modcomp" >> matrix.head echo " module load $modmpi" >> matrix.head - echo " module load $modnetcdf" >> matrix.head - echo " module load $modjasper" >> matrix.head - echo " module load $modzlib" >> matrix.head echo " module load $modpng" >> matrix.head + echo " module load $modzlib" >> matrix.head + echo " module load $modjasper" >> matrix.head echo " module load $modhdf5" >> matrix.head + echo " module load $modnetcdf" >> matrix.head echo " module load $modbacio" >> matrix.head echo " module load $modg2" >> matrix.head echo " module load $modw3emc" >> matrix.head echo " module load $modesmf" >> matrix.head - echo ' export NETCDF_CONFIG=$NETCDF_ROOT/bin/nc-config' >> matrix.head echo " export METIS_PATH=${metispath}" >> matrix.head echo " export SCOTCH_PATH=${scotchpath}" >> matrix.head - echo ' export JASPER_LIB=$JASPER_ROOT/lib64/libjasper.a' >> matrix.head - echo ' export PNG_LIB=$PNG_ROOT/lib64/libpng.a' >> matrix.head - echo ' export Z_LIB=$ZLIB_ROOT/lib/libz.a' >> matrix.head - echo ' export ESMFMKFILE=$ESMF_LIB/esmf.mk' >> matrix.head - echo " export WW3_PARCOMPN=4" >> matrix.head - echo ' ' + echo " export path_build_root=$(dirname $main_dir)/regtests/buildmatrix" >> matrix.head + echo ' [[ -d ${path_build_root} ]] && rm -rf ${path_build_root}' >> matrix.head + echo ' ' if [ "$batchq" = 'slurm' ] then @@ -177,12 +174,8 @@ fi # Compile option - if [ "$cmplOption" = 'y' ] - then - opt="-o all -c $cmplr -S -T" - else - opt="-o all -S" - fi + opt="-o all -S -T" + # Batch queue option if [ "$batchq" = 'slurm' ] then @@ -190,7 +183,7 @@ fi # Base run_test command line - export rtst="./bin/run_test $opt" + export rtst="./bin/run_cmake_test $opt" export ww3='../model' @@ -212,7 +205,7 @@ export pdlib='y' # unstr with pdlib for domain decomposition and implicit solver export smcgr='y' # SMC grid test export rtd='y' # Rotated pole test - export mudice='y' # Mud/Ice and wave interaction tests + export mudice='y' # Mud/Ice and wave interaction tests export infgrv='y' # Second harmonic generation tests export uost='y' # ww3_ts4 Unresolved Obstacles Source Term (UOST) export assim='y' # Restart spectra update @@ -238,30 +231,29 @@ export nth_b4b='y' # Thread Reproducibility export esmf='n' # ESMF coupling # export filter='PR3 ST2 UQ' - # The filter does a set of consecutive greps on the + # The filter does a set of consecutive greps on the # command lines generated by filter.base with the above # selected options. # --------------------------------------------------------------------------- # # 2. Execute matrix.base ... # # --------------------------------------------------------------------------- # - + $main_dir/../regtests/bin/matrix.base - $main_dir/../regtests/bin/matrix_divider_p.sh + $main_dir/../regtests/bin/matrix_divider_cmake.sh echo "#submit all of the diveded matrix files" > msuball.sh - if [ $batchq = "slurm" ] + if [ $batchq = "slurm" ] then - files=`ls matrix? matrix??` - for file in $files + files=`ls matrix??` + for file in $files do echo "sbatch < $file" >> msuball.sh done - fi + fi - # --------------------------------------------------------------------------- # # End to the matrix # # --------------------------------------------------------------------------- # diff --git a/regtests/bin/matrix_ukmo_cray b/regtests/bin/matrix_ukmo_cray index e49890ef2..fc6cf64b9 100755 --- a/regtests/bin/matrix_ukmo_cray +++ b/regtests/bin/matrix_ukmo_cray @@ -2,6 +2,8 @@ # --------------------------------------------------------------------------- # # matrix_ukmo_cray: Run matrix of regression tests on Cray XC architecture # # as currently used at the UK Met Office. # +# +# This version runs the CMake compilation version # # # Remarks: # # Currently, programs using the PDLIB switch (METIS library) crash when # @@ -9,12 +11,10 @@ # it is required to use the GNU compiler. # # # # Chris Bunney # -# April 2019 # +# April 2022 # # # # Hendrik L. Tolman # # August 2013 # -# December 2013 # -# April 2018 # # # # Copyright 2013 National Weather Service (NWS), # # National Oceanic and Atmospheric Administration. All rights # @@ -24,16 +24,31 @@ # --------------------------------------------------------------------------- # # 0. Environment file - source $(dirname $0)/../../model/bin/w3_setenv - main_dir=$WWATCH3_DIR - temp_dir=$WWATCH3_TMP - source=$WWATCH3_SOURCE - list=$WWATCH3_LIST - echo "Main directory : $main_dir" - echo "Scratch directory : $temp_dir" - echo "Save source codes : $source" - echo "Save listings : $list" +usage () +{ + cat 2>&1 << EOF + + Usage: $myname model_dir + Required: + model_dir : path to model dir of WW3 source +EOF +} + + +# Get required arguments + if [ ! $# = 0 ] + then + main_dir="$1" ; shift + else + usage + exit 1 + fi + +# Convert main_dir to absolute path + main_dir="`cd $main_dir 1>/dev/null 2>&1 && pwd`" + + # Set Cray compiler variant: CCE (Cray Compiler Environment) or GNU. # - ukmo_cray[_debug] : Cray Fortan (Cray Compiler Environment) @@ -87,27 +102,24 @@ else exit 1 fi -# SNP Launcher 7.7.4 allows -np switch: - echo " module load cray-snplauncher/7.7.4" >> matrix.head - - echo " export NETCDF_CONFIG=\$(which nc-config)" >> matrix.head +# Need newer cmake version on the XC + echo "module load cmake/3.21.3" >> matrix.head -# Compiler option. Set cmplOption to -# y if using for the first time or using a different compiler +# SNP Launcher 7.7.4 allows -np switch: + echo "module load cray-snplauncher/7.7.4" >> matrix.head + echo "export NETCDF_CONFIG=\$(which nc-config)" >> matrix.head - export cmplOption='y' +# On the Cray XC, we need to stop CMake from searching for +# the NetCDF libraries - they are provided by the ftn wrapper. + echo "export CMAKE_OPTIONS=-DEXCLUDE_FIND=\"netcdf\"" >> matrix.head +# Resources: export mpi='mpiexec' export np='16' export nr='4' export nth='4' - if [ "$cmplOption" = 'y' ] - then - export rtst="./bin/run_test -o both -c $cmplr -S" - else - export rtst="./bin/run_test -o both -S" - fi + export rtst="./bin/run_cmake_test -o both -S" export ww3='../model' @@ -164,6 +176,8 @@ fi $main_dir/../regtests/bin/matrix.base + $main_dir/../regtests/bin/matrix_divider_cmake.sh + # --------------------------------------------------------------------------- # # End to the matrix # # --------------------------------------------------------------------------- # diff --git a/regtests/bin/run_cmake_test b/regtests/bin/run_cmake_test deleted file mode 100755 index bcedb89c9..000000000 --- a/regtests/bin/run_cmake_test +++ /dev/null @@ -1,2359 +0,0 @@ -#!/bin/bash -# --------------------------------------------------------------------------- # -# # -# Script for running WW3 tests. # -# # -# Last update : 21-Apr-2023 # -# --------------------------------------------------------------------------- # -# Modification history -# 27-Jan-2014 : Adapts ww3_ounf section for multigrid ( version 4.18 ) -# 04-May-2020 : F. Ardhuin added step 3.b2 for CDL input files ( version 7.12 ) -# 20-Apr-2021 : A. Abdolali added ww3_grib bulid and execution ( version 7.12 ) -# 21-May-2021 : C. Bunney add support for ALPS job placement ( version 7.12 ) -# -# Limitations: -# - For each ww3_grid_*.inp, run_test process *all* ww3_prep_*.inp files. -# For example, when processing ww3_grid_1.inp, it does not know that -# it needs to process ww3_prep_a.inp and *not* process ww3_prep_b.inp. -# This can be addressed in the future by adding instructions for prep -# to the grdset file. -# - When running through ww3_prep, run_test is not smart enough to process -# multiple input files of the same type. For example, for wind it wants -# a file ww3_prep_wind.inp and does not know what to do if you have two -# files, ww3_prep_wind_hwna_15m.inp and ww3_prep_wind_gfs_30m.inp. -# It needs to rename wind.ww3 as wind.wind_gfs_30m, for example, but -# looks for wind_gfs_30m.ww3 where it should look for wind.ww3. Another -# loop is needed to make this work. - -# --------------------------------------------------------------------------- # -# 1. Function definitions # -# --------------------------------------------------------------------------- # - -# 1.a Error message function -errmsg () -{ - echo "" 2>&1 - while [ $# != 0 ] - do - echo "ERROR: $1" 2>&1 - shift - done - echo "" 2>&1 -} - -# 1.b Usage function -myname="`basename $0`" #name of script -optstr="b:C:dfg:hi:m:n:No:Op:q:r:s:t:STw:" #option string for getopt function -usage () -{ - -cat 2>&1 << EOF - -Usage: $myname [options] source_dir test_name -Required: - source_dir : path to top-level of WW3 source - test_name : name of test case (directory) -Options: - -b batchq : optional setting to determine batch queue type (slurm or alps) - -C coupl : invoke test using coupled application - : OASIS : OASIS3-mct ww3_shel coupled application - : ESMF : ESMF ww3_multi coupled application - -d : invoke main program using gdb (non-parallel) - -f : force pre- and post-processing programs to be compiled - : non-MPI (i.e., with SHRD switch); default is all programs - : compiled with unmodified switch settings - -g grid_string : use ww3_grid_.inp - -h : print usage and exit - -i inpdir : use inputs in test_name/ (default test_name/input) - -m grid_set : execute multi-model test - : *grid names are obtained from input/ - : *ww3_multi_ will execute instead of ww3_shel - : *to execute a single model test case with ww3_multi use - : grid_set = none - -n nproc : specify processors for parallel run - : *some programs do not require - : *ignored if -p or -O is not specified - -N : use namelist (.nml) input instead of .inp (if available) - -o outopt : limit output post-processing based on - : native : post-process only native output - : netcdf : post-process only NetCDF output - : both : post-process both native and NetCDF output - : grib : post-process only GRIB2 output - : all : post-process in native, NetCDF and GRIB2 formats - : * default is native - : * note that required input files must be present for - : selected output post-processing to occur - -O : parallel run using OpenMP paradigm and OMP_NUM_THREADS - environment variable and number of processors defined with - the -n np option - -p runcmd : run in parallel using to start program - : *MPICH or OpenMPI: mpirun or mpiexec (default = 1) - : *IBM with Loadleveler: poe (no required) - : *LSF: mpirun.lsf (no required) - -q program : exit script after program executes - -r program : only execute program - -s switch_string : use switch_ - -S : create stub file . with end data and time. - tests not executed if file is found. - -t nthrd : Threading option. (this is system dependant and can be used - : only for the hybrid option) - -T : Run w3_make under time command to create compile-time metric - -w work_dir : run test case in test_name/work_dir (default test_name/work) - -EOF -} - - -# --------------------------------------------------------------------------- # -# 2. Preparations # -# --------------------------------------------------------------------------- # - -echo ' ' -echo " Running now options: run_test $*" -echo ' ' - -# 2.a Setup array of command-line arguments -args=`getopt $optstr $*` -if [ $? != 0 ] -then - usage - exit 1 -fi -set -- $args - -ARGS=$args - -# 2.b Process command-line options -exit_p=none -exec_p=none -batchq=none -multi=0 -dist=0 -inpdir=input -outopt=native -coupl=none -batchq=none -while : -do - case "$1" in - -b) shift; batchq="$1" ;; - -C) shift; coupl="$1" ;; - -d) use_gdb=1 ;; - -e) prompt=1 ;; - -f) force_shrd=1 ;; - -g) shift; grdstr="$1" ;; - -h) help=1 ;; - -i) shift; inpdir="$1" ;; - -m) shift; grdset="$1" ; - if [ $grdset = none ] - then - multi=1 - else - multi=2 - fi ;; - -n) shift; nproc="$1" ;; - -N) nml_input=1 ;; - -o) shift; outopt="$1" ;; - -O) pomp=1 ;; - -p) shift; runcmd="$1" ; pmpi=1 ;; - -q) shift; exit_p="$1" ;; - -r) shift; exec_p="$1" ;; - -s) shift; swtstr="$1" ;; - -S) stub=1 ;; - -t) shift; nthrd="$1" ;; - -T) time_count=1 ;; - -w) shift; wrkdir="$1" ;; - --) break ;; - esac - shift -done -shift #remove the trailing -- -if [ $help ] -then - usage - exit 1 -fi -#uncomment next line to add S & T switches to every test -#testST=1 -if [ ! $exec_p = "none" ] -then - exit_p=$exec_p -fi -case $outopt in - native|netcdf|both|grib|all) ;; - *) errmsg "outopt = $outopt not supported" ; usage ; exit 1 ;; -esac -case $coupl in - none) ;; - OASIS) - if [ $multi -ne 0 ] - then - errmsg "coupl = $coupl with ww3_multi is not supported" - usage - exit 1 - fi - ;; - ESMF) - if [ $multi -eq 0 ] - then - errmsg "coupl = $coupl with ww3_shel is not supported" - usage - exit 1 - fi - if [ -z "$ESMFMKFILE" ] - then - errmsg "ESMFMKFILE must be defined with coupl = $coupl" - usage - exit 1 - fi - ;; - *) errmsg "coupl = $coupl not supported" ; usage ; exit 1 ;; -esac - -# 2.c Get required arguments -if [ ! $# = 0 ] -then - path_s="$1" ; shift -else - usage - exit 1 -fi -if [ ! $# = 0 ] -then - testnm="$1" ; shift -else - usage - exit 1 -fi - -# 2.d Convert source path from "relative" to "absolute" -if [ ! -d $path_s ] -then - errmsg "$path_s not found" - usage - exit 1 -fi -path_s="`cd $path_s 1>/dev/null 2>&1 && pwd`" - -# 2.e Path to test directory -path_t="`pwd`/$testnm" -if [ ! -d $path_t ] -then - errmsg "$path_t not found" - usage - exit 1 -fi - -# 2.f Path to input files -path_i="$path_t/$inpdir" -if [ ! -d $path_i ] -then - errmsg "$path_i not found" - usage - exit 1 -fi - -# 2.g Path to working directory -if [ $wrkdir ] -then - path_w="$path_t/$wrkdir" -else - path_w="$path_t/work" -fi - -# 2.h Paths to source subdirectories -path_a="$path_s/tools" -path_b="$path_s/bin" -if [ ! -d $path_a ] -then - errmsg "$path_a not found" - exit 1 -fi -if [ ! -d $path_b ] -then - errmsg "$path_b not found" - exit 1 -fi - -# 2.i Check for switch file -if [ $swtstr ] -then - file_c="$path_i/switch_$swtstr" -else - file_c="$path_i/switch" -fi - -if [ ! -f $file_c ] -then - errmsg "switch file $file_c not found" - exit 1 -fi - -# 2.j If parallel execution, then check for proper switches -# Also, set default run command -if [ $pmpi ] -then - if [ "`grep MPI $file_c`" ] - then : - else - errmsg "Improper switch setup for MPI run" - exit 1 - fi -else - if [ $use_gdb ] - then - runcmd='gdb' - else - runcmd='' - fi -fi - -if [ $pomp ] -then - if [ "`grep OMP $file_c`" ] - then : - else - errmsg "Improper switch setup for OpenMP run" - exit 1 - fi -fi - -# 2.k Setup for multi-model (and defaults for non-multi-model) -gu="" -if [ $multi -eq 2 ] -then - if [ -f $path_i/$grdset ] - then - model_grids="`awk '/^MODEL:/' $path_i/$grdset | sed 's/MODEL\://'`" - input_grids="`awk '/^INPUT:/' $path_i/$grdset | sed 's/INPUT\://'`" - point_grids="`awk '/^POINT:/' $path_i/$grdset | sed 's/POINT\://'`" - intgl_grids="`awk '/^INTGL:/' $path_i/$grdset | sed 's/INTGL\://'`" - if [ `grep -o 'RSTGL' $path_i/$grdset` ] - then - rstgl_grids="`awk '/^RSTGL:/' $path_i/$grdset | sed 's/RSTGL\://'`" - rstgl_gint="true" - else - rstgl_grids="" - rstgl_gint="false" - fi - else - errmsg "grid_set file $path_i/$grdset not found" - exit 1 - fi -else - model_grids="none" - input_grids="none" - point_grids="none" - intgl_grids="none" - rstgl_grids="none" - rstgl_gint="false" -fi -all_grids=$model_grids -for g in $input_grids $point_grids $intgl_grids $rstgl_grids -do - if [ -z "`echo $all_grids | grep $g`" ] - then - all_grids="$all_grids $g" - fi -done -# 2.m Initialize time counter if time_count option -if [ $time_count ] -then # Add time counter if -T - cumult_comp=0 - cumult_run=0 -fi - - -mkdir -p $path_w - -cd $path_w - -if [ $stub ] && [ -f finished ] -then - echo " Test already finished, skipping ..." - echo ' ' - exit 0 -fi - -if [ $time_count ] -then # Add time counter if -T - echo " REGTESTS Time counter: run_test $ARGS" >> time_count.txt - Tstart=`date +"%s.%2N"` -fi - -# --------------------------------------------------------------------------- # -# Build all executables -# --------------------------------------------------------------------------- # - -if [ $multi -eq 0 ] && [ $coupl = "OASIS" ] -then - ww3_dir=${path_s}/.. - if $path_i/prep_env.sh $path_i $path_w $swtstr $ww3_dir - then : - else - errmsg "Error occured during WW3 $prog build" - exit 1 - fi - export OASISDIR=$path_w/work_oasis3-mct -fi - -cd $path_s -cd ../ -path_cmake="`pwd`" - -path_e=$path_w/exe -mkdir -p $path_e - -ofile=$path_w/build.log - -echo " Building WW3, exes will be in $path_e" - -echo "Exe directory is $path_e" > $ofile -path_build_root=${path_build_root:-$path_w/build} -if [ $force_shrd ] -then - - # build pre- & post-processing programs with SHRD only - echo "Forcing a SHRD build" >> $ofile - path_build=${path_build_root}_SHRD - mkdir -p $path_build - cd $path_build - if [[ "$outopt" = "all" ]] || [[ "$outopt" = "grib" ]] ; - then - cat $file_c | sed 's/DIST/SHRD/' | sed 's/MPI //' | \ - sed 's/OMPG //' | sed 's/NOGRB/NCEP2/' | \ - sed 's/OMPH //' | sed 's/PDLIB //' | \ - sed 's/B4B //' | sed 's/METIS //' | \ - sed 's/SCOTCH //' > $path_build/switch - else - cat $file_c | sed 's/DIST/SHRD/' | sed 's/MPI //' | \ - sed 's/OMPG //' | \ - sed 's/OMPH //' | sed 's/PDLIB //' | \ - sed 's/B4B //' | sed 's/METIS //' | \ - sed 's/SCOTCH //' > $path_build/switch - fi - - echo "Switch file is $path_build/switch with switches:" >> $ofile - cat $path_build/switch >> $ofile - cmake $path_cmake ${CMAKE_OPTIONS} -DSWITCH=$path_build/switch -DCMAKE_INSTALL_PREFIX=install > $ofile 2>&1 - rc=$? - if [[ $rc -ne 0 ]] ; then - echo "Fatal error in cmake." - echo "The build log is in $ofile" - exit - fi - make -j 8 > $ofile 2>&1 - rc=$? - if [[ $rc -ne 0 ]] ; then - echo "Fatal error in make." - echo "The build log is in $ofile" - exit - fi - make install > $ofile 2>&1 - if [[ $rc -ne 0 ]] ; then - echo "Fatal error in make install." - echo "The build log is in $ofile" - exit - fi - - cp $path_build/install/bin/* $path_e/ - - if [ $pomp ] || [ $nproc ] - then - echo "non-SHRD build" >> $ofile - #build without SHRD - path_build=${path_build_root} - mkdir -p $path_build - cd $path_build - \cp -f $file_c $path_build/switch - echo "Switch file is $path_build/switch with switches:" >> $ofile - cat $path_build/switch >> $ofile - cmake $path_cmake ${CMAKE_OPTIONS} -DSWITCH=$path_build/switch -DCMAKE_INSTALL_PREFIX=install > $ofile 2>&1 - rc=$? - if [[ $rc -ne 0 ]] ; then - echo "Fatal error in cmake." - echo "The build log is in $ofile" - exit - fi - make -j 8 > $ofile 2>&1 - if [[ $rc -ne 0 ]] ; then - echo "Fatal error in make." - echo "The build log is in $ofile" - exit - fi - make install > $ofile 2>&1 - if [[ $rc -ne 0 ]] ; then - echo "Fatal error in make install." - echo "The build log is in $ofile" - exit - fi - path_e=$path_w/exe - cp $path_build/install/bin/ww3_shel $path_e/ - cp $path_build/install/bin/ww3_multi $path_e/ - cp $path_build/install/bin/ww3_systrk $path_e/ - cp $path_build/install/bin/ww3_prtide $path_e/ - fi -else - path_build=${path_build_root} - mkdir -p $path_build - cd $path_build - if [[ "$outopt" = "all" ]] || [[ "$outopt" = "grib" ]] ; - then - cat $file_c | sed 's/NOGRB/NCEP2/' > $path_build/switch - else - \cp -f $file_c $path_build/switch - fi - echo "Switch file is $path_build/switch with switches:" >> $ofile - cat $path_build/switch >> $ofile - cmake $path_cmake ${CMAKE_OPTIONS} -DSWITCH=$path_build/switch -DCMAKE_INSTALL_PREFIX=install > $ofile 2>&1 - rc=$? - if [[ $rc -ne 0 ]] ; then - echo "Fatal error in cmake." - echo "The build log is in $ofile" - exit - fi - make -j 8 > $ofile 2>&1 - if [[ $rc -ne 0 ]] ; then - echo "Fatal error in make." - echo "The build log is in $ofile" - exit - fi - make install > $ofile 2>&1 - if [[ $rc -ne 0 ]] ; then - echo "Fatal error in make install." - echo "The build log is in $ofile" - exit - fi - - cp $path_build/install/bin/* $path_e/ - -fi -echo " Build log is in $ofile" - -if [ $time_count ] -then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - cumult_comp=`echo "$Maketime + $cumult_comp" | bc` - printf "\n %8.2f sec compile time" $Maketime >> time_count.txt -fi - -# --------------------------------------------------------------------------- # -# 3. Execute Test # -# --------------------------------------------------------------------------- # -# 3.a Go to work directory and clean-up -cd $path_w -if [ $exec_p = "none" ] -then - ncfiles=`\ls *.nc 2>/dev/null | grep -v rmp_` - if [ ! $stub ] - then - # restart, nest, etc. may have been placed there manually, so don't remove them - \rm -f *.inp *.out *.txt $ncfiles finished - \ls *.ww3 2>/dev/null | grep -v 'restart.ww3' | grep -v 'nest.ww3' | grep -v 'wind.ww3' | grep -v 'ice.ww3' | grep -v 'ice1.ww3' | xargs \rm 2>/dev/null - fi -fi - -# 3.b Header -echo ' ' ; echo ' ' -echo ' ================================== ' -echo ' ======> TEST RUN WAVEWATCH III <====== ' -echo ' ================================== ' -echo ' ' -if [ -f $path_t/info ] -then - cat $path_t/info -fi -echo ' ' -echo " Input directory: $path_i" -echo " Switch file: $file_c" -echo ' ' - -# 3.b2 Preprocess cdl files into nc files ----------------------------------- # - -for f in $(find $path_i/ -type f -name "*.cdl") -do - echo "Converting $f to NetCDF" - # take action on each file. Note that converted file is in $path_w - ncgen -b $f -done - -# 3.c Grid pre-processor ---------------------------------------------------- # - -prog=ww3_grid -if [ $exec_p = $prog -o $exec_p = "none" ] -then - - echo ' ' - echo '+--------------------+' - echo '| Grid preprocessor |' - echo '+--------------------+' - echo ' ' - - for g in $all_grids - do - - if [ $multi -eq 2 ] - then - gu="_$g" - fi - - if [ $grdstr ] - then - fileconf="${prog}_${grdstr}${gu}" - else - fileconf="${prog}${gu}" - fi - - # select inp/nml files - if [ $nml_input ] && [ ! -z "`ls ${path_i}/${fileconf}.nml 2>/dev/null`" ] - then - ifile="`ls ${path_i}/${fileconf}.nml 2>/dev/null`" - else - ifile="`ls $path_i/${fileconf}.inp 2>/dev/null`" - fi - - - if [ ! -f $path_e/$prog ] - then - errmsg "$path_e/$prog not found" - exit 1 - fi - if [ ! -f $ifile ] - then - errmsg "$ifile not found" - exit 1 - fi - - # link conf file - if [ $nml_input ] && [ ! -z "`echo ${ifile} | grep -o nml`" ] - then - \rm -f $prog.nml - \ln -s $ifile $prog.nml - ofile="$path_w/`basename $ifile .nml`.out" - else - \rm -f $prog.inp - \ln -s $ifile $prog.inp - ofile="$path_w/`basename $ifile .inp`.out" - fi - - echo " Processing $ifile" - echo " Screen output routed to $ofile" - - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - if $path_e/$prog > $ofile - then - \rm -f $prog.inp - \rm -f $prog.nml - if [ $multi -eq 2 ] - then - mv mod_def.ww3 mod_def.$g - if [ $nml_input ] && [ ! -z "`echo ${ifile} | grep -o nml`" ] - then - mv $prog.nml.log ${prog}_$g.nml.log - fi - fi - else - errmsg "Error occured during $path_e/$prog execution" - exit 1 - fi - - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt - fi - - done - -fi - -if [ $exit_p = $prog ] -then - exit -fi - -# 3.d Initial conditions ---------------------------------------------------- # - -prog=ww3_strt -if [ $exec_p = $prog -o $exec_p = "none" ] -then - -# select inp/nml files - if [ $nml_input ] && [ ! -z "`ls ${path_i}/${prog}.nml 2>/dev/null`" ] - then - ifile="`ls ${path_i}/${prog}.nml 2>/dev/null`" - else - ifile="`ls $path_i/$prog.inp 2>/dev/null`" - fi - - if [ $? = 0 ] - then - - echo ' ' - echo '+--------------------+' - echo '| Initial conditions |' - echo '+--------------------+' - echo ' ' - - if [ ! -f $path_e/$prog ] - then - errmsg "$path_e/$prog not found" - exit 1 - fi - - for g in $model_grids - do - - if [ $multi -eq 2 ] - then - gu="_$g" - fi - - # link conf file - if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] - then - \rm -f $prog.nml - \ln -s $ifile $prog.nml - ofile="$path_w/`basename $ifile .nml`${gu}.out" - else - \rm -f $prog.inp - \ln -s $ifile $prog.inp - ofile="$path_w/`basename $ifile .inp`${gu}.out" - fi - - echo " Processing $ifile" - echo " Screen output routed to $ofile" - - if [ $multi -eq 2 ] - then - \rm -f mod_def.ww3 - \ln -s mod_def.$g mod_def.ww3 - fi - - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - if $path_e/$prog > $ofile - then - \rm -f $prog.inp - \rm -f $prog.nml - if [ $multi -eq 2 ] - then - mv restart.ww3 restart.$g - \rm -f mod_def.ww3 - if [ $nml_input ] && [ ! -z "`echo ${ifile} | grep -o nml`" ] - then - mv $prog.nml.log ${prog}_$g.nml.log - fi - fi - else - errmsg "Error occured during $path_e/$prog execution" - exit 1 - fi - - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt - fi - - done - - fi - -fi - -if [ $exit_p = $prog ] -then - exit -fi - -# 3.d.1 boundary conditions -------------------------------------------------- # - -prog=ww3_bound -if [ $exec_p = $prog -o $exec_p = "none" ] -then - -# select inp/nml files - if [ $nml_input ] && [ ! -z "`ls ${path_i}/${prog}.nml 2>/dev/null`" ] - then - ifile="`ls ${path_i}/${prog}.nml 2>/dev/null`" - else - ifile="`ls $path_i/$prog.inp 2>/dev/null`" - fi - - if [ $? = 0 ] - then - - echo ' ' - echo '+---------------------+' - echo '| Boundary conditions |' - echo '+---------------------+' - echo ' ' - - if [ ! -f $path_e/$prog ] - then - errmsg "$path_e/$prog not found" - exit 1 - fi - - for g in $model_grids - do - if [ $multi -eq 2 ] - then - gu="_$g" - fi - - # link conf file - if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] - then - \rm -f $prog.nml - \ln -s $ifile $prog.nml - ofile="$path_w/`basename $ifile .nml`${gu}.out" - else - \rm -f $prog.inp - \ln -s $ifile $prog.inp - ofile="$path_w/`basename $ifile .inp`${gu}.out" - fi - - echo " Processing $ifile" - echo " Screen output routed to $ofile" - - if [ $multi -eq 2 ] - then - \rm -f mod_def.ww3 - \ln -s mod_def.$g mod_def.ww3 - fi - - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - if $path_e/$prog > $ofile - then - \rm -f $prog.inp - \rm -f $prog.nml - if [ $multi -eq 2 ] - then - mv nest.ww3 nest.$g - \rm -f mod_def.ww3 - if [ $nml_input ] && [ ! -z "`echo ${ifile} | grep -o nml`" ] - then - mv $prog.nml.log ${prog}_$g.nml.log - fi - fi - else - errmsg "Error occured during $path_e/$prog execution" - exit 1 - fi - - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt - fi - - done - - fi - -fi - -if [ $exit_p = $prog ] -then - exit -fi - -# 3.d.2 boundary conditions -------------------------------------------------- # - -prog=ww3_bounc -if [ $exec_p = $prog -o $exec_p = "none" ] -then - -# select inp/nml files - if [ $nml_input ] && [ ! -z "`ls ${path_i}/${prog}.nml 2>/dev/null`" ] - then - ifile="`ls ${path_i}/${prog}.nml 2>/dev/null`" - else - ifile="`ls $path_i/$prog.inp 2>/dev/null`" - fi - - if [ $? = 0 ] - then - - echo ' ' - echo '+---------------------+' - echo '| Boundary conditions |' - echo '+---------------------+' - echo ' ' - - if [ ! -f $path_e/$prog ] - then - errmsg "$path_e/$prog not found" - exit 1 - fi - - for g in $model_grids - do - if [ $multi -eq 2 ] - then - gu="_$g" - fi - - # link conf file - if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] - then - \rm -f $prog.nml - \ln -s $ifile $prog.nml - ofile="$path_w/`basename $ifile .nml`${gu}.out" - else - \rm -f $prog.inp - \ln -s $ifile $prog.inp - ofile="$path_w/`basename $ifile .inp`${gu}.out" - fi - - echo " Processing $ifile" - echo " Screen output routed to $ofile" - - if [ $multi -eq 2 ] - then - \rm -f mod_def.ww3 - \ln -s mod_def.$g mod_def.ww3 - fi - - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - if $path_e/$prog > $ofile - then - \rm -f $prog.inp - \rm -f $prog.nml - if [ $multi -eq 2 ] - then - mv nest.ww3 nest.$g - \rm -f mod_def.ww3 - if [ $nml_input ] && [ ! -z "`echo ${ifile} | grep -o nml`" ] - then - mv $prog.nml.log ${prog}_$g.nml.log - fi - fi - else - errmsg "Error occured during $path_e/$prog execution" - exit 1 - fi - - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt - fi - - done - - fi - -fi - -if [ $exit_p = $prog ] -then - exit -fi - -# 3.e.1 Prep forcing fields --------------------------------------------------- # - -prog=ww3_prep -if [ $exec_p = $prog -o $exec_p = "none" ] -then - -# select inp/nml files - if [ $nml_input ] && [ ! -z "`ls ${path_i}/${prog}*.nml 2>/dev/null`" ] - then - inputs="`ls ${path_i}/${prog}*.nml 2>/dev/null`" - else - inputs="`ls $path_i/$prog*.inp 2>/dev/null`" - fi - - if [ $? = 0 ] - then - echo ' ' - echo '+---------------------+' - echo '| Prep forcing fields |' - echo '+---------------------+' - echo ' ' - - if [ ! -f $path_e/$prog ] - then - errmsg "$path_e/$prog not found" - exit 1 - fi - - for g in $input_grids - do - - if [ $multi -eq 2 ] - then - gu="_$g" - fi - - for ifile in $inputs - do - -# link conf file - if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] - then - \rm -f $prog.nml - \ln -s $ifile $prog.nml - otype="`basename $ifile .nml | sed s/^${prog}_//`" - ofile="$path_w/`basename $ifile .nml`.out" - else - \rm -f $prog.inp - \ln -s $ifile $prog.inp - otype="`basename $ifile .inp | sed s/^${prog}_//`" - ofile="$path_w/`basename $ifile .inp`.out" - fi - - echo " Processing $ifile for $otype" - echo " Screen output routed to $ofile" - - if [ $multi -eq 2 ] - then - \rm -f mod_def.ww3 - \ln -s mod_def.$g mod_def.ww3 - fi - - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - if $path_e/$prog > $ofile - then - \rm -f $prog.inp - \rm -f $prog.nml - if [ $multi -eq 2 ] - then - \rm -f mod_def.ww3 - mv $otype.ww3 $otype.$g - if [ $nml_input ] && [ ! -z "`echo ${ifile} | grep -o nml`" ] - then - mv $prog.nml.log ${prog}_$g.nml.log - fi - fi - else - errmsg "Error occured during $path_e/$prog execution" - exit 1 - fi - - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt - fi - - done - - done - - fi - -fi - -if [ $exit_p = $prog ] -then - exit -fi - -# 3.e.2 Prep forcing fields --------------------------------------------------- # - -prog=ww3_prnc -if [ $exec_p = $prog -o $exec_p = "none" ] -then - -# select inp/nml files - if [ $nml_input ] && [ ! -z "`ls ${path_i}/${prog}*.nml 2>/dev/null`" ] - then - inputs="`ls ${path_i}/${prog}*.nml 2>/dev/null`" - else - inputs="`ls $path_i/$prog*.inp 2>/dev/null`" - fi - - if [ $? = 0 ] - then - echo ' ' - echo '+-------------------------------+' - echo '| Prep of NetCDF forcing fields |' - echo '+-------------------------------+' - echo ' ' - - if [ ! -f $path_e/$prog ] - then - errmsg "$path_e/$prog not found" - exit 1 - fi - - for g in $input_grids - do - echo "grid= $g" - if [ $multi -eq 2 ] - then - gu="_$g" -# check if each grid has its own input - if [ $nml_input ] && [ ! -z "`ls ${path_i}/${prog}*.nml 2>/dev/null`" ] - then - inputs="`ls ${path_i}/${prog}*.nml 2>/dev/null`" - else - inputs="`ls $path_i/$prog*.inp 2>/dev/null`" - fi - - if [ $nml_input ] && [ ! -z "`ls ${path_i}/${prog}*.nml 2>/dev/null`" ] - then - inputs_tmp=`( ls ${path_i}/${prog}${gu}*nml)` - else - inputs_tmp=`( ls ${path_i}/${prog}${gu}*inp)` - fi - - if [ ! -z "$inputs_tmp" ];then - inputs=$inputs_tmp - fi - fi - - for ifile in $inputs - do - -# link conf file - if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] - then - \rm -f $prog.nml - \ln -s $ifile $prog.nml - otype="`basename $ifile .nml | sed s/^${prog}_// | sed s/^${g}_//`" - ofile="$path_w/`basename $ifile .nml`.out" - else - \rm -f $prog.inp - \ln -s $ifile $prog.inp - otype="`basename $ifile .inp | sed s/^${prog}_// | sed s/^${g}_//`" - ofile="$path_w/`basename $ifile .inp`.out" - fi - - echo " Processing $ifile" - echo " Screen output routed to $ofile" - - if [ $multi -eq 2 ] - then - \rm -f mod_def.ww3 - \ln -s mod_def.$g mod_def.ww3 - fi - - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - if $path_e/$prog > $ofile - then - \rm -f $prog.inp - \rm -f $prog.nml - if [ $multi -eq 2 ] - then - \rm -f mod_def.ww3 - mv $otype.ww3 $otype.$g - if [ $nml_input ] && [ ! -z "`echo ${ifile} | grep -o nml`" ] - then - mv $prog.nml.log ${prog}_$g.nml.log - fi - fi - else - errmsg "Error occured during $path_e/$prog execution" - exit 1 - fi - - - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt - fi - - done - - done - - fi - -fi - -if [ $exit_p = $prog ] -then - exit -fi - -# 3.e.2 Prtide forcing fields ------------------------------------------------- # - -prog=ww3_prtide -if [ $exec_p = $prog -o $exec_p = "none" ] -then - -# select inp/nml files - if [ $nml_input ] && [ ! -z "`ls ${path_i}/${prog}*.nml 2>/dev/null`" ] - then - inputs="`ls ${path_i}/${prog}*.nml 2>/dev/null`" - else - inputs="`ls $path_i/$prog*.inp 2>/dev/null`" - fi - - if [ $? = 0 ] - then - echo ' ' - echo '+---------------------------------+' - echo '| Prtide of NetCDF forcing fields |' - echo '+---------------------------------+' - echo ' ' - - runprog=$runcmd - if [ $pmpi ] - then - if [ $nproc ] - then - if [ $batchq = "slurm" ] || [ $batchq = "alps" ] - then - runprog="$runprog -n $nproc" - else - runprog="$runprog -np $nproc" - fi - fi - fi - - if [ ! -f $path_e/$prog ] - then - errmsg "$path_e/$prog not found" - exit 1 - fi - - for g in $input_grids - do - - if [ $multi -eq 2 ] - then - gu="_$g" - fi - - for ifile in $inputs - do - -# link conf file - if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] - then - \rm -f $prog.nml - \ln -s $ifile $prog.nml - otype="`basename $ifile .nml | sed s/^${prog}_//`" - ofile="$path_w/`basename $ifile .nml`.out" - else - \rm -f $prog.inp - \ln -s $ifile $prog.inp - otype="`basename $ifile .inp | sed s/^${prog}_//`" - ofile="$path_w/`basename $ifile .inp`.out" - fi - - echo " Processing $ifile" - echo " Screen output routed to $ofile" - - if [ $multi -eq 2 ] - then - \rm -f mod_def.ww3 - \ln -s mod_def.$g mod_def.ww3 - fi - - mv $otype.ww3 $otype.ww3_tide - - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - if $runprog $path_e/$prog > $ofile - then - \rm -f $prog.inp - \rm -f $prog.nml - if [ $multi -eq 2 ] - then - \rm -f mod_def.ww3 - mv $otype.ww3 $otype.$g - if [ $nml_input ] && [ ! -z "`echo ${ifile} | grep -o nml`" ] - then - mv $prog.nml.log ${prog}_$g.nml.log - fi - fi - else - errmsg "Error occured during $path_e/$prog execution" - exit 1 - fi - - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt - fi - - done - - done - - fi - -fi - -if [ $exit_p = $prog ] -then - exit -fi - -# 3.f Main program ---------------------------------------------------------- # - -if [ -e $path_i/bottomspectrum.inp ] -then - cp $path_i/bottomspectrum.inp . -fi - -# copy rmp_src* files from input to work directory - rmpfile=`\ls $path_i/rmp_src*.nc 2>/dev/null` - if [ ! -z "$rmpfile" ]; then - for rmpnc in $rmpfile - do - cp $rmpnc . - echo "copying $rmpnc to $path_w" - done - fi - -if [ $multi -ge 1 ] -then - prog=ww3_multi - if [ $coupl = "ESMF" ] - then - prgb=ww3_multi_esmf - else - prgb=ww3_multi - fi -else - prog=ww3_shel - prgb=ww3_shel -fi - -if [ $exec_p = $prog -o $exec_p = "none" ] -then - -# track file - multigrid option (ge 1) - if [ $multi -ge 1 ] - then - for g in $all_grids - do - ifile="`ls $path_i/track_i.$g 2>/dev/null`" - if [ $? = 0 ] - then - \rm -f track_i.$g - \ln -s $ifile - fi - done - else - ifile="`ls $path_i/track_i.ww3 2>/dev/null`" - if [ $? = 0 ] - then - \rm -f track_i.ww3 - \ln -s $ifile - fi - fi - -# config filename - gridset option (eq 2) - if [ $multi -eq 2 ] - then - fileconf="${prog}_${grdset}" - else - fileconf="${prog}" - fi - -# select inp/nml files - if [ $nml_input ] && [ ! -z "`ls ${path_i}/${fileconf}.nml 2>/dev/null`" ] - then - ifile="`ls ${path_i}/${fileconf}.nml 2>/dev/null`" - else - ifile="`ls $path_i/${fileconf}.inp 2>/dev/null`" - fi - - - if [ $? = 0 ] - then - - echo ' ' - echo '+--------------------+' - echo '| Main program |' - echo '+--------------------+' - echo ' ' - - if [ $multi -ge 1 ] && [ $coupl = "ESMF" ] - then - if make -C $path_s/esmf $prgb - then : - else - errmsg "Error occured during WW3 ESMF build" - exit 1 - fi - fi - - if [ ! -f $path_e/$prgb ] - then - errmsg "$path_e/$prgb not found" - exit 1 - fi - - ofile="$path_w/$prog.out" - - if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] - then - \rm -f $prog.nml - \ln -s $ifile $prog.nml - else - \rm -f $prog.inp - \ln -s $ifile $prog.inp - fi - - if [ $multi -ge 1 ] && [ $coupl = "ESMF" ] - then - \rm -f PET*.ESMF_LogFile - \rm -f ww3_esmf.rc - \cp -f ${path_i}/ww3_esmf.rc ww3_esmf.rc - if [ ! -z "`echo ${ifile} | grep -o nml`" ] - then - echo "WAV_input_file_name: $prog.nml" >> ww3_esmf.rc - fi - if [ $nproc ] - then - echo "pet_count: $nproc" >> ww3_esmf.rc - else - echo "pet_count: 1" >> ww3_esmf.rc - fi - fi - - echo " Processing $ifile" - echo " Screen output copied to $ofile" - - runprog=$runcmd - if [ $pmpi ] - then - if [ $nproc ] - then - if [ $batchq = "slurm" ] || [ $batchq = "alps" ] - then - runprog="$runprog -n $nproc" - else - runprog="$runprog -np $nproc" - fi - fi - if [ $nthrd ] - then - if ( which omplace ) ; then - runprog="$runprog omplace -nt $nthrd" - elif [ $batchq = "alps" ] - then - runprog="$runprog -d $nthrd /usr/bin/env OMP_NUM_THREADS=$nthrd" - else - runprog="$runprog /usr/bin/env OMP_NUM_THREADS=$nthrd" - fi - fi - fi - if [ $pomp ] - then - if [ $nproc ] - then - export OMP_NUM_THREADS=$nproc - fi - fi - - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - if [ $multi -eq 0 ] && [ $coupl = "OASIS" ] - then - halfnproc=$(($nproc / 2)) - if [ $runcmd = "srun" ] - then - \rm -f $ofile - conf="srun.conf" - echo 0-$(( $halfnproc - 1 )) $path_e/$prgb > $conf - echo $halfnproc-$(( $nproc - 1 )) $path_w/toy_model >> $conf - if $runcmd -n $nproc --multi-prog $conf - then - \rm -f track_i.ww3 - \rm -f $prog.inp - \rm -f $conf - else - errmsg "Error occured during $path_e/$prog execution" - exit 1 - fi - elif $runcmd -np $halfnproc $path_e/$prgb : -np $halfnproc $path_w/toy_model | tee $ofile - then - \rm -f track_i.ww3 - \rm -f $prog.inp - else - errmsg "Error occured during $path_e/$prog execution" - exit 1 - fi - else - if $runprog $path_e/$prgb | tee $ofile - then - \rm -f track_i.ww3 - \rm -f $prog.inp - \rm -f $prog.nml - for file_p in ${files_p} - do - \rm -f ${file_p} - done - else - errmsg "Error occured during $path_e/$prog execution" - exit 1 - fi - fi - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt - fi - fi -fi - -if [ $exit_p = $prog ] -then - exit -fi - -# 3.g Grid integration ------------------------------------------------------- # - -prog=ww3_gint -if [ $exec_p = $prog -o $exec_p = "none" ] -then - -# config filename - gridset option (eq 2) - if [ $multi -eq 2 ] - then - fileconf="${prog}_${grdset}" - else - fileconf="${prog}" - fi - -# select inp/nml files - if [ $nml_input ] && [ ! -z "`ls ${path_i}/${fileconf}.nml 2>/dev/null`" ] - then - ifile="`ls ${path_i}/${fileconf}.nml 2>/dev/null`" - else - ifile="`ls $path_i/${fileconf}.inp 2>/dev/null`" - fi - - - if [ $? = 0 ] - then - - echo ' ' - echo '+-------------------------+' - echo '| Integrated output |' - echo '+-------------------------+' - echo ' ' - - #if rstgl_gint is set to true copy over restart files (assume its restart001) - if [ $rstgl_gint = "true" ] - then - for gname in $model_grids - do - cp restart001.$gname restart.$gname - done - fi - - if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] - then - \rm -f $prog.nml - \ln -s $ifile $prog.nml - ofile="$path_w/`basename $ifile .nml`.out" - else - \rm -f $prog.inp - \ln -s $ifile $prog.inp - ofile="$path_w/`basename $ifile .inp`.out" - fi - - echo " Processing $ifile" - echo " Screen output copied to $ofile" - - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - if $path_e/$prog > $ofile - then - \rm -f $prog.inp - \rm -f $prog.nml - for g in $intgl_grids - do - if [ -f "out_grd.$g" ] - then - model_grids="$model_grids $g" - fi - done - else - errmsg "Error occured during $path_e/$prog execution" - exit 1 - fi - - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt - fi - - fi - -fi - -if [ $exit_p = $prog ] -then - exit -fi - -# 3.g Gridded output -------------------------------------------------------- # - -case $outopt in - native) out_progs="ww3_outf" ;; - netcdf) out_progs="ww3_ounf" ;; - both) out_progs="ww3_outf ww3_ounf" ;; - grib) out_progs="ww3_grib" ;; - all) out_progs="ww3_outf ww3_ounf ww3_grib" ;; - *) out_progs="" ;; -esac - -for prog in $out_progs -do - - rline='| Gridded output |' - if [ $prog = ww3_ounf ] - then - rline='| NC Gridded output |' - fi - if [ $prog = ww3_grib ] - then - rline='| GRIB Gridded output |' - fi - if [ $prog = gx_outf ] - then - rline='|GrADS Gridded output|' - fi - - if [ $exec_p = $prog -o $exec_p = "none" ] - then - -# select inp/nml files - if [ $nml_input ] && [ ! -z "`ls ${path_i}/${prog}*.nml 2>/dev/null`" ] - then - inputs="`ls ${path_i}/${prog}*.nml 2>/dev/null`" - else - inputs="`ls $path_i/$prog*.inp 2>/dev/null`" - fi - - if [ $? = 0 ] - then - - echo ' ' - echo '+--------------------+' - echo "$rline" - echo '+--------------------+' - echo ' ' - - if [ ! -f $path_e/$prog ] - then - errmsg "$path_e/$prog not found" - exit 1 - fi - - for g in $model_grids - do - - if [ $multi -eq 2 ] - then - if [ ! -e out_grd.$g ] - then - continue - fi - gu="_$g" - fi -# for ww3_grib only - if [ $prog == 'ww3_grib' ] - then - ifile=`( ls ${path_i}/${prog}${gu}.??? )` - -# link conf file - if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] - then - \rm -f $prog.nml - \ln -s $path_i/$prog${gu}.nml $prog.nml - otype="`basename $prog${gu}.nml | sed s/^${prog}_//`" - ofile="$path_w/`basename $prog.nml`${gu}.out" - else - \rm -f $prog.inp - \ln -s $path_i/$prog${gu}.inp $prog.inp - otype="`basename $prog${gu}.inp | sed s/^${prog}_//`" - ofile="$path_w/`basename $prog.inp`${gu}.out" - fi - - echo " Processing $path_i/$prog${gu}.inp" - echo " Screen output routed to $ofile" - - if [ $multi -eq 2 ] - then - \rm -f mod_def.ww3 - \rm -f out_grd.ww3 - \ln -s mod_def.$g mod_def.ww3 - \ln -s out_grd.$g out_grd.ww3 - \rm -fr ${otype}_$g - fi - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - if $path_e/$prog > $ofile - then - \rm -f $prog.inp - \rm -f $prog.nml - if [ $multi -eq 2 ] - then - \rm -f mod_def.ww3 - \rm -f out_grd.ww3 - if [ $nml_input ] && [ ! -z "`echo ${ifile} | grep -o nml`" ] - then - mv $prog.nml.log ${prog}_$g.nml.log - fi - ofiles="`ls gribfile 2>/dev/null`" - if [ $? = 0 ] - then - mv -f $ofiles $g.grb2 - echo " GRIB output files moved to $g.grb2" - fi - fi - - else - errmsg "Error occured during $path_e/$prog execution" - fi -#for ww3_ounf, ww3_outp and ww3_gx_outf - else - for ifile in $inputs - do - -# link conf file - if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] - then - \rm -f $prog.nml - \ln -s $ifile $prog.nml - otype="`basename $ifile .nml | sed s/^${prog}_//`" - ofile="$path_w/`basename $ifile .nml`${gu}.out" - else - \rm -f $prog.inp - \ln -s $ifile $prog.inp - otype="`basename $ifile .inp | sed s/^${prog}_//`" - ofile="$path_w/`basename $ifile .inp`${gu}.out" - fi - - echo " Processing $ifile" - echo " Screen output routed to $ofile" - - - if [ $multi -eq 2 ] - then - \rm -f mod_def.ww3 - \rm -f out_grd.ww3 - \ln -s mod_def.$g mod_def.ww3 - \ln -s out_grd.$g out_grd.ww3 - \rm -f ww3.????????.* - \rm -fr ${otype}_$g - fi - - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - # Link in ounfmeta.inp for ww3_ounf, if exists: - if [ $prog == 'ww3_ounf' ] && [ ! -z ${path_i}/ounfmeta.inp ]; then - ln -sf ${path_i}/ounfmeta.inp . - fi - - if $path_e/$prog > $ofile - then - \rm -f $prog.inp - \rm -f $prog.nml - \rm -f ounfmeta.inp - if [ $multi -eq 2 ] - then - \rm -f mod_def.ww3 - \rm -f out_grd.ww3 - if [ $nml_input ] && [ ! -z "`echo ${ifile} | grep -o nml`" ] - then - mv $prog.nml.log ${prog}_$g.nml.log - fi - ofiles="`ls ww3.????????.* 2>/dev/null`" - if [ $? = 0 ] - then - mkdir ${otype}_$g - mv -f $ofiles ${otype}_$g/. - echo " ASCII output files moved to ${otype}_$g" - fi - ofiles="`ls ww3.????*.nc 2>/dev/null`" - if [ $? = 0 ] - then - mkdir ${otype}_$g - mv -f $ofiles ${otype}_$g/. - echo " NetCDF output files moved to ${otype}_$g" - fi -# - if [ "$prog" = 'gx_outf' ] - then - case $g in - 'grd2' ) sed -e "s/ww3\.grads/ww3\.$g/g" \ - -e "s/37\.5/3\.75/g" \ - -e "s/1\.50/0\.15/g" \ - ww3.ctl > $g.ctl ;; - 'grd3' ) sed -e "s/ww3\.grads/ww3\.$g/g" \ - -e "s/12\.5/1\.25/g" \ - -e "s/0\.50/0\.05/g" \ - ww3.ctl > $g.ctl ;; - * ) sed -e "s/ww3\.grads/ww3\.$g/g" \ - -e "s/0\.25/2\.50/g" ww3.ctl > $g.ctl ;; - esac - rm -f ww3.ctl - echo " ww3.ctl moved to $g.ctl" - mv ww3.grads ww3.$g - echo " ww3.grads moved to ww3.$g" - fi - fi - else - errmsg "Error occured during $path_e/$prog execution" - exit 1 - fi - - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt - fi - - - done - fi - - done - - - fi - - fi - - if [ $exit_p = $prog ] - then - exit - fi - -done # end of loop on progs - -# 3.h Point output ---------------------------------------------------------- # - -case $outopt in - native) out_progs="ww3_outp" ;; - netcdf) out_progs="ww3_ounp" ;; - both) out_progs="ww3_outp ww3_ounp" ;; - all) out_progs="ww3_outp ww3_ounp" ;; - *) out_progs="" ;; -esac - -for prog in $out_progs -do - - rline='| Point output |' - if [ $prog = ww3_ounp ] - then - rline='| NC Point output |' - fi - - if [ $exec_p = $prog -o $exec_p = "none" ] - then - -# select inp/nml format for input file to program $prog - if [ $nml_input ] && [ ! -z "`ls ${path_i}/${prog}*.nml 2>/dev/null`" ] - then - inputs="`ls ${path_i}/${prog}*.nml 2>/dev/null`" - else - inputs="`ls $path_i/$prog*.inp 2>/dev/null`" - fi - - if [ $? = 0 ] - then - - echo ' ' - echo '+--------------------+' - echo "$rline" - echo '+--------------------+' - echo ' ' - - if [ ! -f $path_e/$prog ] - then - errmsg "$path_e/$prog not found" - exit 1 - fi - - for g in $point_grids - do - - if [ $multi -eq 2 ] - then - if [ ! -e out_pnt.$g ] - then - continue - fi - gu="_$g" - fi - - for ifile in $inputs - do - - # link conf file - if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] - then - \rm -f $prog.nml - \ln -s $ifile $prog.nml - otype="`basename $ifile .nml | sed s/^${prog}_//`" - ofile="$path_w/`basename $ifile .nml`${gu}.out" - else - \rm -f $prog.inp - \ln -s $ifile $prog.inp - otype="`basename $ifile .inp | sed s/^${prog}_//`" - ofile="$path_w/`basename $ifile .inp`${gu}.out" - fi - - echo " Processing $ifile" - echo " Screen output routed to $ofile" - - if [ $multi -eq 2 ] - then - \rm -f mod_def.ww3 - \rm -f out_pnt.ww3 - \ln -s mod_def.$g mod_def.ww3 - \ln -s out_pnt.$g out_pnt.ww3 - fi - - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - if $path_e/$prog > $ofile - then - \rm -f $prog.inp - \rm -f $prog.nml - if [ $multi -eq 2 ] - then - \rm -f mod_def.ww3 - \rm -f out_pnt.ww3 - if [ $nml_input ] && [ ! -z "`echo ${ifile} | grep -o nml`" ] - then - mv $prog.nml.log ${prog}_$g.nml.log - fi - fi - else - errmsg "Error occured during $path_e/$prog execution" - exit 1 - fi - - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt - fi - - done - - done - - fi - - fi - - if [ $exit_p = $prog ] - then - exit - fi - -done # end of loop on progs - -# 3.i Track output ---------------------------------------------------------- # - -case $outopt in - native) out_progs="ww3_trck" ;; - netcdf) out_progs="ww3_trnc" ;; - both) out_progs="ww3_trck ww3_trnc" ;; - *) out_progs="" ;; -esac - -for prog in $out_progs -do - - if [ $exec_p = $prog -o $exec_p = "none" ] - then - -# select inp/nml files - if [ $nml_input ] && [ ! -z "`ls ${path_i}/${prog}*.nml 2>/dev/null`" ] - then - inputs="`ls ${path_i}/${prog}*.nml 2>/dev/null`" - else - inputs="`ls $path_i/$prog*.inp 2>/dev/null`" - fi - - - if [ $? = 0 ] - then - - echo ' ' - echo '+--------------------+' - echo '| Track output |' - echo '+--------------------+' - echo ' ' - - if [ ! -f $path_e/$prog ] - then - errmsg "$path_e/$prog not found" - exit 1 - fi - - for g in $point_grids - do - - if [ $multi -eq 2 ] - then - if [ ! -e track_o.$g ] - then - continue - fi - gu="_$g" - fileconf="$prog${gu}" - else - fileconf="$prog" - fi - -# select inp/nml files - if [ $nml_input ] && [ ! -z "`ls ${path_i}/${fileconf}.nml 2>/dev/null`" ] - then - ifile="`ls ${path_i}/${fileconf}.nml 2>/dev/null`" - else - ifile="`ls $path_i/${fileconf}.inp 2>/dev/null`" - fi - - if [ ! -f $ifile ] - then - errmsg "$ifile not found" - exit 1 - fi - -# link conf file - if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] - then - \rm -f $prog.nml - \ln -s $ifile $prog.nml - otype="`basename $ifile .nml | sed s/^${prog}_//`" - ofile="$path_w/`basename $ifile .nml`.out" - else - \rm -f $prog.inp - \ln -s $ifile $prog.inp - otype="`basename $ifile .inp | sed s/^${prog}_//`" - ofile="$path_w/`basename $ifile .inp`.out" - fi - - echo " Processing $ifile" - echo " Screen output routed to $ofile" - - if [ $multi -eq 2 ] - then - \rm -f track_o.ww3 - \ln -s track_o.$g track_o.ww3 - fi - - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - if $path_e/$prog > $ofile - then - \rm -f $prog.inp - \rm -f $prog.nml - if [ $multi -eq 2 ] - then - \rm -f track_o.ww3 - if [ $nml_input ] && [ ! -z "`echo ${ifile} | grep -o nml`" ] - then - mv $prog.nml.log ${prog}_$g.nml.log - fi - if [ -e track.ww3 ] - then - mv track.ww3 track.$g - elif [ -e track.nc ] - then - mv track.nc track_$g.nc - fi - fi - else - errmsg "Error occured during $path_e/$prog execution" - exit 1 - fi - - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt - fi - done - - fi - - fi - - if [ $exit_p = $prog ] - then - exit - fi - -done # end of loop on progs - -# 3.j Wave system tracking -------------------------------------------------- # - -prog=ww3_systrk -if [ $exec_p = $prog -o $exec_p = "none" ] -then - -# select inp/nml files - if [ $nml_input ] && [ ! -z "`ls ${path_i}/${prog}.nml 2>/dev/null`" ] - then - ifile="`ls ${path_i}/${prog}.nml 2>/dev/null`" - else - ifile="`ls $path_i/$prog.inp 2>/dev/null`" - fi - - - if [ $? = 0 ] - then - - echo ' ' - echo '+-------------------------+' - echo '| Wave system tracking |' - echo '+-------------------------+' - echo ' ' - - if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] - then - \rm -f $prog.nml - \ln -s $ifile $prog.nml - ofile="$path_w/`basename $ifile .nml`.out" - else - \rm -f $prog.inp - \ln -s $ifile $prog.inp - ofile="$path_w/`basename $ifile .inp`.out" - fi - - echo " Processing $ifile" - echo " Screen output copied to $ofile" - - runprog=$runcmd - if [ $pmpi ] - then - if [ $nproc ] - then - if [ $batchq = "slurm" ] || [ $batchq = "alps" ] - then - runprog="$runprog -n $nproc" - - else - runprog="$runprog -np $nproc" - fi - fi - fi - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - if $runprog $path_e/$prog | tee $ofile - then - \rm -f $prog.inp - \rm -f $prog.nml - else - errmsg "Error occured during $path_e/$prog execution" - exit 1 - fi - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt - fi - - fi - -fi - -if [ $exit_p = $prog ] -then - exit -fi - -# 3.k Update Restart File ------------------------------------------ # - -prog=ww3_uprstr -if [ $exec_p = $prog -o $exec_p = "none" ] -then - -# Check for input file - -# select inp/nml files - if [ $nml_input ] && [ ! -z "`ls ${path_i}/${prog}.nml 2>/dev/null`" ] - then - ifile="`ls ${path_i}/${prog}.nml 2>/dev/null`" - else - ifile="`ls $path_i/$prog.inp 2>/dev/null`" - fi - - if [ $? = 0 ] - then - - echo ' ' - echo '+-------------------------+' - echo '| Update Restart File |' - echo '+-------------------------+' - echo ' ' - -# link conf file - if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] - then - \rm -f $prog.nml - \ln -s $ifile $prog.nml - ofile="$path_w/`basename $ifile .nml`.out" - else - \rm -f $prog.inp - \ln -s $ifile $prog.inp - ofile="$path_w/`basename $ifile .inp`.out" - fi - - echo " Processing $ifile" - echo " Screen output copied to $ofile" - -# Additional Files - \rm -f anl.grbtxt - \ln -s "$path_i/anl.grbtxt" anl.grbtxt - - mv -f restart001.ww3 restart.ww3 - - runprog=$runcmd - if [ $pmpi ] - then - if [ $nproc ] - then - if [ $batchq = "slurm" ] || [ $batchq = "alps" ] - then - runprog="$runprog -n $nproc" - else - runprog="$runprog -np $nproc" - fi - fi - fi - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - if $runprog $path_e/$prog | tee $ofile - then - \rm -f $prog.inp - \rm -f $prog.nml - else - errmsg "Error occured during $path_e/$prog execution" - exit 1 - fi - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt - fi - - fi - -fi - -if [ $exit_p = $prog ] -then - exit -fi - -# 3.k End ------------------------------------------------------------------- # - -if [ "$stub" ] -then - date > finished -fi - -if [ $time_count ] -then # Export cumultive time if time_count - printf "\n\n Total compile time: %8.2f sec" $cumult_comp >> time_count.txt - printf "\n Total run time : %8.2f sec" $cumult_run >> time_count.txt - printf "\n" >> time_count.txt -fi - -echo ' ' ; echo ' ' ; echo "Files in `pwd` :" ; echo ' ' -ls -l - -echo ' ' ; echo ' ' -echo ' ================================== ' -echo ' ======> END OF WAVEWATCH III <====== ' -echo ' ================================== ' -echo ' ' - -# --------------------------------------------------------------------------- # -# End of script # -# --------------------------------------------------------------------------- # - diff --git a/regtests/bin/run_test b/regtests/bin/run_test index 7ed5ce40e..bcedb89c9 100755 --- a/regtests/bin/run_test +++ b/regtests/bin/run_test @@ -1,14 +1,14 @@ #!/bin/bash # --------------------------------------------------------------------------- # # # -# Script for running WW-III tests. # +# Script for running WW3 tests. # # # -# Last update : 21-May-2020 # +# Last update : 21-Apr-2023 # # --------------------------------------------------------------------------- # # Modification history # 27-Jan-2014 : Adapts ww3_ounf section for multigrid ( version 4.18 ) # 04-May-2020 : F. Ardhuin added step 3.b2 for CDL input files ( version 7.12 ) -# 20-April-2021 : A. Abdolali added ww3_grib bulid and execution ( version 7.12 ) +# 20-Apr-2021 : A. Abdolali added ww3_grib bulid and execution ( version 7.12 ) # 21-May-2021 : C. Bunney add support for ALPS job placement ( version 7.12 ) # # Limitations: @@ -43,7 +43,7 @@ errmsg () # 1.b Usage function myname="`basename $0`" #name of script -optstr="a:b:c:C:defg:Ghi:m:n:No:Op:q:r:s:t:STw:" #option string for getopt function +optstr="b:C:dfg:hi:m:n:No:Op:q:r:s:t:STw:" #option string for getopt function usage () { @@ -54,21 +54,15 @@ Required: source_dir : path to top-level of WW3 source test_name : name of test case (directory) Options: - -a ww3_env : use WW3 environment setup file - : *default is /bin/wwatch3.env - : *file will be created if it does not already exist -b batchq : optional setting to determine batch queue type (slurm or alps) - -c cmplr : setup comp & link files for specified cmplr -C coupl : invoke test using coupled application : OASIS : OASIS3-mct ww3_shel coupled application : ESMF : ESMF ww3_multi coupled application -d : invoke main program using gdb (non-parallel) - -e : prompt for changes to existing WW3 environment -f : force pre- and post-processing programs to be compiled : non-MPI (i.e., with SHRD switch); default is all programs : compiled with unmodified switch settings -g grid_string : use ww3_grid_.inp - -G : create GrADS data files using gx_outX.inp -h : print usage and exit -i inpdir : use inputs in test_name/ (default test_name/input) -m grid_set : execute multi-model test @@ -137,21 +131,17 @@ multi=0 dist=0 inpdir=input outopt=native -grads=0 coupl=none batchq=none while : do case "$1" in - -a) shift; ww3_env="$1" ;; -b) shift; batchq="$1" ;; - -c) shift; cmplr="$1" ;; -C) shift; coupl="$1" ;; -d) use_gdb=1 ;; -e) prompt=1 ;; -f) force_shrd=1 ;; -g) shift; grdstr="$1" ;; - -G) grads=1 ;; -h) help=1 ;; -i) shift; inpdir="$1" ;; -m) shift; grdset="$1" ; @@ -272,7 +262,6 @@ else fi # 2.h Paths to source subdirectories -path_e="$path_s/exe" path_a="$path_s/tools" path_b="$path_s/bin" if [ ! -d $path_a ] @@ -339,6 +328,14 @@ then input_grids="`awk '/^INPUT:/' $path_i/$grdset | sed 's/INPUT\://'`" point_grids="`awk '/^POINT:/' $path_i/$grdset | sed 's/POINT\://'`" intgl_grids="`awk '/^INTGL:/' $path_i/$grdset | sed 's/INTGL\://'`" + if [ `grep -o 'RSTGL' $path_i/$grdset` ] + then + rstgl_grids="`awk '/^RSTGL:/' $path_i/$grdset | sed 's/RSTGL\://'`" + rstgl_gint="true" + else + rstgl_grids="" + rstgl_gint="false" + fi else errmsg "grid_set file $path_i/$grdset not found" exit 1 @@ -348,75 +345,203 @@ else input_grids="none" point_grids="none" intgl_grids="none" + rstgl_grids="none" + rstgl_gint="false" fi all_grids=$model_grids -for g in $input_grids $point_grids $intgl_grids +for g in $input_grids $point_grids $intgl_grids $rstgl_grids do if [ -z "`echo $all_grids | grep $g`" ] then all_grids="$all_grids $g" fi done +# 2.m Initialize time counter if time_count option +if [ $time_count ] +then # Add time counter if -T + cumult_comp=0 + cumult_run=0 +fi + + +mkdir -p $path_w + +cd $path_w -# 2.l Setup WW3 -if [ $ww3_env ] +if [ $stub ] && [ -f finished ] then - d="`dirname $ww3_env`"; b="`basename $ww3_env`"; - export WWATCH3_ENV="`cd $d 1>/dev/null 2>&1 && pwd`/$b" -else - export WWATCH3_ENV="$path_b/wwatch3.env" + echo " Test already finished, skipping ..." + echo ' ' + exit 0 fi -if [ -f $path_b/w3_setup ] + +if [ $time_count ] +then # Add time counter if -T + echo " REGTESTS Time counter: run_test $ARGS" >> time_count.txt + Tstart=`date +"%s.%2N"` +fi + +# --------------------------------------------------------------------------- # +# Build all executables +# --------------------------------------------------------------------------- # + +if [ $multi -eq 0 ] && [ $coupl = "OASIS" ] then - args="-t $path_s/tmp $path_s" - if [ $cmplr ] - then - args="-c $cmplr $args" - fi - if [ $prompt ] - then : - else - args="-q $args" - fi - if $path_b/w3_setup "$args" + ww3_dir=${path_s}/.. + if $path_i/prep_env.sh $path_i $path_w $swtstr $ww3_dir then : else - errmsg "Error occured during w3_setup" + errmsg "Error occured during WW3 $prog build" exit 1 fi -else - errmsg "WW3 setup script $path_b/w3_setup not found" - exit 1 + export OASISDIR=$path_w/work_oasis3-mct fi -#if [ ! -e $path_b/w3adc ] -#then -# $path_b/w3_setup $path_s -q -#fi -# -#if [ ! -e $path_b/comp ] || [ ! -e $path_b/link ] -#then -# errmsg "No comp/link file found in $path_b. Use option -c" -# exit 1 -#fi -# -#if [ ! -e $path_b/switch ] -#then -# $path_b/w3_setup $path_s -s $file_c -q -#fi +cd $path_s +cd ../ +path_cmake="`pwd`" + +path_e=$path_w/exe +mkdir -p $path_e + +ofile=$path_w/build.log + +echo " Building WW3, exes will be in $path_e" + +echo "Exe directory is $path_e" > $ofile +path_build_root=${path_build_root:-$path_w/build} +if [ $force_shrd ] +then + + # build pre- & post-processing programs with SHRD only + echo "Forcing a SHRD build" >> $ofile + path_build=${path_build_root}_SHRD + mkdir -p $path_build + cd $path_build + if [[ "$outopt" = "all" ]] || [[ "$outopt" = "grib" ]] ; + then + cat $file_c | sed 's/DIST/SHRD/' | sed 's/MPI //' | \ + sed 's/OMPG //' | sed 's/NOGRB/NCEP2/' | \ + sed 's/OMPH //' | sed 's/PDLIB //' | \ + sed 's/B4B //' | sed 's/METIS //' | \ + sed 's/SCOTCH //' > $path_build/switch + else + cat $file_c | sed 's/DIST/SHRD/' | sed 's/MPI //' | \ + sed 's/OMPG //' | \ + sed 's/OMPH //' | sed 's/PDLIB //' | \ + sed 's/B4B //' | sed 's/METIS //' | \ + sed 's/SCOTCH //' > $path_build/switch + fi + + echo "Switch file is $path_build/switch with switches:" >> $ofile + cat $path_build/switch >> $ofile + cmake $path_cmake ${CMAKE_OPTIONS} -DSWITCH=$path_build/switch -DCMAKE_INSTALL_PREFIX=install > $ofile 2>&1 + rc=$? + if [[ $rc -ne 0 ]] ; then + echo "Fatal error in cmake." + echo "The build log is in $ofile" + exit + fi + make -j 8 > $ofile 2>&1 + rc=$? + if [[ $rc -ne 0 ]] ; then + echo "Fatal error in make." + echo "The build log is in $ofile" + exit + fi + make install > $ofile 2>&1 + if [[ $rc -ne 0 ]] ; then + echo "Fatal error in make install." + echo "The build log is in $ofile" + exit + fi + + cp $path_build/install/bin/* $path_e/ + + if [ $pomp ] || [ $nproc ] + then + echo "non-SHRD build" >> $ofile + #build without SHRD + path_build=${path_build_root} + mkdir -p $path_build + cd $path_build + \cp -f $file_c $path_build/switch + echo "Switch file is $path_build/switch with switches:" >> $ofile + cat $path_build/switch >> $ofile + cmake $path_cmake ${CMAKE_OPTIONS} -DSWITCH=$path_build/switch -DCMAKE_INSTALL_PREFIX=install > $ofile 2>&1 + rc=$? + if [[ $rc -ne 0 ]] ; then + echo "Fatal error in cmake." + echo "The build log is in $ofile" + exit + fi + make -j 8 > $ofile 2>&1 + if [[ $rc -ne 0 ]] ; then + echo "Fatal error in make." + echo "The build log is in $ofile" + exit + fi + make install > $ofile 2>&1 + if [[ $rc -ne 0 ]] ; then + echo "Fatal error in make install." + echo "The build log is in $ofile" + exit + fi + path_e=$path_w/exe + cp $path_build/install/bin/ww3_shel $path_e/ + cp $path_build/install/bin/ww3_multi $path_e/ + cp $path_build/install/bin/ww3_systrk $path_e/ + cp $path_build/install/bin/ww3_prtide $path_e/ + fi +else + path_build=${path_build_root} + mkdir -p $path_build + cd $path_build + if [[ "$outopt" = "all" ]] || [[ "$outopt" = "grib" ]] ; + then + cat $file_c | sed 's/NOGRB/NCEP2/' > $path_build/switch + else + \cp -f $file_c $path_build/switch + fi + echo "Switch file is $path_build/switch with switches:" >> $ofile + cat $path_build/switch >> $ofile + cmake $path_cmake ${CMAKE_OPTIONS} -DSWITCH=$path_build/switch -DCMAKE_INSTALL_PREFIX=install > $ofile 2>&1 + rc=$? + if [[ $rc -ne 0 ]] ; then + echo "Fatal error in cmake." + echo "The build log is in $ofile" + exit + fi + make -j 8 > $ofile 2>&1 + if [[ $rc -ne 0 ]] ; then + echo "Fatal error in make." + echo "The build log is in $ofile" + exit + fi + make install > $ofile 2>&1 + if [[ $rc -ne 0 ]] ; then + echo "Fatal error in make install." + echo "The build log is in $ofile" + exit + fi + + cp $path_build/install/bin/* $path_e/ + +fi +echo " Build log is in $ofile" -# 2.m Initialize time counter if time_count option if [ $time_count ] then # Add time counter if -T - cumult_comp=0 - cumult_run=0 + Tend=`date +"%s.%2N"` + Maketime=`echo "$Tend - $Tstart" | bc` + cumult_comp=`echo "$Maketime + $cumult_comp" | bc` + printf "\n %8.2f sec compile time" $Maketime >> time_count.txt fi - + # --------------------------------------------------------------------------- # # 3. Execute Test # # --------------------------------------------------------------------------- # # 3.a Go to work directory and clean-up -mkdir -p $path_w cd $path_w if [ $exec_p = "none" ] then @@ -429,23 +554,6 @@ then fi fi -if [ $time_count ] -then # Add time counter if -T - echo " REGTESTS Time counter: run_test $ARGS" >> time_count.txt -fi - -if [ $multi -eq 0 ] && [ $coupl = "OASIS" ] -then - ww3_dir=${path_s}/.. - if $path_i/prep_env.sh $path_i $path_w $cmplr $swtstr $ww3_dir - then : - else - errmsg "Error occured during WW3 $prog build" - exit 1 - fi - export OASISDIR=$path_w/work_oasis3-mct -fi - # 3.b Header echo ' ' ; echo ' ' echo ' ================================== ' @@ -461,13 +569,6 @@ echo " Input directory: $path_i" echo " Switch file: $file_c" echo ' ' -if [ $stub ] && [ -f finished ] -then - echo " Test already finished, skipping ..." - echo ' ' - exit 0 -fi - # 3.b2 Preprocess cdl files into nc files ----------------------------------- # for f in $(find $path_i/ -type f -name "*.cdl") @@ -489,43 +590,6 @@ then echo '+--------------------+' echo ' ' - if [ $force_shrd ] - then # build pre- & post-processing programs with SHRD only - cat $file_c | sed 's/DIST/SHRD/' | sed 's/MPI //' | \ - sed 's/OMPG //' | \ - sed 's/OMPH //' | sed 's/PDLIB //' | \ - sed 's/B4B //' | sed 's/METIS //' | \ - sed 's/SCOTCH //' > $path_b/switch - else - \cp -f $file_c $path_b/switch - fi - if [ $testST ] - then #add S T switches - \cp -f $path_b/switch $path_b/switch_noST - cat $path_b/switch_noST | sed 's/NOGRB/NOGRB S T /' > $path_b/switch - rm $path_b/switch_noST - fi - - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - if $path_b/w3_make $prog - then : - else - errmsg "Error occured during WW3 $prog build" - exit 1 - fi - - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - cumult_comp=`echo "$Maketime + $cumult_comp" | bc` - printf "\n $prog \n %8.2f sec compile time" $Maketime >> time_count.txt - fi - for g in $all_grids do @@ -562,7 +626,7 @@ then fi # link conf file - if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] + if [ $nml_input ] && [ ! -z "`echo ${ifile} | grep -o nml`" ] then \rm -f $prog.nml \ln -s $ifile $prog.nml @@ -603,7 +667,7 @@ then Tend=`date +"%s.%2N"` Maketime=`echo "$Tend - $Tstart" | bc` cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n %8.2f sec run time \n" $Maketime >> time_count.txt + printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt fi done @@ -638,44 +702,6 @@ then echo '+--------------------+' echo ' ' - if [ $force_shrd ] - then # build pre- & post-processing programs with SHRD only - cat $file_c | sed 's/DIST/SHRD/' | sed 's/MPI //' | \ - sed 's/OMPG //' | \ - sed 's/OMPH //' | sed 's/PDLIB //' | \ - sed 's/B4B //' | sed 's/METIS //' | \ - sed 's/SCOTCH //' > $path_b/switch - - else - \cp -f $file_c $path_b/switch - fi - if [ $testST ] - then #add S T switches - \cp -f $path_b/switch $path_b/switch_noST - cat $path_b/switch_noST | sed 's/NOGRB/NOGRB S T /' > $path_b/switch - rm $path_b/switch_noST - fi - - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - if $path_b/w3_make $prog - then : - else - errmsg "Error occured during WW3 $prog build" - exit 1 - fi - - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - printf "\n $prog \n %8.2f sec compile time" $Maketime >> time_count.txt - cumult_comp=`echo "$Maketime + $cumult_comp" | bc` - fi - if [ ! -f $path_e/$prog ] then errmsg "$path_e/$prog not found" @@ -739,7 +765,7 @@ then Tend=`date +"%s.%2N"` Maketime=`echo "$Tend - $Tstart" | bc` cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n %8.2f sec run time \n" $Maketime >> time_count.txt + printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt fi done @@ -775,43 +801,6 @@ then echo '| Boundary conditions |' echo '+---------------------+' echo ' ' - - if [ $force_shrd ] - then # build pre- & post-processing programs with SHRD only - cat $file_c | sed 's/DIST/SHRD/' | sed 's/MPI //' | \ - sed 's/OMPG //' | \ - sed 's/OMPH //' | sed 's/PDLIB //' | \ - sed 's/B4B //' | sed 's/METIS //' | \ - sed 's/SCOTCH //' > $path_b/switch - else - \cp -f $file_c $path_b/switch - fi - if [ $testST ] - then #add S T switches - \cp -f $path_b/switch $path_b/switch_noST - cat $path_b/switch_noST | sed 's/NOGRB/NOGRB S T /' > $path_b/switch - rm $path_b/switch_noST - fi - - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - if $path_b/w3_make $prog - then : - else - errmsg "Error occured during WW3 $prog build" - exit 1 - fi - - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - printf "\n $prog \n %8.2f sec compile time" $Maketime >> time_count.txt - cumult_comp=`echo "$Maketime + $cumult_comp" | bc` - fi if [ ! -f $path_e/$prog ] then @@ -875,7 +864,7 @@ then Tend=`date +"%s.%2N"` Maketime=`echo "$Tend - $Tstart" | bc` cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n %8.2f sec run time \n" $Maketime >> time_count.txt + printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt fi done @@ -911,43 +900,6 @@ then echo '| Boundary conditions |' echo '+---------------------+' echo ' ' - - if [ $force_shrd ] - then # build pre- & post-processing programs with SHRD only - cat $file_c | sed 's/DIST/SHRD/' | sed 's/MPI //' | \ - sed 's/OMPG //' | \ - sed 's/OMPH //' | sed 's/PDLIB //' | \ - sed 's/B4B //' | sed 's/METIS //' | \ - sed 's/SCOTCH //' > $path_b/switch - else - \cp -f $file_c $path_b/switch - fi - if [ $testST ] - then #add S T switches - \cp -f $path_b/switch $path_b/switch_noST - cat $path_b/switch_noST | sed 's/NOGRB/NOGRB S T /' > $path_b/switch - rm $path_b/switch_noST - fi - - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - if $path_b/w3_make $prog - then : - else - errmsg "Error occured during WW3 $prog build" - exit 1 - fi - - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - printf "\n $prog \n %8.2f sec compile time" $Maketime >> time_count.txt - cumult_comp=`echo "$Maketime + $cumult_comp" | bc` - fi if [ ! -f $path_e/$prog ] then @@ -1011,7 +963,7 @@ then Tend=`date +"%s.%2N"` Maketime=`echo "$Tend - $Tstart" | bc` cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n %8.2f sec run time \n" $Maketime >> time_count.txt + printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt fi done @@ -1047,43 +999,6 @@ then echo '+---------------------+' echo ' ' - if [ $force_shrd ] - then # build pre- & post-processing programs with SHRD only - cat $file_c | sed 's/DIST/SHRD/' | sed 's/MPI //' | \ - sed 's/OMPG //' | \ - sed 's/OMPH //' | sed 's/PDLIB //' | \ - sed 's/B4B //' | sed 's/METIS //' | \ - sed 's/SCOTCH //' > $path_b/switch - else - \cp -f $file_c $path_b/switch - fi - if [ $testST ] - then #add S T switches - \cp -f $path_b/switch $path_b/switch_noST - cat $path_b/switch_noST | sed 's/NOGRB/NOGRB S T /' > $path_b/switch - rm $path_b/switch_noST - fi - - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - if $path_b/w3_make $prog - then : - else - errmsg "Error occured during WW3 $prog build" - exit 1 - fi - - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - printf "\n $prog \n %8.2f sec compile time" $Maketime >> time_count.txt - cumult_comp=`echo "$Maketime + $cumult_comp" | bc` - fi - if [ ! -f $path_e/$prog ] then errmsg "$path_e/$prog not found" @@ -1152,7 +1067,7 @@ then Tend=`date +"%s.%2N"` Maketime=`echo "$Tend - $Tstart" | bc` cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n %8.2f sec run time \n" $Maketime >> time_count.txt + printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt fi done @@ -1190,62 +1105,6 @@ then echo '+-------------------------------+' echo ' ' - if [ $force_shrd ] && [ -z "$(grep TIDE $file_c)" ] - then # build pre- & post-processing programs with SHRD only - cat $file_c | sed 's/DIST/SHRD/' | sed 's/MPI //' | \ - sed 's/OMPG //' | \ - sed 's/OMPH //' | sed 's/PDLIB //' | \ - sed 's/B4B //' | sed 's/METIS //' | \ - sed 's/SCOTCH //' > $path_b/switch - else - \cp -f $file_c $path_b/switch - fi - if [ $testST ] - then #add S T switches - \cp -f $path_b/switch $path_b/switch_noST - cat $path_b/switch_noST | sed 's/NOGRB/NOGRB S T /' > $path_b/switch - rm $path_b/switch_noST - fi - - runprog=$runcmd - if [ $pmpi ] - then - if [ $nproc ] - then - if [ $batchq = "slurm" ] || [ $batchq = "alps" ] - then - runprog="$runprog -n $nproc" - - else - runprog="$runprog -np $nproc" - fi - fi - fi - if [ -n "$(grep SHRD $path_b/switch)" ] - then - runprog='' - fi - - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - if $path_b/w3_make $prog - then : - else - errmsg "Error occured during WW3 $prog build" - exit 1 - fi - - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - printf "\n $prog \n %8.2f sec compile time" $Maketime >> time_count.txt - cumult_comp=`echo "$Maketime + $cumult_comp" | bc` - fi - if [ ! -f $path_e/$prog ] then errmsg "$path_e/$prog not found" @@ -1269,10 +1128,10 @@ then if [ $nml_input ] && [ ! -z "`ls ${path_i}/${prog}*.nml 2>/dev/null`" ] then inputs_tmp=`( ls ${path_i}/${prog}${gu}*nml)` - else + else inputs_tmp=`( ls ${path_i}/${prog}${gu}*inp)` fi - + if [ ! -z "$inputs_tmp" ];then inputs=$inputs_tmp fi @@ -1309,7 +1168,7 @@ then Tstart=`date +"%s.%2N"` fi - if $runprog $path_e/$prog > $ofile + if $path_e/$prog > $ofile then \rm -f $prog.inp \rm -f $prog.nml @@ -1333,7 +1192,7 @@ then Tend=`date +"%s.%2N"` Maketime=`echo "$Tend - $Tstart" | bc` cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n %8.2f sec run time \n" $Maketime >> time_count.txt + printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt fi done @@ -1371,14 +1230,6 @@ then echo '+---------------------------------+' echo ' ' - \cp -f $file_c $path_b/switch - if [ $testST ] - then #add S T switches - \cp -f $path_b/switch $path_b/switch_noST - cat $path_b/switch_noST | sed 's/NOGRB/NOGRB S T /' > $path_b/switch - rm $path_b/switch_noST - fi - runprog=$runcmd if [ $pmpi ] then @@ -1393,26 +1244,6 @@ then fi fi - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - if $path_b/w3_make $prog - then : - else - errmsg "Error occured during WW3 $prog build" - exit 1 - fi - - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - printf "\n $prog \n %8.2f sec compile time" $Maketime >> time_count.txt - cumult_comp=`echo "$Maketime + $cumult_comp" | bc` - fi - if [ ! -f $path_e/$prog ] then errmsg "$path_e/$prog not found" @@ -1483,7 +1314,7 @@ then Tend=`date +"%s.%2N"` Maketime=`echo "$Tend - $Tstart" | bc` cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n %8.2f sec run time \n" $Maketime >> time_count.txt + printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt fi done @@ -1580,40 +1411,8 @@ then echo '+--------------------+' echo ' ' - \cp -f $file_c $path_b/switch - if [ $testST ] - then #add S T switches - \cp -f $path_b/switch $path_b/switch_noST - cat $path_b/switch_noST | sed 's/NOGRB/NOGRB S T /' > $path_b/switch - rm $path_b/switch_noST - fi - - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - if $path_b/w3_make $prgb - then : - else - errmsg "Error occured during WW3 $prgb build" - exit 1 - fi - - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - printf "\n $prog \n %8.2f sec compile time" $Maketime >> time_count.txt - cumult_comp=`echo "$Maketime + $cumult_comp" | bc` - fi - if [ $multi -ge 1 ] && [ $coupl = "ESMF" ] then - if [ $cmplr ] - then - export WW3_COMP=$cmplr - fi if make -C $path_s/esmf $prgb then : else @@ -1630,7 +1429,6 @@ then ofile="$path_w/$prog.out" -# link conf file if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] then \rm -f $prog.nml @@ -1743,7 +1541,7 @@ then Tend=`date +"%s.%2N"` Maketime=`echo "$Tend - $Tstart" | bc` cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n %8.2f sec run time \n" $Maketime >> time_count.txt + printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt fi fi fi @@ -1785,44 +1583,15 @@ then echo '+-------------------------+' echo ' ' - if [ $force_shrd ] - then # build pre- & post-processing programs with SHRD only - cat $file_c | sed 's/DIST/SHRD/' | sed 's/MPI //' | \ - sed 's/OMPG //' | \ - sed 's/OMPH //' | sed 's/PDLIB //' | \ - sed 's/B4B //' | sed 's/METIS //' | \ - sed 's/SCOTCH //' > $path_b/switch - else - \cp -f $file_c $path_b/switch - fi - if [ $testST ] - then #add S T switches - \cp -f $path_b/switch $path_b/switch_noST - cat $path_b/switch_noST | sed 's/NOGRB/NOGRB S T /' > $path_b/switch - rm $path_b/switch_noST - fi - - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - if $path_b/w3_make $prog - then : - else - errmsg "Error occured during WW3 $prog build" - exit 1 - fi - - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - printf "\n $prog \n %8.2f sec compile time" $Maketime >> time_count.txt - cumult_comp=`echo "$Maketime + $cumult_comp" | bc` - fi + #if rstgl_gint is set to true copy over restart files (assume its restart001) + if [ $rstgl_gint = "true" ] + then + for gname in $model_grids + do + cp restart001.$gname restart.$gname + done + fi -# link conf file if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] then \rm -f $prog.nml @@ -1863,7 +1632,7 @@ then Tend=`date +"%s.%2N"` Maketime=`echo "$Tend - $Tstart" | bc` cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n %8.2f sec run time \n" $Maketime >> time_count.txt + printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt fi fi @@ -1886,17 +1655,6 @@ case $outopt in *) out_progs="" ;; esac -if [ "$grads" = '1' ] -then - out_progs="$out_progs gx_outf" - if [ `ls $path_i | grep '.gs' | wc -l` -gt '0' ] - then - cp $path_i/*.gs . - cp $path_a/cbarn.gs . - cp $path_a/colorset.gs . - fi -fi - for prog in $out_progs do @@ -1934,57 +1692,6 @@ do echo '+--------------------+' echo ' ' - if [ $force_shrd ] - then # build pre- & post-processing programs with SHRD only - cat $file_c | sed 's/DIST/SHRD/' | sed 's/MPI //' | \ - sed 's/OMPG //' | \ - sed 's/OMPH //' | sed 's/PDLIB //' | \ - sed 's/B4B //' | sed 's/METIS //' | \ - sed 's/SCOTCH //' > $path_b/switch - else - \cp -f $file_c $path_b/switch - fi - if [ $prog = ww3_grib ] - then - cat $file_c | sed 's/DIST/SHRD/' | sed 's/MPI //' | \ - sed 's/OMPG //' | sed 's/OMPX //' | \ - sed 's/OMPH //' | sed 's/PDLIB //' | \ - sed 's/MPIT //' | sed 's/NOGRB/NCEP2 NCO/' | \ - sed 's/B4B //' | sed 's/METIS //' | \ - sed 's/SCOTCH //' > $path_b/switch - fi - if [ $testST ] - then #add S T switches - \cp -f $path_b/switch $path_b/switch_noST - if [ $prog = ww3_grib ] - then - cat $path_b/switch_noST | sed 's/NCEP2/NCEP2 S T /' > $path_b/switch - else - cat $path_b/switch_noST | sed 's/NOGRB/NOGRB S T /' > $path_b/switch - fi - rm $path_b/switch_noST - fi - - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - if $path_b/w3_make $prog - then : - else - errmsg "Error occured during WW3 $prog build" - exit 1 - fi - - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - printf "\n $prog \n %8.2f sec compile time" $Maketime >> time_count.txt - cumult_comp=`echo "$Maketime + $cumult_comp" | bc` - fi - if [ ! -f $path_e/$prog ] then errmsg "$path_e/$prog not found" @@ -2161,7 +1868,7 @@ do Tend=`date +"%s.%2N"` Maketime=`echo "$Tend - $Tstart" | bc` cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n %8.2f sec run time \n" $Maketime >> time_count.txt + printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt fi @@ -2192,19 +1899,6 @@ case $outopt in *) out_progs="" ;; esac -if [ "$grads" = '1' ] -then - out_progs="$out_progs gx_outp" - if [ `ls $path_i | grep 'gx_outp' | wc -l` -gt '0' ] - then - cp $path_a/cbarn.gs . - cp $path_a/colorset.gs . - cp $path_a/source.gs . - cp $path_a/1source.gs . - cp $path_a/spec.gs . - fi -fi - for prog in $out_progs do @@ -2234,43 +1928,6 @@ do echo '+--------------------+' echo ' ' - if [ $force_shrd ] - then # build pre- & post-processing programs with SHRD only - cat $file_c | sed 's/DIST/SHRD/' | sed 's/MPI //' | \ - sed 's/OMPG //' | \ - sed 's/OMPH //' | sed 's/PDLIB //' | \ - sed 's/B4B //' | sed 's/METIS //' | \ - sed 's/SCOTCH //' > $path_b/switch - else - \cp -f $file_c $path_b/switch - fi - if [ $testST ] - then #add S T switches - \cp -f $path_b/switch $path_b/switch_noST - cat $path_b/switch_noST | sed 's/NOGRB/NOGRB S T /' > $path_b/switch - rm $path_b/switch_noST - fi - - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - if $path_b/w3_make $prog - then : - else - errmsg "Error occured during WW3 $prog build" - exit 1 - fi - - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - printf "\n $prog \n %8.2f sec compile time" $Maketime >> time_count.txt - cumult_comp=`echo "$Maketime + $cumult_comp" | bc` - fi - if [ ! -f $path_e/$prog ] then errmsg "$path_e/$prog not found" @@ -2345,7 +2002,7 @@ do Tend=`date +"%s.%2N"` Maketime=`echo "$Tend - $Tstart" | bc` cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n %8.2f sec run time \n" $Maketime >> time_count.txt + printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt fi done @@ -2396,43 +2053,6 @@ do echo '+--------------------+' echo ' ' - if [ $force_shrd ] - then # build pre- & post-processing programs with SHRD only - cat $file_c | sed 's/DIST/SHRD/' | sed 's/MPI //' | \ - sed 's/OMPG //' | \ - sed 's/OMPH //' | sed 's/PDLIB //' | \ - sed 's/B4B //' | sed 's/METIS //' | \ - sed 's/SCOTCH //' > $path_b/switch - else - \cp -f $file_c $path_b/switch - fi - if [ $testST ] - then #add S T switches - \cp -f $path_b/switch $path_b/switch_noST - cat $path_b/switch_noST | sed 's/NOGRB/NOGRB S T /' > $path_b/switch - rm $path_b/switch_noST - fi - - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - if $path_b/w3_make $prog - then : - else - errmsg "Error occured during WW3 $prog build" - exit 1 - fi - - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - printf "\n $prog \n %8.2f sec compile time" $Maketime >> time_count.txt - cumult_comp=`echo "$Maketime + $cumult_comp" | bc` - fi - if [ ! -f $path_e/$prog ] then errmsg "$path_e/$prog not found" @@ -2525,7 +2145,7 @@ do Tend=`date +"%s.%2N"` Maketime=`echo "$Tend - $Tstart" | bc` cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n %8.2f sec run time \n" $Maketime >> time_count.txt + printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt fi done @@ -2564,44 +2184,6 @@ then echo '+-------------------------+' echo ' ' - \cp -f $file_c $path_b/switch -# if [ $force_shrd ] -# then # build pre- & post-processing programs with SHRD only -# cat $file_c | sed 's/DIST/SHRD/' | sed 's/MPI //' | \ -# sed 's/OMPG //' | \ -# sed 's/OMPH //' | sed 's/PDLIB //' > $path_b/switchh -# else -# \cp -f $file_c $path_b/switch -# fi - if [ $testST ] - then #add S T switches - \cp -f $path_b/switch $path_b/switch_noST - cat $path_b/switch_noST | sed 's/NOGRB/NOGRB S T /' > $path_b/switch - rm $path_b/switch_noST - fi - - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - if $path_b/w3_make $prog - then : - else - errmsg "Error occured during WW3 $prog build" - exit 1 - fi - - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - printf "\n $prog \n %8.2f sec compile time" $Maketime >> time_count.txt - cumult_comp=`echo "$Maketime + $cumult_comp" | bc` - fi - - -# link conf file if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] then \rm -f $prog.nml @@ -2647,35 +2229,8 @@ then Tend=`date +"%s.%2N"` Maketime=`echo "$Tend - $Tstart" | bc` cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n %8.2f sec run time \n" $Maketime >> time_count.txt + printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt fi -# if [ $time_count ] -# then # Add time counter if -T -# Tstart=`date +"%s.%2N"` -# fi -# -# if $path_e/$prog > $ofile -# then -# \rm -f $prog.inp -# for g in $intgl_grids -# do -# if [ -f "out_grd.$g" ] -# then -# model_grids="$model_grids $g" -# fi -# done -# else -# errmsg "Error occured during $path_e/$prog execution" -# exit 1 -# fi -# -# if [ $time_count ] -# then # Add time counter if -T -# Tend=`date +"%s.%2N"` -# Maketime=`echo "$Tend - $Tstart" | bc` -# cumult_run=`echo "$Maketime + $cumult_run" | bc` -# printf "\n %8.2f sec run time \n" $Maketime >> time_count.txt -# fi fi @@ -2711,36 +2266,8 @@ then echo '+-------------------------+' echo ' ' - \cp -f $file_c $path_b/switch - if [ $testST ] - then #add S T switches - \cp -f $path_b/switch $path_b/switch_noST - cat $path_b/switch_noST | sed 's/NOGRB/NOGRB S T /' > $path_b/switch - rm $path_b/switch_noST - fi - - if [ $time_count ] - then # Add time counter if -T - Tstart=`date +"%s.%2N"` - fi - - if $path_b/w3_make $prog - then : - else - errmsg "Error occured during WW3 $prog build" - exit 1 - fi - - if [ $time_count ] - then # Add time counter if -T - Tend=`date +"%s.%2N"` - Maketime=`echo "$Tend - $Tstart" | bc` - printf "\n $prog \n %8.2f sec compile time" $Maketime >> time_count.txt - cumult_comp=`echo "$Maketime + $cumult_comp" | bc` - fi - # link conf file - if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] + if [ $nml_input ] && [ ! -z "`basename ${ifile} | grep -o nml`" ] then \rm -f $prog.nml \ln -s $ifile $prog.nml @@ -2791,7 +2318,7 @@ then Tend=`date +"%s.%2N"` Maketime=`echo "$Tend - $Tstart" | bc` cumult_run=`echo "$Maketime + $cumult_run" | bc` - printf "\n %8.2f sec run time \n" $Maketime >> time_count.txt + printf "\n $prog \n %8.2f sec run time \n" $Maketime >> time_count.txt fi fi