| 1 |
mlosch |
1.1 |
#!/bin/bash -e |
| 2 |
|
|
# new script for running testreport on ollie.awi.de |
| 3 |
|
|
# - split the testreport into 2 steps: |
| 4 |
|
|
# 1/ compiling on head node, with -norun option |
| 5 |
|
|
# 2/ running on compute node (using SBATCH), with -runonly option |
| 6 |
|
|
#$Header: $ |
| 7 |
|
|
#$Name: $ |
| 8 |
|
|
|
| 9 |
|
|
# needed for cron-job |
| 10 |
|
|
source /usr/Modules/3.2.10/init/bash |
| 11 |
|
|
source /etc/profile.d/cray_pe.sh |
| 12 |
|
|
source /etc/profile.d/AWI.sh |
| 13 |
|
|
# |
| 14 |
|
|
module purge |
| 15 |
|
|
module load slurm |
| 16 |
|
|
module load intel.compiler |
| 17 |
|
|
module load intel.mpi |
| 18 |
|
|
module load netcdf/4.4.0_intel |
| 19 |
|
|
export LD_LIBRARY_PATH=${CRAY_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}: |
| 20 |
|
|
|
| 21 |
|
|
export MPI_ROOT=$(dirname $(dirname `which mpiifort`)) |
| 22 |
|
|
export MPI_INC_DIR=${MPI_ROOT}/include64 |
| 23 |
|
|
|
| 24 |
|
|
dNam='ollie' |
| 25 |
|
|
TST_DIR="/work/ollie/mlosch/test_$dNam" |
| 26 |
|
|
echo "start from TST_DIR='$TST_DIR' at: "`date` |
| 27 |
|
|
|
| 28 |
|
|
umask 0022 |
| 29 |
|
|
|
| 30 |
|
|
sfx='ifort' |
| 31 |
|
|
RUNIT="runit_"$sfx |
| 32 |
|
|
|
| 33 |
|
|
OPTFILE=../tools/build_options/linux_ia64_ifort_ollie |
| 34 |
|
|
options="-MPI 6" |
| 35 |
|
|
options="$options -odir $dNam" |
| 36 |
|
|
options="$options -devel" |
| 37 |
|
|
#options="$options -j 2" |
| 38 |
|
|
options="$options -j 6" |
| 39 |
|
|
#options="$options -t global_ocean.90x40x15" |
| 40 |
|
|
EXE='mpiexec.hydra -bootstrap slurm -n TR_NPROC ./mitgcmuv' |
| 41 |
|
|
#EXE='srun --mpi=pmi2 -n TR_NPROC ./mitgcmuv' |
| 42 |
|
|
|
| 43 |
|
|
if [ -e $TST_DIR ]; then |
| 44 |
|
|
echo "$TST_DIR exists" |
| 45 |
|
|
else |
| 46 |
|
|
mkdir $TST_DIR |
| 47 |
|
|
fi |
| 48 |
|
|
cd $TST_DIR |
| 49 |
|
|
HERE=$TST_DIR/output |
| 50 |
|
|
if [ -e $HERE ]; then |
| 51 |
|
|
echo "$HERE" |
| 52 |
|
|
else |
| 53 |
|
|
mkdir $HERE |
| 54 |
|
|
fi |
| 55 |
|
|
OUTFILE=$HERE/testreport.out |
| 56 |
|
|
MYOUTPUT=$HERE/out_$sfx |
| 57 |
|
|
if [ -e $MYOUTPUT ]; then |
| 58 |
|
|
rm -rf $MYOUTPUT |
| 59 |
|
|
fi |
| 60 |
|
|
if [ -e $OUTFILE ]; then |
| 61 |
|
|
rm -r $OUTFILE |
| 62 |
|
|
fi |
| 63 |
|
|
gcmDIR="MITgcm_$sfx" |
| 64 |
|
|
#gcmDIR="MITgcm" |
| 65 |
|
|
checkOut=1 |
| 66 |
|
|
if [ $checkOut -eq 1 ] ; then |
| 67 |
|
|
if test -d $gcmDIR/CVS ; then |
| 68 |
|
|
/bin/rm -rf $gcmDIR/verification/??_${dNam}_????????_? |
| 69 |
|
|
( cd $gcmDIR/verification ; ../tools/do_tst_2+2 -clean ) |
| 70 |
|
|
echo "cvs update of dir $gcmDIR :" |
| 71 |
|
|
( cd $gcmDIR ; cvs -q -d :pserver:cvsanon@mitgcm.org:/u/gcmpack update -P -d ) 2>&1 |
| 72 |
|
|
RETVAL=$? |
| 73 |
|
|
if test "x$RETVAL" != x0 ; then |
| 74 |
|
|
echo "cvs update on '"`hostname`"' failed (return val=$RETVAL) => exit" |
| 75 |
|
|
exit |
| 76 |
|
|
fi |
| 77 |
|
|
else |
| 78 |
|
|
echo "no dir: $gcmDIR/CVS => try a fresh check-out" |
| 79 |
|
|
checkOut=2 |
| 80 |
|
|
fi |
| 81 |
|
|
fi |
| 82 |
|
|
if [ $checkOut -eq 2 ] ; then |
| 83 |
|
|
if test -e $gcmDIR ; then |
| 84 |
|
|
rm -rf $gcmDIR |
| 85 |
|
|
fi |
| 86 |
|
|
# cvs co MITgcm |
| 87 |
|
|
cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack co -P -d $gcmDIR MITgcm > /dev/null 2>&1 |
| 88 |
|
|
/usr/bin/find $gcmDIR -type d | xargs chmod g+rxs |
| 89 |
|
|
/usr/bin/find $gcmDIR -type f | xargs chmod g+r |
| 90 |
|
|
fi |
| 91 |
|
|
|
| 92 |
|
|
cd ${gcmDIR}/verification |
| 93 |
|
|
|
| 94 |
|
|
runtestreport="./testreport $options -of $OPTFILE -command \"${EXE}\"" |
| 95 |
|
|
|
| 96 |
|
|
if [ ! -e $MYOUTPUT ] |
| 97 |
|
|
then |
| 98 |
|
|
touch $MYOUTPUT |
| 99 |
|
|
fi |
| 100 |
|
|
|
| 101 |
|
|
echo "running testreport like this:" |
| 102 |
|
|
echo ${runtestreport} -norun |
| 103 |
|
|
eval "${runtestreport} -norun >> $MYOUTPUT 2>&1" |
| 104 |
|
|
|
| 105 |
|
|
# create batch script |
| 106 |
|
|
# |
| 107 |
|
|
JOBNAME=tstoll |
| 108 |
|
|
echo "creating batch script $HERE/$RUNIT" |
| 109 |
|
|
cat << EOF >| $HERE/$RUNIT |
| 110 |
|
|
#!/bin/bash -x |
| 111 |
|
|
#SBATCH --job-name=${JOBNAME} |
| 112 |
|
|
#SBATCH -o ${OUTFILE} |
| 113 |
|
|
#SBATCH --time=3:00:00 |
| 114 |
|
|
#SBATCH --ntasks=6 |
| 115 |
|
|
#SBATCH -p smp |
| 116 |
|
|
#SBATCH --qos=short |
| 117 |
|
|
|
| 118 |
|
|
ulimit -s 1048576 |
| 119 |
|
|
|
| 120 |
|
|
cd \${SLURM_SUBMIT_DIR} |
| 121 |
|
|
|
| 122 |
|
|
echo "running testreport like this:" |
| 123 |
|
|
echo "${runtestreport} -runonly" |
| 124 |
|
|
#${runtestreport} -runonly -match 10 -a 'Martin.Losch@awi.de' >> $MYOUTPUT |
| 125 |
|
|
${runtestreport} -runonly -match 10 -a 'jmc@mitcm.org' >> $MYOUTPUT |
| 126 |
|
|
|
| 127 |
|
|
EOF |
| 128 |
|
|
|
| 129 |
|
|
chmod a+x $HERE/$RUNIT |
| 130 |
|
|
|
| 131 |
|
|
echo " " >> $MYOUTPUT |
| 132 |
|
|
echo "***********************************************************" >> $MYOUTPUT |
| 133 |
|
|
echo "Submitting this job script:" >> $MYOUTPUT |
| 134 |
|
|
echo "***********************************************************" >> $MYOUTPUT |
| 135 |
|
|
cat $HERE/$RUNIT >> $MYOUTPUT |
| 136 |
|
|
echo "***********************************************************" >> $MYOUTPUT |
| 137 |
|
|
echo "end of job script" >> $MYOUTPUT |
| 138 |
|
|
echo "***********************************************************" >> $MYOUTPUT |
| 139 |
|
|
echo " " >> $MYOUTPUT |
| 140 |
|
|
|
| 141 |
|
|
sbatch $HERE/$RUNIT |
| 142 |
|
|
|
| 143 |
|
|
# keep looking for the job in the job queues and wait until has disappeared |
| 144 |
|
|
jobruns=somedummy |
| 145 |
|
|
while [ "${jobruns}"x != x ] |
| 146 |
|
|
do |
| 147 |
|
|
sleep 20 |
| 148 |
|
|
jobruns=`squeue --noheader -u mlosch | grep "$JOBNAME" | awk '{print $1}'` |
| 149 |
|
|
echo "waiting for job ${jobruns%% *} ($JOBNAME) to complete" |
| 150 |
|
|
currentexp=`grep Experiment $MYOUTPUT | tail -1` |
| 151 |
|
|
echo "currently running $currentexp" |
| 152 |
|
|
done |
| 153 |
|
|
|
| 154 |
|
|
# # after running the experiments send email to jmc (cannot be done from |
| 155 |
|
|
# # the compute node, yet) |
| 156 |
|
|
# MPACKCMD=../tools/mpack-1.6/mpack |
| 157 |
|
|
# fn=`ls -dtr tr_ollie* | grep -v tar.gz | tail -1` |
| 158 |
|
|
# echo "fn $fn" |
| 159 |
|
|
# tar cf - $fn | gzip > "${fn}.tar.gz" |
| 160 |
|
|
# ../tools/mpack-1.6/mpack -s MITgcm-test -m 3555000 ${fn}.tar.gz mlosch@awi.de |
| 161 |
|
|
# sleep 2 |
| 162 |
|
|
# \rm -f ${fn}.tar.gz |
| 163 |
|
|
# ../tools/mpack-1.6/mpack -s MITgcm-test -m 3555000 ${fn}.tar.gz jmc@mitgcm.org |
| 164 |
|
|
|
| 165 |
|
|
# after running the experiments on the compute node run testreport |
| 166 |
|
|
# for a third time to evaluate results on the head node again |
| 167 |
|
|
# echo " " >> $MYOUTPUT |
| 168 |
|
|
# echo "now run testreport for a final time to evaluate results:" >> $MYOUTPUT |
| 169 |
|
|
# echo "$RUNTESTREPORT -match 10 -runonly" >> $MYOUTPUT |
| 170 |
|
|
# #$RUNTESTREPORT -match 10 -runonly >> $MYOUTPUT 2>&1 |
| 171 |
|
|
# $RUNTESTREPORT -match 10 -runonly \ |
| 172 |
|
|
# -a "jmc@mitgcm.org" >> $MYOUTPUT 2>&1 |
| 173 |
|
|
# # -a "jmc@mitgcm.org, Martin.Losch@awi.de" >> $MYOUTPUT 2>&1 |
| 174 |
|
|
|
| 175 |
|
|
# workaround for mailing the stuff |
| 176 |
|
|
echo "mail the stuff" |
| 177 |
|
|
# 1. set name of remote host where to do the mpack command |
| 178 |
|
|
# 2. pack directory into an archive an compress it |
| 179 |
|
|
# 3. copy gzipped archive to remote host |
| 180 |
|
|
# 4. on the remote host execute the mpack command, that send the email |
| 181 |
|
|
# 5. wait a little, just to be sure everything is done |
| 182 |
|
|
# 6. remove archives |
| 183 |
|
|
MPACKCMD=\${HOME}/bin/mpack |
| 184 |
|
|
rmhost=rayl4.awi.de |
| 185 |
|
|
pwd |
| 186 |
|
|
fn=`ls -dtr tr_ollie* | grep -v tar.gz | tail -1` |
| 187 |
|
|
echo "fname ${fn}" |
| 188 |
|
|
tar cf - $fn | gzip > "${fn}.tar.gz" |
| 189 |
|
|
eval "scp ${fn}.tar.gz ${rmhost}:" |
| 190 |
|
|
#ssh -Y $rmhost "$MPACKCMD -s MITgcm-test -m 3555000 ${fn}.tar.gz mlosch@awi.de" |
| 191 |
|
|
ssh -Y $rmhost "$MPACKCMD -s MITgcm-test -m 3555000 ${fn}.tar.gz jmc@mitgcm.org" |
| 192 |
|
|
sleep 2 |
| 193 |
|
|
ssh -Y $rmhost "rm -f ${fn}.tar.gz" |
| 194 |
|
|
rm -rf "${fn}.tar.gz" |
| 195 |
|
|
# end workaround for mailing the stuff |
| 196 |
|
|
|
| 197 |
|
|
echo "end of mitgcmtestreport" |
| 198 |
|
|
|
| 199 |
|
|
|
| 200 |
|
|
|
| 201 |
|
|
|
| 202 |
|
|
|