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: /u/gcmpack/MITgcm_contrib/test_scripts/ollie/mitgcmtestreport_cray,v 1.1 2016/06/02 12:51:56 mlosch Exp $ |
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 craype-broadwell |
17 |
module load PrgEnv-cray/1.0.0 |
18 |
module unload cudatoolkit |
19 |
module swap mvapich2_cce cray-impi |
20 |
module load intel/impi-5.1.3 |
21 |
export LD_LIBRARY_PATH=${CRAY_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}: |
22 |
|
23 |
dNam='ollie' |
24 |
TST_DIR="/work/ollie/mlosch/test_$dNam" |
25 |
echo "start from TST_DIR='$TST_DIR' at: "`date` |
26 |
|
27 |
umask 0022 |
28 |
|
29 |
sfx='cray' |
30 |
RUNIT="runit_"$sfx |
31 |
|
32 |
OPTFILE=../tools/build_options/linux_ia64_${sfx}_ollie |
33 |
options="-MPI 6" |
34 |
options="$options -odir ${dNam}-c" |
35 |
options="$options -devel" |
36 |
#options="$options -j 2" |
37 |
#options="$options -j 6" |
38 |
#options="$options -t global_ocean.cs32x15 -q" |
39 |
#EXE='mpiexec.hydra -bootstrap slurm -n TR_NPROC ./mitgcmuv' |
40 |
EXE='srun --mpi=pmi2 -n TR_NPROC ./mitgcmuv' |
41 |
|
42 |
if [ -e $TST_DIR ]; then |
43 |
echo "$TST_DIR exists" |
44 |
else |
45 |
mkdir $TST_DIR |
46 |
fi |
47 |
cd $TST_DIR |
48 |
HERE=$TST_DIR/output |
49 |
if [ -e $HERE ]; then |
50 |
echo "$HERE" |
51 |
else |
52 |
mkdir $HERE |
53 |
fi |
54 |
OUTFILE=$HERE/slurm_${sfx}.out |
55 |
MYOUTPUT=$HERE/out_$sfx |
56 |
if [ -e $MYOUTPUT ]; then |
57 |
rm -rf $MYOUTPUT |
58 |
fi |
59 |
if [ -e $OUTFILE ]; then |
60 |
rm -r $OUTFILE |
61 |
fi |
62 |
gcmDIR="MITgcm_$sfx" |
63 |
#gcmDIR="MITgcm" |
64 |
checkOut=1 |
65 |
if [ $checkOut -eq 1 ] ; then |
66 |
if test -d $gcmDIR/CVS ; then |
67 |
/bin/rm -rf $gcmDIR/verification/??_${dNam}_????????_? |
68 |
( cd $gcmDIR/verification ; ../tools/do_tst_2+2 -clean ) |
69 |
echo "cvs update of dir $gcmDIR :" |
70 |
( cd $gcmDIR ; cvs -q -d :pserver:cvsanon@mitgcm.org:/u/gcmpack update -P -d ) 2>&1 |
71 |
RETVAL=$? |
72 |
if test "x$RETVAL" != x0 ; then |
73 |
echo "cvs update on '"`hostname`"' failed (return val=$RETVAL) => exit" |
74 |
exit |
75 |
fi |
76 |
else |
77 |
echo "no dir: $gcmDIR/CVS => try a fresh check-out" |
78 |
checkOut=2 |
79 |
fi |
80 |
fi |
81 |
if [ $checkOut -eq 2 ] ; then |
82 |
if test -e $gcmDIR ; then |
83 |
rm -rf $gcmDIR |
84 |
fi |
85 |
# cvs co MITgcm |
86 |
cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack co -P -d $gcmDIR MITgcm > /dev/null 2>&1 |
87 |
/usr/bin/find $gcmDIR -type d | xargs chmod g+rxs |
88 |
/usr/bin/find $gcmDIR -type f | xargs chmod g+r |
89 |
fi |
90 |
|
91 |
cd ${gcmDIR}/verification |
92 |
|
93 |
runtestreport="./testreport $options -of $OPTFILE -command \"${EXE}\"" |
94 |
|
95 |
if [ ! -e $MYOUTPUT ] |
96 |
then |
97 |
touch $MYOUTPUT |
98 |
fi |
99 |
|
100 |
# echo "running testreport like this:" |
101 |
# echo ${runtestreport} -norun |
102 |
# eval "${runtestreport} -norun >> $MYOUTPUT 2>&1" |
103 |
|
104 |
# create batch script |
105 |
# |
106 |
JOBNAME=tst$sfx |
107 |
echo "creating batch script $HERE/$RUNIT" |
108 |
cat << EOF >| $HERE/$RUNIT |
109 |
#!/bin/bash -x |
110 |
#SBATCH --job-name=${JOBNAME} |
111 |
#SBATCH -o ${OUTFILE} |
112 |
#SBATCH --time=6:00:00 |
113 |
#SBATCH --ntasks=6 |
114 |
#SBATCH -p smp |
115 |
|
116 |
ulimit -s 1048576 |
117 |
|
118 |
cd \${SLURM_SUBMIT_DIR} |
119 |
|
120 |
echo "running testreport like this:" |
121 |
echo "${runtestreport} -runonly" |
122 |
#${runtestreport} -runonly -match 10 -a 'Martin.Losch@awi.de' >> $MYOUTPUT |
123 |
#${runtestreport} -runonly -match 10 -a 'jmc@mitcm.org' >> $MYOUTPUT |
124 |
${runtestreport} -match 10 >> $MYOUTPUT |
125 |
|
126 |
EOF |
127 |
|
128 |
chmod a+x $HERE/$RUNIT |
129 |
|
130 |
echo " " >> $MYOUTPUT |
131 |
echo "***********************************************************" >> $MYOUTPUT |
132 |
echo "Submitting this job script:" >> $MYOUTPUT |
133 |
echo "***********************************************************" >> $MYOUTPUT |
134 |
cat $HERE/$RUNIT >> $MYOUTPUT |
135 |
echo "***********************************************************" >> $MYOUTPUT |
136 |
echo "end of job script" >> $MYOUTPUT |
137 |
echo "***********************************************************" >> $MYOUTPUT |
138 |
echo " " >> $MYOUTPUT |
139 |
|
140 |
sbatch $HERE/$RUNIT |
141 |
|
142 |
# keep looking for the job in the job queues and wait until has disappeared |
143 |
jobruns=somedummy |
144 |
while [ "${jobruns}"x != x ] |
145 |
do |
146 |
sleep 200 |
147 |
jobruns=`squeue --noheader -u mlosch | grep "$JOBNAME" | awk '{print $1}'` |
148 |
echo "waiting for job ${jobruns%% *} ($JOBNAME) to complete" |
149 |
currentexp=`grep Experiment $MYOUTPUT | tail -1` |
150 |
echo "currently running $currentexp" |
151 |
done |
152 |
|
153 |
# workaround for mailing the stuff |
154 |
echo "mail the stuff" |
155 |
|
156 |
MPACKCMD=../tools/mpack-1.6/mpack |
157 |
fn=`ls -dtr tr_$dNam* | grep -v tar.gz | tail -1` |
158 |
echo "fname ${fn}" |
159 |
tar cf - $fn | gzip > "${fn}.tar.gz" |
160 |
$MPACKCMD -s MITgcm-test -m 3555000 ${fn}.tar.gz jmc@mitgcm.org |
161 |
sleep 2 |
162 |
rm -rf "${fn}.tar.gz" |
163 |
|
164 |
echo "end of mitgcmtestreport" |