/[MITgcm]/MITgcm_contrib/test_scripts/sx8/mitgcmtestreport_split
ViewVC logotype

Contents of /MITgcm_contrib/test_scripts/sx8/mitgcmtestreport_split

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


Revision 1.5 - (show annotations) (download)
Mon Mar 2 09:13:18 2015 UTC (11 years, 6 months ago) by mlosch
Branch: MAIN
Changes since 1.4: +4 -1 lines
add definition of module command (bash function), so that we can
actually have compilers in this script

1 #!/bin/bash
2 # new script for running testreport on sx8.awi.de
3 # - split the testreport into 3 steps:
4 # 1/ compiling on head node (tx7.awi.de), with -norun option
5 # 2/ running on compute node (using PBS qsub), with -runonly option
6 # 3/ evaluating result on head node with -runonly option
7 #
8 # Notes:
9 # - step 2 leads to many error messages, because the OS on the compute
10 # nodes does not have the appropriate shell tools, modifying the
11 # - runonly option to skip the evalution step would be nice but not
12 # necessary; you'll just have to live with the error messages
13 # - step 3 assumes that all experiments have been run successfully, i.e.
14 # that the output files are up-to-date.
15 # if not, testreport will try to run the sx8-code on the tx7 frontend
16 # which will fail inevitably and produce more errors, maybe we can
17 # have a flag that skips everything but the evaluation step to avoid this
18 # $Header: /u/gcmpack/MITgcm_contrib/test_scripts/sx8/mitgcmtestreport_split,v 1.4 2015/02/27 14:14:40 mlosch Exp $
19 # $Name: $
20
21 # for some reason the module command is not available in a bash script on
22 # this computer so we have to create it here
23 module () { eval `/usr/bin/modulecmd bash $*` ; }
24 # load latest compiler:
25 module load sxf90/460
26
27 VENDOR=sxf90
28 RUNIT="runit_"$VENDOR
29 HERE=`pwd`
30 EXE='mpirun -np TR_NPROC ./mitgcmuv'
31 NPROCS=2
32 MPI="-MPI $NPROCS"
33 OUTFILE=/home/sx8/mlosch/out_${VENDOR}
34 MYOUTPUT=/home/sx8/mlosch/testreport_${VENDOR}
35 OUTFILE=out_${VENDOR}
36 JOBNAME=testsx8
37 JOBSCRIPT=job_${VENDOR}
38 #selectexperiment='-t exp2'
39 selectexperiment=''
40 # download code into this directory
41 TDIR=/sx8/scr/mlosch/tmp_$VENDOR
42
43 OPTFILE=../tools/build_options/SUPER-UX_SX-8_sxf90_awi
44
45 RUNTESTREPORT="./testreport $MPI -of=${OPTFILE} $selectexperiment"
46 #
47 # create batch script
48 #
49 cat << EOF > $HERE/$JOBSCRIPT
50 #PBS -q sx8-r # job queue not neccesary so far
51 #PBS -N $JOBNAME # give the job a name
52 #PBS -l cpunum_job=$NPROCS # cpus per node
53 #PBS -l cputim_job=2:00:00 # time limit
54 #PBS -l memsz_job=32gb # max accumulated memory, we need this much because of many netcdf files
55 #PBS -j o # join i/o
56 #PBS -S /bin/sh
57 #PBS -o $OUTFILE # o Where to write output
58 #
59
60 cd \${PBS_O_WORKDIR}
61 $RUNTESTREPORT -runonly -command "$EXE" >> $MYOUTPUT 2>&1
62
63 EOF
64
65 # clean up old testreport output
66 if [ -e $MYOUTPUT ]; then
67 rm -rf $MYOUTPUT
68 fi
69 if [ -e $OUTFILE ]; then
70 rm -r $OUTFILE
71 fi
72 if [ 0 = 0 ]; then
73 # create directory and download code
74 if [ -e $TDIR ]; then
75 rm -rf $TDIR
76 fi
77 mkdir $TDIR
78 cd $TDIR
79 # cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack co MITgcm_verif_basic > cvs_co.log 2>&1
80 cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack co MITgcm > cvs_co.log 2>&1
81 if [ $status > 0 ]; then
82 cat cvs_co.log
83 fi
84 else
85 cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q update >> cvs_co.log 2>&1
86 if [ $status > 0 ]; then
87 cat cvs_co.log
88 fi
89 fi
90
91 cd $TDIR/MITgcm/verification
92
93 # make sure that we do not use the cross compiler for testreport
94 unset CC
95 # make sure that do use the cross compiler for testreport
96 #export CC=sxcc
97
98 $RUNTESTREPORT -j 8 -norun > $MYOUTPUT 2>&1
99
100 if [ $status > 0 ]
101 then
102 echo "something wrong with testreport"
103 echo "keeping the working directory"
104 #else
105 # echo "check restarts"
106 # echo ../tools/do_tst_2+2 -mpi -exe \"$HERE/$RUNIT\" -a NONE
107 # ../tools/do_tst_2+2 -mpi -exe $HERE/$RUNIT -a NONE
108 # everything OK: delete working directory
109 # rm -rf $TDIR
110 fi
111
112 if [ ! -e $MYOUTPUT ]
113 then
114 touch $MYOUTPUT
115 fi
116
117 echo " " >> $MYOUTPUT
118 echo "***********************************************************" >> $MYOUTPUT
119 echo "Submitting this job script:" >> $MYOUTPUT
120 echo "***********************************************************" >> $MYOUTPUT
121 cat $HERE/$JOBSCRIPT >> $MYOUTPUT
122 echo "***********************************************************" >> $MYOUTPUT
123 echo "end of job script" >> $MYOUTPUT
124 echo "***********************************************************" >> $MYOUTPUT
125 echo " " >> $MYOUTPUT
126
127 # now submit the job that actually runs all the experiments in one go
128 qsub $HERE/$JOBSCRIPT
129 # keep looking for the job in the job queues and wait until has disappeared
130 jobruns=`qstat -n -u mlosch | grep "$JOBNAME"`
131 while [ "${jobruns}"x != x ]
132 do
133 sleep 20
134 jobruns=`qstat -n -u mlosch | grep "$JOBNAME"`
135 echo "waiting for job ${jobruns%% *} ($JOBNAME) to complete"
136 currentexp=`grep Experiment $MYOUTPUT | tail -1`
137 echo "currently running $currentexp"
138 done
139
140 # after running the experiments on the compute node run testreport
141 # for a third time to evaluate results on the head node again
142 echo " " >> $MYOUTPUT
143 echo "now run testreport for a final time to evaluate results:" >> $MYOUTPUT
144 echo "$RUNTESTREPORT -match 10 -runonly" >> $MYOUTPUT
145 #$RUNTESTREPORT -match 10 -runonly >> $MYOUTPUT 2>&1
146 $RUNTESTREPORT -match 10 -runonly \
147 -a "jmc@mitgcm.org, Martin.Losch@awi.de" >> $MYOUTPUT 2>&1
148
149 echo "end of mitgcmtestreport_split"

  ViewVC Help
Powered by ViewVC 1.1.22