1 |
#!/bin/bash -e |
#!/bin/bash -e |
2 |
# new script for running testreport on ollie.awi.de |
# new script for running testreport on ollie.awi.de |
3 |
# - split the testreport into 2 steps: |
# - compile and run on compute nodes |
4 |
# 1/ compiling on head node, with -norun option |
# - use ssh to call mpack command from the head node ollie0 |
|
# 2/ running on compute node (using SBATCH), with -runonly option |
|
5 |
#$Header$ |
#$Header$ |
6 |
#$Name$ |
#$Name$ |
7 |
|
|
11 |
source /etc/profile.d/AWI.sh |
source /etc/profile.d/AWI.sh |
12 |
# |
# |
13 |
module purge |
module purge |
14 |
module load slurm |
module load PrgEnv-cray/1.0.2_ollie |
15 |
module load craype-broadwell |
module load netcdf |
16 |
module load PrgEnv-cray/1.0.0 |
#export LD_LIBRARY_PATH=${CRAY_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}: |
17 |
module unload cudatoolkit |
# not sure why I have to set these paths here again |
18 |
module swap mvapich2_cce cray-impi |
export MPI_ROOT=$(dirname $(dirname `which mpicc`)) |
19 |
module load intel/impi-5.1.3 |
# $(dirname `echo $LD_LIBRARY_PATH | awk -F: '{print $1}'`) |
20 |
export LD_LIBRARY_PATH=${CRAY_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}: |
export MPI_INC_DIR=${MPI_ROOT}/include |
21 |
|
|
22 |
|
# there is no slurm module anymore and this is the current recommendation to |
23 |
|
# have sbatch in your path (rather than running /etc/profile.d./slurm.sh) |
24 |
|
export PATH=${PATH}:/global/opt/slurm/default/bin |
25 |
|
|
26 |
dNam='ollie' |
dNam='ollie' |
27 |
TST_DIR="/work/ollie/mlosch/test_$dNam" |
TST_DIR="/work/ollie/mlosch/test_$dNam" |
29 |
|
|
30 |
umask 0022 |
umask 0022 |
31 |
|
|
32 |
sfx='ftn' |
sfx='cray' |
33 |
RUNIT="runit_"$sfx |
RUNIT="runit_"$sfx |
34 |
|
|
35 |
OPTFILE=../tools/build_options/linux_ia64_cray_ollie |
OPTFILE=../tools/build_options/linux_ia64_${sfx}_ollie |
36 |
options="-MPI 6" |
options="-MPI 6" |
37 |
options="$options -odir $dNam" |
options="$options -odir ${dNam}-c" |
38 |
options="$options -devel" |
options="$options -j 6" |
39 |
#options="$options -j 2" |
#options="$options -t global_ocean.cs32x15" |
40 |
#options="$options -j 6" |
|
41 |
#options="$options -t global_ocean.90x40x15" |
#EXE='srun --mpi=pmi2 -n TR_NPROC ./mitgcmuv' |
42 |
#EXE='mpiexec.hydra -bootstrap slurm -n TR_NPROC ./mitgcmuv' |
#EXE='srun -n TR_NPROC ./mitgcmuv' |
43 |
EXE='srun --mpi=pmi2 -n TR_NPROC ./mitgcmuv' |
EXE='srun -n TR_NPROC --cpu_bind=cores ./mitgcmuv' |
44 |
|
|
45 |
if [ -e $TST_DIR ]; then |
if [ -e $TST_DIR ]; then |
46 |
echo "$TST_DIR exists" |
echo "$TST_DIR exists" |
54 |
else |
else |
55 |
mkdir $HERE |
mkdir $HERE |
56 |
fi |
fi |
57 |
OUTFILE=$HERE/testreport.out |
OUTFILE=$HERE/slurm_${sfx}.out |
58 |
MYOUTPUT=$HERE/out_$sfx |
MYOUTPUT=$HERE/out_$sfx |
59 |
if [ -e $MYOUTPUT ]; then |
if [ -e $MYOUTPUT ]; then |
60 |
rm -rf $MYOUTPUT |
rm -rf $MYOUTPUT |
62 |
if [ -e $OUTFILE ]; then |
if [ -e $OUTFILE ]; then |
63 |
rm -r $OUTFILE |
rm -r $OUTFILE |
64 |
fi |
fi |
65 |
gcmDIR="MITgcm_$sfx" |
gcmDIR="MITgcm_${sfx}" |
66 |
#gcmDIR="MITgcm" |
git_repo='MITgcm' |
67 |
checkOut=1 |
git_code='MITgcm' |
68 |
if [ $checkOut -eq 1 ] ; then |
|
69 |
if test -d $gcmDIR/CVS ; then |
# checkOut determines how much checking out is being done |
70 |
/bin/rm -rf $gcmDIR/verification/??_${dNam}_????????_? |
# checkOut = 3: new clone from GitHub and make a new copy |
71 |
( cd $gcmDIR/verification ; ../tools/do_tst_2+2 -clean ) |
# checkOut = 2: update (git pull) existing repo and make a new copy |
72 |
echo "cvs update of dir $gcmDIR :" |
# checkOut = 1: skip update |
73 |
( cd $gcmDIR ; cvs -q -d :pserver:cvsanon@mitgcm.org:/u/gcmpack update -P -d ) 2>&1 |
# checkOut = 0: use existing test code (if available otherwise switch to 1) |
74 |
RETVAL=$? |
|
75 |
if test "x$RETVAL" != x0 ; then |
checkOut=2 |
76 |
echo "cvs update on '"`hostname`"' failed (return val=$RETVAL) => exit" |
tdir=${TST_DIR} |
77 |
exit |
today=`date +%Y%m%d` |
78 |
|
TODAY=`date +%d` |
79 |
|
#tmpFil="/tmp/"`basename $0`".$$" |
80 |
|
tmpFil=$TST_DIR/error.out |
81 |
|
|
82 |
|
if [ $checkOut -le 1 ] ; then |
83 |
|
if test -e $TST_DIR/${gcmDIR}/doc ; then |
84 |
|
echo $TST_DIR/${gcmDIR}/doc 'exist' |
85 |
|
else |
86 |
|
echo -n $TST_DIR/${gcmDIR} 'missing ; ' |
87 |
|
checkOut=2 |
88 |
|
echo "will make a new copy ( checkOut=$checkOut )" |
89 |
fi |
fi |
90 |
else |
fi |
91 |
echo "no dir: $gcmDIR/CVS => try a fresh check-out" |
|
92 |
checkOut=2 |
if [ $checkOut -ge 2 ] ; then |
93 |
fi |
#---- cleaning: |
94 |
fi |
cd $TST_DIR |
95 |
if [ $checkOut -eq 2 ] ; then |
|
96 |
if test -e $gcmDIR ; then |
#---- Make a new clone or update existing one: |
97 |
rm -rf $gcmDIR |
if test -e ${gcmDIR}/.git/config ; then |
98 |
|
echo "${gcmDIR}/.git/config exist" |
99 |
|
else |
100 |
|
echo -n "${gcmDIR}/.git/config 'missing " |
101 |
|
checkOut=3 |
102 |
|
echo "will get new clone ( checkOut=$checkOut )" |
103 |
|
fi |
104 |
|
if [ $checkOut -eq 3 ] ; then |
105 |
|
echo -n "Removing old clone: $TST_DIR/${gcmDIR} ..." |
106 |
|
test -e $TST_DIR/${gcmDIR} && rm -rf $TST_DIR/${gcmDIR} |
107 |
|
echo " done" |
108 |
|
echo -n "Make a new clone of $git_code from repo: $git_repo ..." |
109 |
|
git clone https://github.com/$git_repo/${git_code}.git ${gcmDIR} 2> $tmpFil |
110 |
|
retVal=$? |
111 |
|
if test $retVal = 0 ; then |
112 |
|
echo ' --> done!' |
113 |
|
rm -f $tmpFil |
114 |
|
else |
115 |
|
echo " Error: 'git clone' returned: $retVal" |
116 |
|
cat $tmpFil |
117 |
|
rm -f $tmpFil |
118 |
|
exit 2 |
119 |
|
fi |
120 |
|
else |
121 |
|
echo "Updating current clone ( $git_code ) ..." |
122 |
|
( cd ${gcmDIR}; git checkout master ; git pull ) |
123 |
|
echo ' --> done!' |
124 |
fi |
fi |
125 |
# cvs co MITgcm |
else |
126 |
cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack co -P -d $gcmDIR MITgcm > /dev/null 2>&1 |
cd $TST_DIR |
|
/usr/bin/find $gcmDIR -type d | xargs chmod g+rxs |
|
|
/usr/bin/find $gcmDIR -type f | xargs chmod g+r |
|
127 |
fi |
fi |
128 |
|
|
129 |
cd ${gcmDIR}/verification |
cd ${TST_DIR}/${gcmDIR}/verification |
130 |
|
|
131 |
runtestreport="./testreport $options -of $OPTFILE -command \"${EXE}\"" |
cwd=\`pwd\` |
132 |
|
SENDCMD="ssh ollie0 ${TST_DIR}/${gcmDIR}/tools/mpack-1.6/mpack" |
133 |
|
runtestreport="./testreport $options -of $OPTFILE -command \"${EXE}\" -send \"${SENDCMD}\" -sd ${cwd}" |
134 |
|
emailaddress="-a jm_c@mitgcm.org" |
135 |
|
|
136 |
if [ ! -e $MYOUTPUT ] |
if [ ! -e $MYOUTPUT ] |
137 |
then |
then |
138 |
touch $MYOUTPUT |
touch $MYOUTPUT |
139 |
fi |
fi |
140 |
|
|
141 |
echo "running testreport like this:" |
# echo "running testreport like this:" |
142 |
echo ${runtestreport} -norun |
# echo ${runtestreport} -norun |
143 |
eval "${runtestreport} -norun >> $MYOUTPUT 2>&1" |
# eval "${runtestreport} -norun >> $MYOUTPUT 2>&1" |
144 |
|
|
145 |
# create batch script |
# create batch script |
146 |
# |
# |
147 |
JOBNAME=tstoll |
JOBNAME=tst$sfx |
148 |
echo "creating batch script $HERE/$RUNIT" |
echo "creating batch script $HERE/$RUNIT" |
149 |
cat << EOF >| $HERE/$RUNIT |
cat << EOF >| $HERE/$RUNIT |
150 |
#!/bin/bash -x |
#!/bin/bash |
151 |
#SBATCH --job-name=${JOBNAME} |
#SBATCH --job-name=${JOBNAME} |
152 |
#SBATCH -o ${OUTFILE} |
#SBATCH -o ${OUTFILE} |
153 |
#SBATCH --time=3:00:00 |
#SBATCH --time=12:00:00 |
154 |
#SBATCH --ntasks=6 |
#SBATCH --ntasks=6 |
|
#SBATCH -p smp |
|
|
#SBATCH --qos=short |
|
155 |
|
|
156 |
ulimit -s 1048576 |
# still need this to be able to run a few experiments: |
157 |
|
# cfc_example, fizhi, tutorial_deep_convection |
158 |
|
ulimit -s unlimited |
159 |
|
|
160 |
|
# 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 |
cd \${SLURM_SUBMIT_DIR} |
cd \${SLURM_SUBMIT_DIR} |
169 |
|
|
170 |
echo "running testreport like this:" |
cwd=`pwd` |
171 |
echo "${runtestreport} -runonly" |
echo "running testreport like this in \${cwd}:" |
172 |
#${runtestreport} -runonly -match 10 -a 'Martin.Losch@awi.de' >> $MYOUTPUT |
echo "${runtestreport} -devel -match 10" |
173 |
${runtestreport} -runonly -match 10 -a 'jmc@mitcm.org' >> $MYOUTPUT |
${runtestreport} -devel -match 10 ${emailaddress} >> $MYOUTPUT 2>&1 |
174 |
|
|
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 |
|
${runtestreport} -fast -match 10 ${emailaddress} >> $MYOUTPUT 2>&1 |
182 |
|
|
183 |
EOF |
EOF |
184 |
|
|
194 |
echo "***********************************************************" >> $MYOUTPUT |
echo "***********************************************************" >> $MYOUTPUT |
195 |
echo " " >> $MYOUTPUT |
echo " " >> $MYOUTPUT |
196 |
|
|
197 |
|
echo "sbatch $HERE/$RUNIT" |
198 |
sbatch $HERE/$RUNIT |
sbatch $HERE/$RUNIT |
199 |
|
|
200 |
# keep looking for the job in the job queues and wait until has disappeared |
# # keep looking for the job in the job queues and wait until it has disappeared |
201 |
jobruns=somedummy |
# jobruns=somedummy |
202 |
while [ "${jobruns}"x != x ] |
# while [ "${jobruns}"x != x ] |
203 |
do |
# do |
204 |
sleep 20 |
# sleep 200 |
205 |
jobruns=`squeue --noheader -u mlosch | grep "$JOBNAME" | awk '{print $1}'` |
# jobruns=`squeue --noheader -u mlosch | grep "$JOBNAME" | awk '{print $1}'` |
206 |
echo "waiting for job ${jobruns%% *} ($JOBNAME) to complete" |
# echo "waiting for job ${jobruns%% *} ($JOBNAME) to complete" |
207 |
currentexp=`grep Experiment $MYOUTPUT | tail -1` |
# currentexp=`grep Experiment $MYOUTPUT | tail -1` |
208 |
echo "currently running $currentexp" |
# echo "currently running $currentexp" |
209 |
done |
# done |
210 |
|
|
211 |
|
# # workaround for mailing the stuff |
212 |
|
# echo "mail the stuff" |
213 |
|
|
|
# # after running the experiments send email to jmc (cannot be done from |
|
|
# # the compute node, yet) |
|
214 |
# MPACKCMD=../tools/mpack-1.6/mpack |
# MPACKCMD=../tools/mpack-1.6/mpack |
215 |
# fn=`ls -dtr tr_ollie* | grep -v tar.gz | tail -1` |
# fn=`ls -dtr tr_$dNam* | grep -v tar.gz | tail -1` |
216 |
# echo "fn $fn" |
# echo "fname ${fn}" |
217 |
# tar cf - $fn | gzip > "${fn}.tar.gz" |
# tar cf - $fn | gzip > "${fn}.tar.gz" |
218 |
# ../tools/mpack-1.6/mpack -s MITgcm-test -m 3555000 ${fn}.tar.gz mlosch@awi.de |
# $MPACKCMD -s MITgcm-test -m 3555000 ${fn}.tar.gz jm_c@mitgcm.org |
219 |
# sleep 2 |
# sleep 2 |
220 |
# \rm -f ${fn}.tar.gz |
# rm -rf "${fn}.tar.gz" |
|
# ../tools/mpack-1.6/mpack -s MITgcm-test -m 3555000 ${fn}.tar.gz jmc@mitgcm.org |
|
|
|
|
|
# after running the experiments on the compute node run testreport |
|
|
# for a third time to evaluate results on the head node again |
|
|
# echo " " >> $MYOUTPUT |
|
|
# echo "now run testreport for a final time to evaluate results:" >> $MYOUTPUT |
|
|
# echo "$RUNTESTREPORT -match 10 -runonly" >> $MYOUTPUT |
|
|
# #$RUNTESTREPORT -match 10 -runonly >> $MYOUTPUT 2>&1 |
|
|
# $RUNTESTREPORT -match 10 -runonly \ |
|
|
# -a "jmc@mitgcm.org" >> $MYOUTPUT 2>&1 |
|
|
# # -a "jmc@mitgcm.org, Martin.Losch@awi.de" >> $MYOUTPUT 2>&1 |
|
|
|
|
|
# workaround for mailing the stuff |
|
|
echo "mail the stuff" |
|
|
# 1. set name of remote host where to do the mpack command |
|
|
# 2. pack directory into an archive an compress it |
|
|
# 3. copy gzipped archive to remote host |
|
|
# 4. on the remote host execute the mpack command, that send the email |
|
|
# 5. wait a little, just to be sure everything is done |
|
|
# 6. remove archives |
|
|
MPACKCMD=\${HOME}/bin/mpack |
|
|
rmhost=rayl4.awi.de |
|
|
pwd |
|
|
fn=`ls -dtr tr_ollie* | grep -v tar.gz | tail -1` |
|
|
echo "fname ${fn}" |
|
|
tar cf - $fn | gzip > "${fn}.tar.gz" |
|
|
eval "scp ${fn}.tar.gz ${rmhost}:" |
|
|
#ssh -Y $rmhost "$MPACKCMD -s MITgcm-test -m 3555000 ${fn}.tar.gz mlosch@awi.de" |
|
|
ssh -Y $rmhost "$MPACKCMD -s MITgcm-test -m 3555000 ${fn}.tar.gz jmc@mitgcm.org" |
|
|
sleep 2 |
|
|
ssh -Y $rmhost "rm -f ${fn}.tar.gz" |
|
|
rm -rf "${fn}.tar.gz" |
|
|
# end workaround for mailing the stuff |
|
221 |
|
|
222 |
echo "end of mitgcmtestreport" |
echo "end of mitgcmtestreport" |
223 |
|
|