Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up run_cmake_test #699

Merged
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ regtests/ww3_ufs1.2/input/gsh_15m.obs
regtests/ww3_ufs1.2/input/gnh_10m.bot
regtests/ww3_ufs1.2/input/gsh_15m.mask
regtests/output
regtests/build*
*.nc
*/*.nc
*/*/*.nc
Expand Down
11 changes: 1 addition & 10 deletions regtests/bin/matrix_cmake_datarmor
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ fi
#convert main_dir to absolute path
main_dir="`cd $main_dir 1>/dev/null 2>&1 && pwd`"

# Compiler option. Choose appropriate compiler and set cmplOption to
# y if using for the first time or using a different compiler

cmplr=datarmor_intel
export cmplOption='y'



Expand Down Expand Up @@ -132,12 +128,7 @@ main_dir="`cd $main_dir 1>/dev/null 2>&1 && pwd`"
export mpi='$MPI_LAUNCH'

# Compile option
if [ "$cmplOption" = 'y' ]
then
opt="-c $cmplr -f -N -S -T"
else
opt="-f -N -S"
fi
opt="-f -N -S -T"

# Base run_test command line
export rtst="./bin/run_cmake_test $opt"
Expand Down
54 changes: 20 additions & 34 deletions regtests/bin/matrix_cmake_ncep
Original file line number Diff line number Diff line change
Expand Up @@ -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 #
Expand All @@ -22,34 +20,28 @@

usage ()
{
cat 2>&1 << EOF
cat 2>&1 << EOF

Usage: $myname model_dir
Required:
model_dir : path to model dir of WW3 source
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`"

# 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=intel
export cmplOption='y'
# 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
# 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'
Expand All @@ -67,7 +59,6 @@ main_dir="`cd $main_dir 1>/dev/null 2>&1 && pwd`"
if [ $ishera ]
then
# If no other h, assuming Hera
cmplr='hera.intel'
batchq='slurm'
hpcstackpath='/scratch2/NCEPDEV/nwprod/hpc-stack/libs/hpc-stack/modulefiles/stack'
hpcstackversion='hpc/1.1.0'
Expand All @@ -77,7 +68,6 @@ main_dir="`cd $main_dir 1>/dev/null 2>&1 && pwd`"
modcmake='cmake/3.20.1'
elif [ $isorion ]
then
cmplr='orion.intel'
batchq='slurm'
hpcstackpath='/apps/contrib/NCEP/libs/hpc-stack/modulefiles/stack'
hpcstackversion='hpc/1.1.0'
Expand Down Expand Up @@ -153,6 +143,8 @@ main_dir="`cd $main_dir 1>/dev/null 2>&1 && pwd`"
echo " module load $modesmf" >> matrix.head

echo " export METIS_PATH=${metispath}" >> 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' ]
Expand All @@ -163,12 +155,7 @@ main_dir="`cd $main_dir 1>/dev/null 2>&1 && pwd`"
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' ]
Expand Down Expand Up @@ -241,14 +228,13 @@ main_dir="`cd $main_dir 1>/dev/null 2>&1 && pwd`"
echo "#submit all of the diveded matrix files" > msuball.sh
if [ $batchq = "slurm" ]
then
files=`ls matrix? matrix??`
files=`ls matrix??`
for file in $files
do
echo "sbatch < $file" >> msuball.sh
done
fi


# --------------------------------------------------------------------------- #
# End to the matrix #
# --------------------------------------------------------------------------- #
45 changes: 27 additions & 18 deletions regtests/bin/matrix_cmake_ukmo_cray
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
# #
# Hendrik L. Tolman #
# August 2013 #
# December 2013 #
# April 2018 #
# #
# Copyright 2013 National Weather Service (NWS), #
# National Oceanic and Atmospheric Administration. All rights #
Expand All @@ -26,24 +24,38 @@
# --------------------------------------------------------------------------- #
# 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)
# - 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"
export cmplOption='y'

# 1. Set up for compilation environemnt on Cray XC (broadwell processors)
echo '#!/bin/bash' > matrix.head
Expand Down Expand Up @@ -107,12 +119,7 @@ fi
export nr='4'
export nth='4'

if [ "$cmplOption" = 'y' ]
then
export rtst="./bin/run_cmake_test -o both -c $cmplr -S"
else
export rtst="./bin/run_cmake_test -o both -S"
fi
export rtst="./bin/run_cmake_test -o both -S"

export ww3='../model'

Expand Down Expand Up @@ -169,6 +176,8 @@ fi

$main_dir/../regtests/bin/matrix.base

$main_dir/../regtests/bin/matrix_divider_cmake.sh

# --------------------------------------------------------------------------- #
# End to the matrix #
# --------------------------------------------------------------------------- #
132 changes: 73 additions & 59 deletions regtests/bin/matrix_divider_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,92 +67,106 @@ rm matrix.tmp
# 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}
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 " matrix${count} prepared"
countf=$(printf %02i $count)
if [ -f "matrix${countf}" ]; then rm -f matrix${countf}; fi
cat before >> matrix${countf}
cat list_mpi_$i >> matrix${countf}
sed -i 's/'matrix.out'/'matrix${countf}.out'/gI' matrix${countf}
sed -i 's/'buildmatrix'/'buildmatrix${countf}'/gI' matrix${countf}
sed -i 's/'ww3_regtest'/'ww3_regtest_${countf}'/gI' matrix${countf}
echo ' [[ -d ${path_build_root} ]] && rm -rf ${path_build_root}*' >> matrix${countf}
echo " echo ' '" >> matrix${countf}
echo " echo ' **************************************************************'" >> matrix${countf}
echo " echo ' * end of WAVEWATCH III matrix${countf} of regression tests *'" >> matrix${countf}
echo " echo ' **************************************************************'" >> matrix${countf}
echo " echo ' '" >> matrix${countf}
echo " matrix${countf} 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}
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 " matrix${count} prepared"
countf=$(printf %02i $count)
if [ -f "matrix${countf}" ]; then rm -f matrix${countf}; fi
cat before >> matrix${countf}
cat list_omp_$i >> matrix${countf}
sed -i 's/'matrix.out'/'matrix${countf}.out'/gI' matrix${countf}
sed -i 's/'buildmatrix'/'buildmatrix${countf}'/gI' matrix${countf}
sed -i 's/'ww3_regtest'/'ww3_regtest_${countf}'/gI' matrix${countf}
echo ' [[ -d ${path_build_root} ]] && rm -rf ${path_build_root}*' >> matrix${countf}
echo " echo ' '" >> matrix${countf}
echo " echo ' **************************************************************'" >> matrix${countf}
echo " echo ' * end of WAVEWATCH III matrix${countf} of regression tests *'" >> matrix${countf}
echo " echo ' **************************************************************'" >> matrix${countf}
echo " echo ' '" >> matrix${countf}
echo " matrix${countf} 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}
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 " matrix${count} prepared"
countf=$(printf %02i $count)
if [ -f "matrix${countf}" ]; then rm -f matrix${countf}; fi
cat before >> matrix${countf}
cat list_serial_$i >> matrix${countf}
sed -i 's/'matrix.out'/'matrix${countf}.out'/gI' matrix${countf}
sed -i 's/'buildmatrix'/'buildmatrix${countf}'/gI' matrix${countf}
sed -i 's/'ww3_regtest'/'ww3_regtest_${countf}'/gI' matrix${countf}
echo ' [[ -d ${path_build_root} ]] && rm -rf ${path_build_root}*' >> matrix${countf}
echo " echo ' '" >> matrix${countf}
echo " echo ' **************************************************************'" >> matrix${countf}
echo " echo ' * end of WAVEWATCH III matrix${countf} of regression tests *'" >> matrix${countf}
echo " echo ' **************************************************************'" >> matrix${countf}
echo " echo ' '" >> matrix${countf}
echo " matrix${countf} 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}
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 " matrix${count} prepared"
countf=$(printf %02i $count)
if [ -f "matrix${countf}" ]; then rm -f matrix${countf}; fi
cat before >> matrix${countf}
cat list_heavy >> matrix${countf}
sed -i 's/'matrix.out'/'matrix${countf}.out'/gI' matrix${countf}
sed -i 's/'buildmatrix'/'buildmatrix${countf}'/gI' matrix${countf}
sed -i 's/'ww3_regtest'/'ww3_regtest_${countf}'/gI' matrix${countf}
echo ' [[ -d ${path_build_root} ]] && rm -rf ${path_build_root}*' >> matrix${countf}
echo " echo ' '" >> matrix${countf}
echo " echo ' **************************************************************'" >> matrix${countf}
echo " echo ' * end of WAVEWATCH III matrix${countf} of regression tests *'" >> matrix${countf}
echo " echo ' **************************************************************'" >> matrix${countf}
echo " echo ' '" >> matrix${countf}
echo " matrix${countf} 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/'##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 " matrix${count} prepared"
countf=$(printf %02i $count)
if [ -f "matrix${countf}" ]; then rm -f matrix${countf}; fi
cat before >> matrix${countf}
sed -i 's/'n\ 24'/'n\ 140'/gI' matrix${countf}
cat list_ufs >> matrix${countf}
sed -i 's/'matrix.out'/'matrix${countf}.out'/gI' matrix${countf}
sed -i 's/'##SBATCH'/'#SBATCH'/gI' matrix${countf}
sed -i 's/'buildmatrix'/'buildmatrix${countf}'/gI' matrix${countf}
sed -i 's/'ww3_regtest'/'ww3_regtest_${countf}'/gI' matrix${countf}
echo ' [[ -d ${path_build_root} ]] && rm -rf ${path_build_root}*' >> matrix${countf}
echo " echo ' '" >> matrix${countf}
echo " echo ' **************************************************************'" >> matrix${countf}
echo " echo ' * end of WAVEWATCH III matrix${countf} of regression tests *'" >> matrix${countf}
echo " echo ' **************************************************************'" >> matrix${countf}
echo " echo ' '" >> matrix${countf}

echo " matrix${countf} prepared"

# --------------------------------------------------------------------------- #

Expand Down
Loading