14 |
echo " -skd LIST_EXP : skip experiments in LIST_EXP" |
echo " -skd LIST_EXP : skip experiments in LIST_EXP" |
15 |
echo " -exe COMMAND : use COMMAND to run the tests" |
echo " -exe COMMAND : use COMMAND to run the tests" |
16 |
echo " -mpi : run the tests using MPI" |
echo " -mpi : run the tests using MPI" |
17 |
|
echo " -mf STRING :(MPI) file with list of possible machines to run on" |
18 |
echo " -o STRING : used to build output directory name" |
echo " -o STRING : used to build output directory name" |
19 |
echo " (DEF=\"hostname\")" |
echo " (DEF=\"hostname\")" |
20 |
echo " -a,-A STRING : email address to send output to" |
echo " -a,-A STRING : email address to send output to" |
28 |
TESTDIRS= |
TESTDIRS= |
29 |
SKIPDIRS= |
SKIPDIRS= |
30 |
SCRIPT='../tools/tst_2+2' |
SCRIPT='../tools/tst_2+2' |
31 |
|
LOGFILE='tst_2+2_out.log' |
32 |
|
scrArg='All' |
33 |
COMMAND= |
COMMAND= |
34 |
mpi=0 |
mpi=0 |
35 |
OUTDIR=`hostname` |
MPI_MFILE= |
36 |
|
OUTDIR=`hostname | sed 's/\..*$//'` |
37 |
SAVELOG=0 |
SAVELOG=0 |
38 |
ADDRESS= |
ADDRESS= |
39 |
MPACK="../tools/mpack-1.6/mpack" |
MPACK="../tools/mpack-1.6/mpack" |
52 |
-skd ) yy=SKIPDIRS ;; |
-skd ) yy=SKIPDIRS ;; |
53 |
-exe ) yy=COMMAND ;; |
-exe ) yy=COMMAND ;; |
54 |
-mpi ) mpi=1 ;; |
-mpi ) mpi=1 ;; |
55 |
|
-mf ) yy=MPI_MFILE ;; |
56 |
-a ) yy=ADDRESS ;; |
-a ) yy=ADDRESS ;; |
57 |
-A ) yy=ADDRESS ; SAVELOG=1 ;; |
-A ) yy=ADDRESS ; SAVELOG=1 ;; |
58 |
-o ) yy=OUTDIR ;; |
-o ) yy=OUTDIR ;; |
78 |
fi |
fi |
79 |
done |
done |
80 |
|
|
|
if test -x $SCRIPT ; then |
|
|
echo "run script '$SCRIPT' for experiment in:" |
|
|
echo " $LIST" |
|
|
yy=`echo $SCRIPT | grep -c '^\/'` |
|
|
if test $yy = 0 ; then SCRIPT="../../$SCRIPT" ; fi |
|
|
else |
|
|
echo "ERROR: script '$SCRIPT' not found or not executable" |
|
|
exit |
|
|
fi |
|
|
echo "" |
|
81 |
#------------------------ |
#------------------------ |
|
|
|
82 |
if test $CLEAN = 1 ; then |
if test $CLEAN = 1 ; then |
83 |
|
echo "clean output from script '$SCRIPT' for experiment in:" |
84 |
|
echo " $LIST" |
85 |
|
echo "" |
86 |
for xx in $LIST |
for xx in $LIST |
87 |
do |
do |
88 |
listD='run '`(cd $xx/results ; ls output.*.txt 2> /dev/null | sed 's/^output\./tr_run./g' | sed 's/\.txt$//g' )` |
listD='run '`(cd $xx/results ; ls output.*.txt 2> /dev/null | sed 's/^output\./tr_run./g' | sed 's/\.txt$//g' )` |
91 |
if test -r $xx/$yy/data.tst ; then |
if test -r $xx/$yy/data.tst ; then |
92 |
echo "clean dir:" $xx/$yy |
echo "clean dir:" $xx/$yy |
93 |
cd $xx/$yy |
cd $xx/$yy |
94 |
echo ' ' >> outp.tst_2+2.log |
echo ' ' >> $LOGFILE |
95 |
echo $SCRIPT 4 >> outp.tst_2+2.log |
echo $SCRIPT 4 >> $LOGFILE |
96 |
$SCRIPT 4 >> outp.tst_2+2.log 2>&1 |
$SCRIPT 4 >> $LOGFILE 2>&1 |
97 |
cd $here |
cd $here |
98 |
fi |
fi |
99 |
done |
done |
100 |
done |
done |
101 |
exit |
exit |
102 |
fi |
fi |
103 |
|
if test -x $SCRIPT ; then |
104 |
|
echo "run script '$SCRIPT' for experiment in:" |
105 |
|
echo " $LIST" |
106 |
|
echo "" |
107 |
|
yy=`echo $SCRIPT | grep -c '^\/'` |
108 |
|
if test $yy = 0 ; then SCRIPT="../../$SCRIPT" ; fi |
109 |
|
else |
110 |
|
echo "ERROR: script '$SCRIPT' not found or not executable" |
111 |
|
exit |
112 |
|
fi |
113 |
|
|
114 |
#------------------------ |
#------------------------ |
115 |
# Create a uniquely named directory to store results |
# Create a uniquely named directory to store results |
116 |
DATE=`date +%Y%m%d` |
CMDLINE=$0 |
117 |
|
for xx in "$@" ; do nw=`echo $xx | wc -w` |
118 |
|
if test $nw = '1' ; then CMDLINE="$CMDLINE $xx" |
119 |
|
else CMDLINE="$CMDLINE '$xx'" ; fi |
120 |
|
done |
121 |
|
#for xx in "$@" ; do CMDLINE="$CMDLINE '$xx'" ; done |
122 |
|
DATE='' |
123 |
|
if test -f tr_out.txt ; then |
124 |
|
# try to use the date corresponding to 'Start time:' in file "tr_out.txt" : |
125 |
|
sTime=`grep '^Start time: ' tr_out.txt 2>/dev/null | sed 's/Start time: //'` |
126 |
|
if test "x$sTime" != x ; then DATE=`date -d "$sTime" "+%Y%m%d" 2>/dev/null` ; fi |
127 |
|
fi |
128 |
|
# otherwise, use current date: |
129 |
|
if test "x$DATE" = x ; then DATE=`date +%Y%m%d`; fi |
130 |
BASE="rs_"$OUTDIR"_"$DATE"_" |
BASE="rs_"$OUTDIR"_"$DATE"_" |
131 |
xx=0 |
xx=0 |
132 |
DRESULTS="$BASE$xx" |
DRESULTS="$BASE$xx" |
145 |
|
|
146 |
printf "Start time: " > $SUMMARY |
printf "Start time: " > $SUMMARY |
147 |
date >> $SUMMARY |
date >> $SUMMARY |
148 |
|
echo 'run:' $CMDLINE >> $SUMMARY |
149 |
if test -f tr_out.txt ; then |
if test -f tr_out.txt ; then |
150 |
echo ' using output from:' >> $SUMMARY |
echo ' using output from:' >> $SUMMARY |
151 |
sed -n '2,/OPTFILE/ p' tr_out.txt >> $SUMMARY |
sed -n '2,/^ OPTFILE=/ p' tr_out.txt >> $SUMMARY |
152 |
echo >> $SUMMARY |
echo >> $SUMMARY |
153 |
fi |
fi |
154 |
echo 'test 2+2=4 summary :' >> $SUMMARY |
echo 'test 2+2=4 summary :' >> $SUMMARY |
157 |
echo ' 1 2 3' >> $SUMMARY |
echo ' 1 2 3' >> $SUMMARY |
158 |
|
|
159 |
#-- For MPI test: |
#-- For MPI test: |
160 |
|
LOC_MFILE='tr_mpi_mfile' |
161 |
RUNOUTP="output.txt" |
RUNOUTP="output.txt" |
162 |
if [ $mpi -ge 1 ] ; then |
if [ $mpi -ge 1 ] ; then |
163 |
SCRIPT="$SCRIPT -mpi" |
SCRIPT="$SCRIPT -mpi" |
166 |
|
|
167 |
for xx in $LIST |
for xx in $LIST |
168 |
do |
do |
169 |
echo ============================================================================== |
echo '------------------------------------------------------------------------------' |
170 |
|
if [ $mpi -le 0 ] ; then |
171 |
|
rCommand=$COMMAND |
172 |
|
else |
173 |
|
LOC_NPROC=2 |
174 |
|
mpi_size=$xx/build/SIZE.h.mpi |
175 |
|
if test -f $mpi_size ; then |
176 |
|
px=`grep '^ & *nPx *=' $mpi_size | sed 's/^ & *nPx *= *//' | sed 's/, *$//'` |
177 |
|
py=`grep '^ & *nPy *=' $mpi_size | sed 's/^ & *nPy *= *//' | sed 's/, *$//'` |
178 |
|
pp=`expr $px \* $py` > /dev/null 2>&1 ; out=$? |
179 |
|
if test "x$out" = x0 ; then LOC_NPROC=$pp ; fi |
180 |
|
fi |
181 |
|
rCommand=`echo $COMMAND | sed "s/ TR_NPROC / $LOC_NPROC /"` |
182 |
|
if test "x$MPI_MFILE" != x ; then |
183 |
|
#- create new MPI machine-file with the right number of Procs |
184 |
|
rm -f $LOC_MFILE |
185 |
|
cat $MPI_MFILE | sort | uniq | head -$LOC_NPROC > $LOC_MFILE |
186 |
|
nl=`wc -l $LOC_MFILE | awk '{print $1}'` |
187 |
|
if [ $nl -lt $LOC_NPROC ] ; then |
188 |
|
rm -f $LOC_MFILE |
189 |
|
cat $MPI_MFILE | head -$LOC_NPROC > $LOC_MFILE |
190 |
|
fi |
191 |
|
rCommand=`echo $rCommand | sed "s/ TR_MFILE / ..\/..\/$LOC_MFILE /"` |
192 |
|
fi |
193 |
|
fi |
194 |
|
|
195 |
listD='run '`(cd $xx/results ; ls output.*.txt 2> /dev/null | sed 's/^output\./tr_run./g' | sed 's/\.txt$//g' )` |
listD='run '`(cd $xx/results ; ls output.*.txt 2> /dev/null | sed 's/^output\./tr_run./g' | sed 's/\.txt$//g' )` |
196 |
for yy in $listD |
for yy in $listD |
197 |
do |
do |
199 |
if test "x$OPTFILE" = x -a -f $xx/build/Makefile ; then |
if test "x$OPTFILE" = x -a -f $xx/build/Makefile ; then |
200 |
comm=`grep '^# OPTFILE=' $xx/build/Makefile 2>/dev/null | head -1 | sed 's/^# //'` |
comm=`grep '^# OPTFILE=' $xx/build/Makefile 2>/dev/null | head -1 | sed 's/^# //'` |
201 |
echo "from '$xx/build/Makefile', extract:" > $DRESULTS/genmake_state |
echo "from '$xx/build/Makefile', extract:" > $DRESULTS/genmake_state |
202 |
echo $comm >> $DRESULTS/genmake_state |
sed -n '/^# executed by:/,+1 p' $xx/build/Makefile >> $DRESULTS/genmake_state |
203 |
|
echo " $comm" >> $DRESULTS/genmake_state |
204 |
eval $comm |
eval $comm |
205 |
|
gmkLog=$xx/build/genmake.log |
206 |
|
grep '^Get compiler version using:' $gmkLog > /dev/null 2>&1 |
207 |
|
out=$? |
208 |
|
if test "x$out" = x0 ; then |
209 |
|
echo "from '$gmkLog', extract compiler version:" >> $DRESULTS/genmake_state |
210 |
|
sed -n '/Get compiler version/,/<-- compiler version/p' $gmkLog \ |
211 |
|
| grep -v '^... compiler version ' > tr_vers.tmp_log |
212 |
|
sed -n '1,/^$/p' tr_vers.tmp_log | sed '/^$/d' | sed 's/^./ &/' \ |
213 |
|
>> $DRESULTS/genmake_state |
214 |
|
rm -f tr_vers.tmp_log |
215 |
|
fi |
216 |
fi |
fi |
217 |
if test $yy = 'run' ; then nam=$xx |
if test $yy = 'run' ; then nam=$xx |
218 |
else nam=$xx`echo $yy | sed 's/tr_run//'` ; fi |
else nam=$xx`echo $yy | sed 's/tr_run//'` ; fi |
219 |
echo -n "Entering $xx/$yy :" |
echo -n "Entering $xx/$yy :" |
220 |
cd $xx/$yy |
cd $xx/$yy |
221 |
pwd > outp.tst_2+2.log |
pwd > $LOGFILE |
222 |
if test "x$COMMAND" = x ; then |
if test "x$COMMAND" = x ; then |
223 |
echo $SCRIPT All >> outp.tst_2+2.log ; echo ' ' >> outp.tst_2+2.log |
echo $SCRIPT $scrArg >> $LOGFILE ; echo ' ' >> $LOGFILE |
224 |
$SCRIPT All >> outp.tst_2+2.log 2>&1 |
$SCRIPT $scrArg >> $LOGFILE 2>&1 |
225 |
out=$? |
out=$? |
226 |
else |
else |
227 |
echo "$SCRIPT All -command \"$COMMAND\"" >> outp.tst_2+2.log |
echo "$SCRIPT $scrArg -command \"$rCommand\"" >> $LOGFILE |
228 |
echo ' ' >> outp.tst_2+2.log |
echo ' ' >> $LOGFILE |
229 |
$SCRIPT All -command "$COMMAND" >> outp.tst_2+2.log 2>&1 |
$SCRIPT $scrArg -command "$rCommand" >> $LOGFILE 2>&1 |
230 |
out=$? |
out=$? |
231 |
fi |
fi |
232 |
case $out in |
case $out in |
241 |
if test $out != '0' ; then |
if test $out != '0' ; then |
242 |
echo " test 2+2=4 FAIL (exit $out)" |
echo " test 2+2=4 FAIL (exit $out)" |
243 |
echo " " |
echo " " |
244 |
tail -5 outp.tst_2+2.log |
tail -5 $LOGFILE |
245 |
echo " " |
echo " " |
246 |
cp -p outp.tst_2+2.log ../../$DRESULTS/$nam.log |
cp -p $LOGFILE ../../$DRESULTS/$nam.log |
247 |
elif test $SAVELOG = 1 ; then |
elif test $SAVELOG = 1 ; then |
248 |
cp -p outp.tst_2+2.log ../../$DRESULTS/$nam.log |
cp -p $LOGFILE ../../$DRESULTS/$nam.log |
249 |
fi |
fi |
250 |
cd $here |
cd $here |
251 |
fi |
fi |
252 |
done |
done |
253 |
|
if test "x$mpi" != x0 -a "x$MPI_MFILE" != x ; then rm -f $LOC_MFILE ; fi |
254 |
done |
done |
255 |
printf "End time: " >> $SUMMARY |
printf "End time: " >> $SUMMARY |
256 |
date >> $SUMMARY |
date >> $SUMMARY |
289 |
if test "x$ADDRESS" = x ; then |
if test "x$ADDRESS" = x ; then |
290 |
rm -rf $DRESULTS |
rm -rf $DRESULTS |
291 |
fi |
fi |
|
|
|