/[MITgcm]/MITgcm_contrib/test_scripts/ollie/mitgcmtestreport_cray
ViewVC logotype

Contents of /MITgcm_contrib/test_scripts/ollie/mitgcmtestreport_cray

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Thu Jun 2 12:51:56 2016 UTC (9 years, 1 month ago) by mlosch
Branch: MAIN
- add scripts to run testreport on ollie
- remove directories that belong to machines that are long gone

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: $
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='ftn'
30 RUNIT="runit_"$sfx
31
32 OPTFILE=../tools/build_options/linux_ia64_cray_ollie
33 options="-MPI 6"
34 options="$options -odir $dNam"
35 options="$options -devel"
36 #options="$options -j 2"
37 #options="$options -j 6"
38 #options="$options -t global_ocean.90x40x15"
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/testreport.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=tstoll
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=3:00:00
113 #SBATCH --ntasks=6
114 #SBATCH -p smp
115 #SBATCH --qos=short
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 ${runtestreport} -runonly -match 10 -a 'jmc@mitcm.org' >> $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 20
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 # # after running the experiments send email to jmc (cannot be done from
154 # # the compute node, yet)
155 # MPACKCMD=../tools/mpack-1.6/mpack
156 # fn=`ls -dtr tr_ollie* | grep -v tar.gz | tail -1`
157 # echo "fn $fn"
158 # tar cf - $fn | gzip > "${fn}.tar.gz"
159 # ../tools/mpack-1.6/mpack -s MITgcm-test -m 3555000 ${fn}.tar.gz mlosch@awi.de
160 # sleep 2
161 # \rm -f ${fn}.tar.gz
162 # ../tools/mpack-1.6/mpack -s MITgcm-test -m 3555000 ${fn}.tar.gz jmc@mitgcm.org
163
164 # after running the experiments on the compute node run testreport
165 # for a third time to evaluate results on the head node again
166 # echo " " >> $MYOUTPUT
167 # echo "now run testreport for a final time to evaluate results:" >> $MYOUTPUT
168 # echo "$RUNTESTREPORT -match 10 -runonly" >> $MYOUTPUT
169 # #$RUNTESTREPORT -match 10 -runonly >> $MYOUTPUT 2>&1
170 # $RUNTESTREPORT -match 10 -runonly \
171 # -a "jmc@mitgcm.org" >> $MYOUTPUT 2>&1
172 # # -a "jmc@mitgcm.org, Martin.Losch@awi.de" >> $MYOUTPUT 2>&1
173
174 # workaround for mailing the stuff
175 echo "mail the stuff"
176 # 1. set name of remote host where to do the mpack command
177 # 2. pack directory into an archive an compress it
178 # 3. copy gzipped archive to remote host
179 # 4. on the remote host execute the mpack command, that send the email
180 # 5. wait a little, just to be sure everything is done
181 # 6. remove archives
182 MPACKCMD=\${HOME}/bin/mpack
183 rmhost=rayl4.awi.de
184 pwd
185 fn=`ls -dtr tr_ollie* | grep -v tar.gz | tail -1`
186 echo "fname ${fn}"
187 tar cf - $fn | gzip > "${fn}.tar.gz"
188 eval "scp ${fn}.tar.gz ${rmhost}:"
189 #ssh -Y $rmhost "$MPACKCMD -s MITgcm-test -m 3555000 ${fn}.tar.gz mlosch@awi.de"
190 ssh -Y $rmhost "$MPACKCMD -s MITgcm-test -m 3555000 ${fn}.tar.gz jmc@mitgcm.org"
191 sleep 2
192 ssh -Y $rmhost "rm -f ${fn}.tar.gz"
193 rm -rf "${fn}.tar.gz"
194 # end workaround for mailing the stuff
195
196 echo "end of mitgcmtestreport"

  ViewVC Help
Powered by ViewVC 1.1.22