| 1 |
mlosch |
1.1 |
#!/bin/bash -e |
| 2 |
|
|
# new script for running testreport on ollie.awi.de |
| 3 |
mlosch |
1.3 |
# - compile and run on compute nodes |
| 4 |
|
|
# - use ssh to call mpack command from the head node ollie0 |
| 5 |
mlosch |
1.6 |
#$Header: /u/gcmpack/MITgcm_contrib/test_scripts/ollie/mitgcmtestreport_ifort,v 1.5 2017/03/13 09:31:51 mlosch Exp $ |
| 6 |
mlosch |
1.2 |
#$Name: $ |
| 7 |
mlosch |
1.1 |
|
| 8 |
|
|
# needed for cron-job |
| 9 |
|
|
source /usr/Modules/3.2.10/init/bash |
| 10 |
|
|
source /etc/profile.d/cray_pe.sh |
| 11 |
|
|
source /etc/profile.d/AWI.sh |
| 12 |
|
|
# |
| 13 |
|
|
module purge |
| 14 |
|
|
module load intel.compiler |
| 15 |
|
|
module load intel.mpi |
| 16 |
mlosch |
1.5 |
module load netcdf |
| 17 |
|
|
#export LD_LIBRARY_PATH=${CRAY_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}: |
| 18 |
mlosch |
1.1 |
|
| 19 |
mlosch |
1.5 |
export MPI_ROOT=${I_MPI_ROOT} |
| 20 |
|
|
#(dirname $(dirname `which mpiifort`)) |
| 21 |
mlosch |
1.1 |
export MPI_INC_DIR=${MPI_ROOT}/include64 |
| 22 |
|
|
|
| 23 |
mlosch |
1.5 |
# there is no slurm module anymore and this is the current recommendation to |
| 24 |
|
|
# have sbatch in your path (rather than running /etc/profile.d./slurm.sh) |
| 25 |
|
|
export PATH=${PATH}:/global/opt/slurm/default/bin |
| 26 |
|
|
|
| 27 |
mlosch |
1.1 |
dNam='ollie' |
| 28 |
|
|
TST_DIR="/work/ollie/mlosch/test_$dNam" |
| 29 |
|
|
echo "start from TST_DIR='$TST_DIR' at: "`date` |
| 30 |
|
|
|
| 31 |
|
|
umask 0022 |
| 32 |
|
|
|
| 33 |
|
|
sfx='ifort' |
| 34 |
|
|
RUNIT="runit_"$sfx |
| 35 |
|
|
|
| 36 |
mlosch |
1.2 |
OPTFILE=../tools/build_options/linux_ia64_${sfx}_ollie |
| 37 |
mlosch |
1.1 |
options="-MPI 6" |
| 38 |
mlosch |
1.2 |
options="$options -odir ${dNam}-i" |
| 39 |
mlosch |
1.1 |
options="$options -j 6" |
| 40 |
|
|
#options="$options -t global_ocean.90x40x15" |
| 41 |
mlosch |
1.3 |
|
| 42 |
mlosch |
1.6 |
#EXE='mpiexec.hydra -bootstrap slurm -n TR_NPROC ./mitgcmuv' |
| 43 |
mlosch |
1.1 |
#EXE='srun --mpi=pmi2 -n TR_NPROC ./mitgcmuv' |
| 44 |
mlosch |
1.6 |
EXE='srun -n TR_NPROC ./mitgcmuv' |
| 45 |
mlosch |
1.1 |
|
| 46 |
|
|
if [ -e $TST_DIR ]; then |
| 47 |
|
|
echo "$TST_DIR exists" |
| 48 |
|
|
else |
| 49 |
|
|
mkdir $TST_DIR |
| 50 |
|
|
fi |
| 51 |
|
|
cd $TST_DIR |
| 52 |
|
|
HERE=$TST_DIR/output |
| 53 |
|
|
if [ -e $HERE ]; then |
| 54 |
|
|
echo "$HERE" |
| 55 |
|
|
else |
| 56 |
|
|
mkdir $HERE |
| 57 |
|
|
fi |
| 58 |
mlosch |
1.2 |
OUTFILE=$HERE/slurm_${sfx}.out |
| 59 |
mlosch |
1.1 |
MYOUTPUT=$HERE/out_$sfx |
| 60 |
|
|
if [ -e $MYOUTPUT ]; then |
| 61 |
|
|
rm -rf $MYOUTPUT |
| 62 |
|
|
fi |
| 63 |
|
|
if [ -e $OUTFILE ]; then |
| 64 |
|
|
rm -r $OUTFILE |
| 65 |
|
|
fi |
| 66 |
mlosch |
1.6 |
gcmDIR="MITgcm_${sfx}_git" |
| 67 |
|
|
git_repo='MITgcm' |
| 68 |
|
|
git_code='MITgcm' |
| 69 |
|
|
|
| 70 |
|
|
# checkOut determines how much checking out is being done |
| 71 |
|
|
# checkOut = 3: new clone from GitHub and make a new copy |
| 72 |
|
|
# checkOut = 2: update (git pull) existing repo and make a new copy |
| 73 |
|
|
# checkOut = 1: skip update |
| 74 |
|
|
# checkOut = 0: use existing test code (if available otherwise switch to 1) |
| 75 |
|
|
|
| 76 |
|
|
checkOut=2 |
| 77 |
|
|
tdir=${TST_DIR} |
| 78 |
|
|
today=`date +%Y%m%d` |
| 79 |
|
|
TODAY=`date +%d` |
| 80 |
|
|
#tmpFil="/tmp/"`basename $0`".$$" |
| 81 |
|
|
tmpFil=$TST_DIR/error.out |
| 82 |
|
|
|
| 83 |
|
|
if [ $checkOut -le 1 ] ; then |
| 84 |
|
|
if test -e $TST_DIR/${gcmDIR}/doc ; then |
| 85 |
|
|
echo $TST_DIR/${gcmDIR}/doc 'exist' |
| 86 |
|
|
else |
| 87 |
|
|
echo -n $TST_DIR/${gcmDIR} 'missing ; ' |
| 88 |
|
|
checkOut=2 |
| 89 |
|
|
echo "will make a new copy ( checkOut=$checkOut )" |
| 90 |
mlosch |
1.1 |
fi |
| 91 |
mlosch |
1.6 |
fi |
| 92 |
|
|
|
| 93 |
|
|
if [ $checkOut -ge 2 ] ; then |
| 94 |
|
|
#---- cleaning: |
| 95 |
|
|
cd $TST_DIR |
| 96 |
|
|
|
| 97 |
|
|
#---- Make a new clone or update existing one: |
| 98 |
|
|
if test -e ${gcmDIR}/.git/config ; then |
| 99 |
|
|
echo "${gcmDIR}/.git/config exist" |
| 100 |
|
|
else |
| 101 |
|
|
echo -n "${gcmDIR}/.git/config 'missing" |
| 102 |
|
|
checkOut=3 |
| 103 |
|
|
echo "will get new clone ( checkOut=$checkOut )" |
| 104 |
|
|
fi |
| 105 |
|
|
if [ $checkOut -eq 3 ] ; then |
| 106 |
|
|
echo -n "Removing old clone: $TST_DIR/${gcmDIR} ..." |
| 107 |
|
|
test -e $TST_DIR/${gcmDIR} && rm -rf $TST_DIR/${gcmDIR} |
| 108 |
|
|
echo " done" |
| 109 |
|
|
echo -n "Make a new clone of $git_code from repo: $git_repo ..." |
| 110 |
|
|
git clone https://github.com/$git_repo/${git_code}.git ${gcmDIR} 2> $tmpFil |
| 111 |
|
|
retVal=$? |
| 112 |
|
|
if test $retVal = 0 ; then |
| 113 |
|
|
echo ' --> done!' |
| 114 |
|
|
rm -f $tmpFil |
| 115 |
|
|
else |
| 116 |
|
|
echo " Error: 'git clone' returned: $retVal" |
| 117 |
|
|
cat $tmpFil |
| 118 |
|
|
rm -f $tmpFil |
| 119 |
|
|
exit 2 |
| 120 |
|
|
fi |
| 121 |
|
|
else |
| 122 |
|
|
echo "Updating current clone ( $git_code ) ..." |
| 123 |
|
|
( cd ${gcmDIR}; git checkout master ; git pull ) |
| 124 |
|
|
echo ' --> done!' |
| 125 |
mlosch |
1.1 |
fi |
| 126 |
mlosch |
1.6 |
else |
| 127 |
|
|
cd $TST_DIR |
| 128 |
mlosch |
1.1 |
fi |
| 129 |
|
|
|
| 130 |
mlosch |
1.6 |
cd ${TST_DIR}/{gcmDIR}/verification |
| 131 |
mlosch |
1.1 |
|
| 132 |
mlosch |
1.4 |
cwd=\`pwd\` |
| 133 |
mlosch |
1.3 |
SENDCMD="ssh ollie0 ${TST_DIR}/${gcmDIR}/tools/mpack-1.6/mpack" |
| 134 |
|
|
runtestreport="./testreport $options -of $OPTFILE -command \"${EXE}\" -send \"${SENDCMD}\" -sd ${cwd}" |
| 135 |
mlosch |
1.1 |
|
| 136 |
|
|
if [ ! -e $MYOUTPUT ] |
| 137 |
|
|
then |
| 138 |
|
|
touch $MYOUTPUT |
| 139 |
|
|
fi |
| 140 |
|
|
|
| 141 |
mlosch |
1.2 |
# echo "running testreport like this:" |
| 142 |
|
|
# echo ${runtestreport} -norun |
| 143 |
|
|
# eval "${runtestreport} -norun >> $MYOUTPUT 2>&1" |
| 144 |
mlosch |
1.1 |
|
| 145 |
|
|
# create batch script |
| 146 |
|
|
# |
| 147 |
mlosch |
1.2 |
JOBNAME=tst$sfx |
| 148 |
mlosch |
1.1 |
echo "creating batch script $HERE/$RUNIT" |
| 149 |
|
|
cat << EOF >| $HERE/$RUNIT |
| 150 |
mlosch |
1.3 |
#!/bin/bash |
| 151 |
mlosch |
1.1 |
#SBATCH --job-name=${JOBNAME} |
| 152 |
|
|
#SBATCH -o ${OUTFILE} |
| 153 |
mlosch |
1.3 |
#SBATCH --time=6:00:00 |
| 154 |
mlosch |
1.1 |
#SBATCH --ntasks=6 |
| 155 |
|
|
|
| 156 |
mlosch |
1.3 |
# still need this to be able to run a few experiments: |
| 157 |
|
|
# cfc_example, fizhi, tutorial_deep_convection |
| 158 |
|
|
ulimit -s unlimited |
| 159 |
mlosch |
1.1 |
|
| 160 |
mlosch |
1.6 |
# binds OpenMP task to given cores |
| 161 |
|
|
export OMP_PROC_BIND=TRUE |
| 162 |
|
|
|
| 163 |
|
|
# for debugging |
| 164 |
|
|
export FLEXLM_DIAGNOSTICS=2 |
| 165 |
|
|
export FNP_IP_ENV=1 |
| 166 |
|
|
export LM_A_CONN_TIMEOUT=99 |
| 167 |
|
|
|
| 168 |
mlosch |
1.1 |
cd \${SLURM_SUBMIT_DIR} |
| 169 |
|
|
|
| 170 |
mlosch |
1.3 |
cwd=`pwd` |
| 171 |
|
|
echo "running testreport like this in \${cwd}:" |
| 172 |
|
|
echo "${runtestreport} -devel -match 10" |
| 173 |
mlosch |
1.6 |
${runtestreport} -devel -match 10 -a jm_c@mitgcm.org >> $MYOUTPUT 2>&1 |
| 174 |
mlosch |
1.3 |
|
| 175 |
|
|
echo "running testreport like this in \${cwd}:" |
| 176 |
|
|
echo "./testreport -clean" |
| 177 |
|
|
./testreport -clean |
| 178 |
|
|
|
| 179 |
|
|
echo "running testreport like this in \${cwd}:" |
| 180 |
|
|
echo "${runtestreport} -fast -match 10" |
| 181 |
mlosch |
1.6 |
${runtestreport} -fast -match 10 -a jm_c@mitgcm.org >> $MYOUTPUT 2>&1 |
| 182 |
mlosch |
1.1 |
|
| 183 |
|
|
EOF |
| 184 |
|
|
|
| 185 |
|
|
chmod a+x $HERE/$RUNIT |
| 186 |
|
|
|
| 187 |
|
|
echo " " >> $MYOUTPUT |
| 188 |
|
|
echo "***********************************************************" >> $MYOUTPUT |
| 189 |
|
|
echo "Submitting this job script:" >> $MYOUTPUT |
| 190 |
|
|
echo "***********************************************************" >> $MYOUTPUT |
| 191 |
|
|
cat $HERE/$RUNIT >> $MYOUTPUT |
| 192 |
|
|
echo "***********************************************************" >> $MYOUTPUT |
| 193 |
|
|
echo "end of job script" >> $MYOUTPUT |
| 194 |
|
|
echo "***********************************************************" >> $MYOUTPUT |
| 195 |
|
|
echo " " >> $MYOUTPUT |
| 196 |
|
|
|
| 197 |
mlosch |
1.6 |
echo "sbatch $HERE/$RUNIT" |
| 198 |
mlosch |
1.1 |
sbatch $HERE/$RUNIT |
| 199 |
|
|
|
| 200 |
mlosch |
1.3 |
# # keep looking for the job in the job queues and wait until it has disappeared |
| 201 |
|
|
# jobruns=somedummy |
| 202 |
|
|
# while [ "${jobruns}"x != x ] |
| 203 |
|
|
# do |
| 204 |
|
|
# sleep 200 |
| 205 |
|
|
# jobruns=`squeue --noheader -u mlosch | grep "$JOBNAME" | awk '{print $1}'` |
| 206 |
|
|
# echo "waiting for job ${jobruns%% *} ($JOBNAME) to complete" |
| 207 |
|
|
# currentexp=`grep Experiment $MYOUTPUT | tail -1` |
| 208 |
|
|
# echo "currently running $currentexp" |
| 209 |
|
|
# done |
| 210 |
|
|
|
| 211 |
|
|
# # workaround for mailing the stuff |
| 212 |
|
|
# echo "mail the stuff" |
| 213 |
|
|
|
| 214 |
|
|
# MPACKCMD=../tools/mpack-1.6/mpack |
| 215 |
|
|
# fn=`ls -dtr tr_$dNam* | grep -v tar.gz | tail -1` |
| 216 |
|
|
# echo "fname ${fn}" |
| 217 |
|
|
# tar cf - $fn | gzip > "${fn}.tar.gz" |
| 218 |
mlosch |
1.6 |
# $MPACKCMD -s MITgcm-test -m 3555000 ${fn}.tar.gz jm_c@mitgcm.org |
| 219 |
mlosch |
1.3 |
# sleep 2 |
| 220 |
|
|
# rm -rf "${fn}.tar.gz" |
| 221 |
mlosch |
1.1 |
|
| 222 |
|
|
echo "end of mitgcmtestreport" |
| 223 |
|
|
|
| 224 |
|
|
|
| 225 |
|
|
|
| 226 |
|
|
|
| 227 |
|
|
|