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 |
mlosch |
1.2 |
#$Header: /u/gcmpack/MITgcm_contrib/test_scripts/ollie/mitgcmtestreport_ifort,v 1.1 2016/06/02 12:51:56 mlosch Exp $ |
7 |
|
|
#$Name: $ |
8 |
mlosch |
1.1 |
|
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 |
mlosch |
1.2 |
OPTFILE=../tools/build_options/linux_ia64_${sfx}_ollie |
34 |
mlosch |
1.1 |
options="-MPI 6" |
35 |
mlosch |
1.2 |
options="$options -odir ${dNam}-i" |
36 |
mlosch |
1.1 |
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 |
mlosch |
1.2 |
OUTFILE=$HERE/slurm_${sfx}.out |
56 |
mlosch |
1.1 |
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 |
mlosch |
1.2 |
# echo "running testreport like this:" |
102 |
|
|
# echo ${runtestreport} -norun |
103 |
|
|
# eval "${runtestreport} -norun >> $MYOUTPUT 2>&1" |
104 |
mlosch |
1.1 |
|
105 |
|
|
# create batch script |
106 |
|
|
# |
107 |
mlosch |
1.2 |
JOBNAME=tst$sfx |
108 |
mlosch |
1.1 |
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 |
|
|
|
117 |
|
|
ulimit -s 1048576 |
118 |
|
|
|
119 |
|
|
cd \${SLURM_SUBMIT_DIR} |
120 |
|
|
|
121 |
|
|
echo "running testreport like this:" |
122 |
|
|
echo "${runtestreport} -runonly" |
123 |
|
|
#${runtestreport} -runonly -match 10 -a 'Martin.Losch@awi.de' >> $MYOUTPUT |
124 |
mlosch |
1.2 |
#${runtestreport} -runonly -match 10 -a 'jmc@mitcm.org' >> $MYOUTPUT |
125 |
|
|
${runtestreport} -match 10 >> $MYOUTPUT |
126 |
mlosch |
1.1 |
|
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 |
mlosch |
1.2 |
sleep 200 |
148 |
mlosch |
1.1 |
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 |
|
|
# workaround for mailing the stuff |
155 |
|
|
echo "mail the stuff" |
156 |
mlosch |
1.2 |
|
157 |
|
|
MPACKCMD=../tools/mpack-1.6/mpack |
158 |
|
|
fn=`ls -dtr tr_$dNam* | grep -v tar.gz | tail -1` |
159 |
mlosch |
1.1 |
echo "fname ${fn}" |
160 |
|
|
tar cf - $fn | gzip > "${fn}.tar.gz" |
161 |
mlosch |
1.2 |
$MPACKCMD -s MITgcm-test -m 3555000 ${fn}.tar.gz jmc@mitgcm.org |
162 |
mlosch |
1.1 |
sleep 2 |
163 |
|
|
rm -rf "${fn}.tar.gz" |
164 |
|
|
|
165 |
|
|
echo "end of mitgcmtestreport" |
166 |
|
|
|
167 |
|
|
|
168 |
|
|
|
169 |
|
|
|
170 |
|
|
|