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 |
|
|
10 |
source /etc/profile.d/cray_pe.sh |
source /etc/profile.d/cray_pe.sh |
11 |
source /etc/profile.d/AWI.sh |
source /etc/profile.d/AWI.sh |
12 |
# |
# |
13 |
|
|
14 |
module purge |
module purge |
15 |
module load slurm |
module load slurm |
16 |
module load craype-broadwell |
module load craype-broadwell |
17 |
module load PrgEnv-cray/1.0.0 |
module load PrgEnv-cray |
18 |
module unload cudatoolkit |
#export LD_LIBRARY_PATH=${CRAY_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}: |
19 |
module swap mvapich2_cce cray-impi |
# not sure why I have set these paths here again |
20 |
module load intel/impi-5.1.3 |
export MPI_ROOT=$(dirname `echo $LD_LIBRARY_PATH | awk -F: '{print $1}'`) |
21 |
export LD_LIBRARY_PATH=${CRAY_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}: |
export MPI_INC_DIR=${MPI_ROOT}/include |
22 |
|
|
23 |
|
|
24 |
dNam='ollie' |
dNam='ollie' |
25 |
TST_DIR="/work/ollie/mlosch/test_$dNam" |
TST_DIR="/work/ollie/mlosch/test_$dNam" |
27 |
|
|
28 |
umask 0022 |
umask 0022 |
29 |
|
|
30 |
sfx='ftn' |
sfx='cray' |
31 |
RUNIT="runit_"$sfx |
RUNIT="runit_"$sfx |
32 |
|
|
33 |
OPTFILE=../tools/build_options/linux_ia64_cray_ollie |
OPTFILE=../tools/build_options/linux_ia64_${sfx}_ollie |
34 |
options="-MPI 6" |
options="-MPI 6" |
35 |
options="$options -odir $dNam" |
options="$options -odir ${dNam}-c" |
|
options="$options -devel" |
|
|
#options="$options -j 2" |
|
36 |
#options="$options -j 6" |
#options="$options -j 6" |
37 |
#options="$options -t global_ocean.90x40x15" |
#options="$options -t global_ocean.cs32x15" |
38 |
|
|
39 |
#EXE='mpiexec.hydra -bootstrap slurm -n TR_NPROC ./mitgcmuv' |
#EXE='mpiexec.hydra -bootstrap slurm -n TR_NPROC ./mitgcmuv' |
40 |
EXE='srun --mpi=pmi2 -n TR_NPROC ./mitgcmuv' |
EXE='srun --mpi=pmi2 -n TR_NPROC ./mitgcmuv' |
41 |
|
|
51 |
else |
else |
52 |
mkdir $HERE |
mkdir $HERE |
53 |
fi |
fi |
54 |
OUTFILE=$HERE/testreport.out |
OUTFILE=$HERE/slurm_${sfx}.out |
55 |
MYOUTPUT=$HERE/out_$sfx |
MYOUTPUT=$HERE/out_$sfx |
56 |
if [ -e $MYOUTPUT ]; then |
if [ -e $MYOUTPUT ]; then |
57 |
rm -rf $MYOUTPUT |
rm -rf $MYOUTPUT |
60 |
rm -r $OUTFILE |
rm -r $OUTFILE |
61 |
fi |
fi |
62 |
gcmDIR="MITgcm_$sfx" |
gcmDIR="MITgcm_$sfx" |
|
#gcmDIR="MITgcm" |
|
63 |
checkOut=1 |
checkOut=1 |
64 |
if [ $checkOut -eq 1 ] ; then |
if [ $checkOut -eq 1 ] ; then |
65 |
if test -d $gcmDIR/CVS ; then |
if test -d $gcmDIR/CVS ; then |
89 |
|
|
90 |
cd ${gcmDIR}/verification |
cd ${gcmDIR}/verification |
91 |
|
|
92 |
runtestreport="./testreport $options -of $OPTFILE -command \"${EXE}\"" |
cwd=\`pwd\` |
93 |
|
SENDCMD="ssh ollie0 ${TST_DIR}/${gcmDIR}/tools/mpack-1.6/mpack" |
94 |
|
runtestreport="./testreport $options -of $OPTFILE -command \"${EXE}\" -send \"${SENDCMD}\" -sd ${cwd}" |
95 |
|
|
96 |
if [ ! -e $MYOUTPUT ] |
if [ ! -e $MYOUTPUT ] |
97 |
then |
then |
98 |
touch $MYOUTPUT |
touch $MYOUTPUT |
99 |
fi |
fi |
100 |
|
|
101 |
echo "running testreport like this:" |
# echo "running testreport like this:" |
102 |
echo ${runtestreport} -norun |
# echo ${runtestreport} -norun |
103 |
eval "${runtestreport} -norun >> $MYOUTPUT 2>&1" |
# eval "${runtestreport} -norun >> $MYOUTPUT 2>&1" |
104 |
|
|
105 |
# create batch script |
# create batch script |
106 |
# |
# |
107 |
JOBNAME=tstoll |
JOBNAME=tst$sfx |
108 |
echo "creating batch script $HERE/$RUNIT" |
echo "creating batch script $HERE/$RUNIT" |
109 |
cat << EOF >| $HERE/$RUNIT |
cat << EOF >| $HERE/$RUNIT |
110 |
#!/bin/bash -x |
#!/bin/bash |
111 |
#SBATCH --job-name=${JOBNAME} |
#SBATCH --job-name=${JOBNAME} |
112 |
#SBATCH -o ${OUTFILE} |
#SBATCH -o ${OUTFILE} |
113 |
#SBATCH --time=3:00:00 |
#SBATCH --time=12:00:00 |
114 |
#SBATCH --ntasks=6 |
#SBATCH --ntasks=6 |
|
#SBATCH -p smp |
|
|
#SBATCH --qos=short |
|
115 |
|
|
116 |
ulimit -s 1048576 |
# still need this to be able to run a few experiments: |
117 |
|
# cfc_example, fizhi, tutorial_deep_convection |
118 |
|
ulimit -s unlimited |
119 |
|
|
120 |
cd \${SLURM_SUBMIT_DIR} |
cd \${SLURM_SUBMIT_DIR} |
121 |
|
|
122 |
echo "running testreport like this:" |
cwd=`pwd` |
123 |
echo "${runtestreport} -runonly" |
echo "running testreport like this in \${cwd}:" |
124 |
#${runtestreport} -runonly -match 10 -a 'Martin.Losch@awi.de' >> $MYOUTPUT |
echo "${runtestreport} -devel -match 10" |
125 |
${runtestreport} -runonly -match 10 -a 'jmc@mitcm.org' >> $MYOUTPUT |
${runtestreport} -devel -match 10 -a jmc@mitgcm.org >> $MYOUTPUT 2>&1 |
126 |
|
|
127 |
|
echo "running testreport like this in \${cwd}:" |
128 |
|
echo "./testreport -clean" |
129 |
|
./testreport -clean |
130 |
|
|
131 |
|
echo "running testreport like this in \${cwd}:" |
132 |
|
echo "${runtestreport} -fast -match 10" |
133 |
|
${runtestreport} -fast -match 10 -a jmc@mitgcm.org >> $MYOUTPUT 2>&1 |
134 |
|
|
135 |
EOF |
EOF |
136 |
|
|
148 |
|
|
149 |
sbatch $HERE/$RUNIT |
sbatch $HERE/$RUNIT |
150 |
|
|
151 |
# 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 |
152 |
jobruns=somedummy |
# jobruns=somedummy |
153 |
while [ "${jobruns}"x != x ] |
# while [ "${jobruns}"x != x ] |
154 |
do |
# do |
155 |
sleep 20 |
# sleep 200 |
156 |
jobruns=`squeue --noheader -u mlosch | grep "$JOBNAME" | awk '{print $1}'` |
# jobruns=`squeue --noheader -u mlosch | grep "$JOBNAME" | awk '{print $1}'` |
157 |
echo "waiting for job ${jobruns%% *} ($JOBNAME) to complete" |
# echo "waiting for job ${jobruns%% *} ($JOBNAME) to complete" |
158 |
currentexp=`grep Experiment $MYOUTPUT | tail -1` |
# currentexp=`grep Experiment $MYOUTPUT | tail -1` |
159 |
echo "currently running $currentexp" |
# echo "currently running $currentexp" |
160 |
done |
# done |
161 |
|
|
162 |
|
# # workaround for mailing the stuff |
163 |
|
# echo "mail the stuff" |
164 |
|
|
|
# # after running the experiments send email to jmc (cannot be done from |
|
|
# # the compute node, yet) |
|
165 |
# MPACKCMD=../tools/mpack-1.6/mpack |
# MPACKCMD=../tools/mpack-1.6/mpack |
166 |
# fn=`ls -dtr tr_ollie* | grep -v tar.gz | tail -1` |
# fn=`ls -dtr tr_$dNam* | grep -v tar.gz | tail -1` |
167 |
# echo "fn $fn" |
# echo "fname ${fn}" |
168 |
# tar cf - $fn | gzip > "${fn}.tar.gz" |
# tar cf - $fn | gzip > "${fn}.tar.gz" |
169 |
# ../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 jmc@mitgcm.org |
170 |
# sleep 2 |
# sleep 2 |
171 |
# \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 |
|
172 |
|
|
173 |
echo "end of mitgcmtestreport" |
echo "end of mitgcmtestreport" |
174 |
|
|