1 |
mlosch |
1.1 |
#!/bin/bash -e |
2 |
|
|
# new script for running testreport on ollie.awi.de |
3 |
mlosch |
1.4 |
# - compile and run on compute nodes |
4 |
mlosch |
1.3 |
# - use ssh to call mpack command from the head node ollie0 |
5 |
mlosch |
1.6 |
#$Header: /u/gcmpack/MITgcm_contrib/test_scripts/ollie/mitgcmtestreport_cray,v 1.5 2016/06/22 06:23:27 mlosch Exp $ |
6 |
mlosch |
1.2 |
#$Name: $ |
7 |
mlosch |
1.1 |
|
8 |
|
|
# needed for cron-job |
9 |
|
|
source /usr/Modules/3.2.10/init/bash |
10 |
|
|
source /etc/profile.d/cray_pe.sh |
11 |
|
|
source /etc/profile.d/AWI.sh |
12 |
|
|
# |
13 |
mlosch |
1.6 |
|
14 |
mlosch |
1.1 |
module purge |
15 |
|
|
module load slurm |
16 |
|
|
module load craype-broadwell |
17 |
mlosch |
1.6 |
module load PrgEnv-cray |
18 |
|
|
#export LD_LIBRARY_PATH=${CRAY_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}: |
19 |
|
|
# not sure why I have set these paths here again |
20 |
|
|
export MPI_ROOT=$(dirname `echo $LD_LIBRARY_PATH | awk -F: '{print $1}'`) |
21 |
|
|
export MPI_INC_DIR=${MPI_ROOT}/include |
22 |
|
|
|
23 |
mlosch |
1.1 |
|
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 |
mlosch |
1.2 |
sfx='cray' |
31 |
mlosch |
1.1 |
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}-c" |
36 |
mlosch |
1.5 |
#options="$options -j 6" |
37 |
mlosch |
1.3 |
#options="$options -t global_ocean.cs32x15" |
38 |
|
|
|
39 |
mlosch |
1.1 |
#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 |
mlosch |
1.2 |
OUTFILE=$HERE/slurm_${sfx}.out |
55 |
mlosch |
1.1 |
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 |
|
|
checkOut=1 |
64 |
|
|
if [ $checkOut -eq 1 ] ; then |
65 |
|
|
if test -d $gcmDIR/CVS ; then |
66 |
|
|
/bin/rm -rf $gcmDIR/verification/??_${dNam}_????????_? |
67 |
|
|
( cd $gcmDIR/verification ; ../tools/do_tst_2+2 -clean ) |
68 |
|
|
echo "cvs update of dir $gcmDIR :" |
69 |
|
|
( cd $gcmDIR ; cvs -q -d :pserver:cvsanon@mitgcm.org:/u/gcmpack update -P -d ) 2>&1 |
70 |
|
|
RETVAL=$? |
71 |
|
|
if test "x$RETVAL" != x0 ; then |
72 |
|
|
echo "cvs update on '"`hostname`"' failed (return val=$RETVAL) => exit" |
73 |
|
|
exit |
74 |
|
|
fi |
75 |
|
|
else |
76 |
|
|
echo "no dir: $gcmDIR/CVS => try a fresh check-out" |
77 |
|
|
checkOut=2 |
78 |
|
|
fi |
79 |
|
|
fi |
80 |
|
|
if [ $checkOut -eq 2 ] ; then |
81 |
|
|
if test -e $gcmDIR ; then |
82 |
|
|
rm -rf $gcmDIR |
83 |
|
|
fi |
84 |
|
|
# cvs co MITgcm |
85 |
|
|
cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack co -P -d $gcmDIR MITgcm > /dev/null 2>&1 |
86 |
|
|
/usr/bin/find $gcmDIR -type d | xargs chmod g+rxs |
87 |
|
|
/usr/bin/find $gcmDIR -type f | xargs chmod g+r |
88 |
|
|
fi |
89 |
|
|
|
90 |
|
|
cd ${gcmDIR}/verification |
91 |
|
|
|
92 |
mlosch |
1.6 |
cwd=\`pwd\` |
93 |
mlosch |
1.3 |
SENDCMD="ssh ollie0 ${TST_DIR}/${gcmDIR}/tools/mpack-1.6/mpack" |
94 |
|
|
runtestreport="./testreport $options -of $OPTFILE -command \"${EXE}\" -send \"${SENDCMD}\" -sd ${cwd}" |
95 |
mlosch |
1.1 |
|
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 |
mlosch |
1.3 |
#!/bin/bash |
111 |
mlosch |
1.1 |
#SBATCH --job-name=${JOBNAME} |
112 |
|
|
#SBATCH -o ${OUTFILE} |
113 |
mlosch |
1.3 |
#SBATCH --time=12:00:00 |
114 |
mlosch |
1.1 |
#SBATCH --ntasks=6 |
115 |
|
|
|
116 |
mlosch |
1.3 |
# still need this to be able to run a few experiments: |
117 |
|
|
# cfc_example, fizhi, tutorial_deep_convection |
118 |
|
|
ulimit -s unlimited |
119 |
mlosch |
1.1 |
|
120 |
|
|
cd \${SLURM_SUBMIT_DIR} |
121 |
|
|
|
122 |
mlosch |
1.3 |
cwd=`pwd` |
123 |
|
|
echo "running testreport like this in \${cwd}:" |
124 |
|
|
echo "${runtestreport} -devel -match 10" |
125 |
|
|
${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 |
mlosch |
1.1 |
|
135 |
|
|
EOF |
136 |
|
|
|
137 |
|
|
chmod a+x $HERE/$RUNIT |
138 |
|
|
|
139 |
|
|
echo " " >> $MYOUTPUT |
140 |
|
|
echo "***********************************************************" >> $MYOUTPUT |
141 |
|
|
echo "Submitting this job script:" >> $MYOUTPUT |
142 |
|
|
echo "***********************************************************" >> $MYOUTPUT |
143 |
|
|
cat $HERE/$RUNIT >> $MYOUTPUT |
144 |
|
|
echo "***********************************************************" >> $MYOUTPUT |
145 |
|
|
echo "end of job script" >> $MYOUTPUT |
146 |
|
|
echo "***********************************************************" >> $MYOUTPUT |
147 |
|
|
echo " " >> $MYOUTPUT |
148 |
|
|
|
149 |
|
|
sbatch $HERE/$RUNIT |
150 |
|
|
|
151 |
mlosch |
1.3 |
# # keep looking for the job in the job queues and wait until it has disappeared |
152 |
|
|
# jobruns=somedummy |
153 |
|
|
# while [ "${jobruns}"x != x ] |
154 |
|
|
# do |
155 |
|
|
# sleep 200 |
156 |
|
|
# jobruns=`squeue --noheader -u mlosch | grep "$JOBNAME" | awk '{print $1}'` |
157 |
|
|
# echo "waiting for job ${jobruns%% *} ($JOBNAME) to complete" |
158 |
|
|
# currentexp=`grep Experiment $MYOUTPUT | tail -1` |
159 |
|
|
# echo "currently running $currentexp" |
160 |
|
|
# done |
161 |
|
|
|
162 |
|
|
# # workaround for mailing the stuff |
163 |
|
|
# echo "mail the stuff" |
164 |
|
|
|
165 |
|
|
# MPACKCMD=../tools/mpack-1.6/mpack |
166 |
|
|
# fn=`ls -dtr tr_$dNam* | grep -v tar.gz | tail -1` |
167 |
|
|
# echo "fname ${fn}" |
168 |
|
|
# tar cf - $fn | gzip > "${fn}.tar.gz" |
169 |
|
|
# $MPACKCMD -s MITgcm-test -m 3555000 ${fn}.tar.gz jmc@mitgcm.org |
170 |
|
|
# sleep 2 |
171 |
|
|
# rm -rf "${fn}.tar.gz" |
172 |
mlosch |
1.1 |
|
173 |
|
|
echo "end of mitgcmtestreport" |
174 |
|
|
|
175 |
|
|
|
176 |
|
|
|
177 |
|
|
|
178 |
|
|
|