Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
4bcd93c309d5cc6c783b58587a1155b8a8923a75
[simgrid.git] / teshsuite / smpi / mpich-test / coll / temprun
1 #!/bin/sh
2 # This version puts the output from each program into a separate file.
3 # -mvhome is needed for the ANL SP, and is ignored by others
4 args="-pg -mvhome"
5 #
6 runtests=1
7 makeeach=0
8 for arg in "$@" ; do
9     case $arg in 
10         -checkonly )
11         runtests=0
12         ;;
13         -margs=*)
14         margs=`echo $arg | sed 's/-margs=//'`
15         args="$args $margs"
16         ;;
17         -small)
18         makeeach=1
19         ;;
20         -help|-u)
21         echo "runtests [-checkonly] [-margs='...']"
22         echo "run tests in this directory.  If -checkonly set, just run"
23         echo "the differences check (do NO rerun the test programs)."
24         echo "If -margs is used, these options are passed to mpirun."
25         echo "If -small is used, the examples are built, run, and deleted."
26         exit 1
27         ;;
28         *)
29         if test -n "$arg" ; then
30             echo "runtests: Unknown argument ($arg)"
31             exit 1
32         fi
33         ;;
34     esac
35 done
36
37 MakeExe() {
38     if [ $makeeach = 1 -o ! -x $1 ] ; then
39         make $1
40     fi
41 }
42 CleanExe() {
43     if [ $makeeach = 1 ] ; then
44         /bin/rm -f $1 $1.o
45     fi
46 }
47
48 # If the programs are not available, run make.
49 if [ ! -x coll1 -a $makeeach = 0 ] ; then
50     make 
51 fi
52
53 testfiles=""
54 if [ $runtests = 1 ] ; then
55 echo '**** Testing MPI Collective routines ****'
56
57 testfiles="$testfiles barrier.out"
58 /bin/rm -f barrier.out barrier-0.out
59 MakeExe barrier
60 echo '*** Barrier Test ***' >> barrier.out
61 echo '**** Barrier Test ****'
62 mpirun $args -np 4 -mvback "barrier-0.out" barrier $* >> barrier.out
63 cat barrier-0.out >> barrier.out
64 /bin/rm -f barrier-[01234].out
65 echo '*** Barrier Test ***' >> barrier.out
66 CleanExe barrier
67
68 testfiles="$testfiles bcast.out"
69 /bin/rm -f bcast.out bcast-[0-3].out
70 MakeExe bcast
71 echo '**** Broadcast Test ****'
72 echo '*** Broadcast Test ***' >> bcast.out
73 mpirun $args -np 4 \
74    -mvback "bcast-0.out bcast-1.out bcast-2.out bcast-3.out" \
75         bcast $* >> bcast.out
76 cat bcast-[0123].out >> bcast.out
77 /bin/rm -f bcast-[0123].out
78 echo '*** Broadcast Test ***' >> bcast.out
79 CleanExe bcast
80
81 testfiles="$testfiles coll1.out"
82 /bin/rm -f coll1.out
83 MakeExe coll1
84 echo '**** coll1 ****'
85 echo '*** coll1 ***' >> coll1.out
86 mpirun $args -np 4 coll1 $* >> coll1.out
87 echo '*** coll1 ***' >> coll1.out
88 CleanExe coll1
89
90 testfiles="$testfiles coll2.out"
91 /bin/rm -f coll2.out
92 MakeExe coll2
93 echo '**** coll2 ****'
94 echo '*** coll2 ***' >> coll2.out
95 # mpirun $args -np 5 coll2 $* >> coll2.out
96 echo '*** coll2 ***' >> coll2.out
97 CleanExe coll2
98
99 testfiles="$testfiles coll3.out"
100 /bin/rm -f coll3.out
101 MakeExe coll3
102 echo '**** coll3 ****'
103 echo '*** coll3 ***' >> coll3.out
104 mpirun $args -np 5 coll3 $* >> coll3.out
105 echo '*** coll3 ***' >> coll3.out
106 CleanExe coll3
107
108 testfiles="$testfiles coll4.out"
109 /bin/rm -f coll4.out
110 MakeExe coll4
111 echo '**** coll4 ****'
112 echo '*** coll4 ***' >> coll4.out
113 mpirun $args -np 4 coll4 $* >> coll4.out
114 echo '*** coll4 ***' >> coll4.out
115 CleanExe coll4
116
117 testfiles="$testfiles coll5.out"
118 /bin/rm -f coll5.out
119 MakeExe coll5
120 echo '**** coll5 ****'
121 echo '*** coll5 ***' >> coll5.out
122 mpirun $args -np 4 coll5 $* >> coll5.out
123 echo '*** coll5 ***' >> coll5.out
124 CleanExe coll5
125
126 testfiles="$testfiles coll6.out"
127 /bin/rm -f coll6.out
128 MakeExe coll6
129 echo '**** coll6 ****'
130 echo '*** coll6 ***' >> coll6.out
131 mpirun $args -np 5 coll6 $* >> coll6.out
132 echo '*** coll6 ***' >> coll6.out
133 CleanExe coll6
134
135 testfiles="$testfiles coll7.out"
136 /bin/rm -f coll7.out
137 MakeExe coll7
138 echo '**** coll7 ****'
139 echo '*** coll7 ***' >> coll7.out
140 mpirun $args -np 5 coll7 $* >> coll7.out
141 echo '*** coll7 ***' >> coll7.out
142 CleanExe coll7
143
144 testfiles="$testfiles coll8.out"
145 /bin/rm -f coll8.out
146 MakeExe coll8
147 echo '**** coll8 ****'
148 echo '*** coll8 ***' >> coll8.out
149 mpirun $args -np 4 coll8 $* >> coll8.out
150 echo '*** coll8 ***' >> coll8.out
151 CleanExe coll8
152
153 testfiles="$testfiles coll9.out"
154 /bin/rm -f coll9.out
155 MakeExe coll9
156 echo '**** coll9 ****'
157 echo '*** coll9 ***' >> coll9.out
158 mpirun $args -np 4 coll9 $* >>  coll9.out
159 echo '*** coll9 ***' >> coll9.out
160 CleanExe coll9
161
162 testfiles="$testfiles coll10.out"
163 /bin/rm -f coll10.out
164 MakeExe coll10
165 echo '**** coll10 ****'
166 echo '*** coll10 ***' >> coll10.out
167 mpirun -np 4 $args coll10 $* >> coll10.out
168 echo '*** coll10 ***' >> coll10.out
169 CleanExe coll10
170
171 testfiles="$testfiles coll11.out"
172 /bin/rm -f coll11.out
173 MakeExe coll11
174 echo '**** coll11 ****'
175 echo '*** coll11 ***' >> coll11.out
176 mpirun -np 4 $args coll11 $* >> coll11.out
177 echo '*** coll11 ***' >> coll11.out
178 CleanExe coll11
179
180 testfiles="$testfiles coll12.out"
181 /bin/rm -f coll12.out
182 MakeExe coll12
183 echo '**** coll12 ****'
184 echo '*** coll12 ***' >> coll12.out
185 mpirun -np 4 $args coll12 $* >> coll12.out
186 echo '*** coll12 ***' >> coll12.out
187 CleanExe coll12
188
189 testfiles="$testfiles coll13.out"
190 /bin/rm -f coll13.out
191 MakeExe coll13
192 echo '**** coll13 ****'
193 echo '*** coll13 ***' >> coll13.out
194 mpirun -np 4 $args coll13 $* >> coll13.out
195 echo '*** coll13 ***' >> coll13.out
196 CleanExe coll13
197
198 testfiles="$testfiles grouptest.out"
199 /bin/rm -f grouptest.out
200 MakeExe grouptest
201 echo '*** Grouptest ***'
202 echo '*** grouptest ***' >> grouptest.out
203 mpirun $args -np 4 grouptest  $* >> grouptest.out
204 echo '*** grouptest ***' >> grouptest.out
205 CleanExe grouptest
206
207 testfiles="$testfiles allred.out"
208 /bin/rm -f allred.out
209 MakeExe allred
210 echo '*** Allred ***'
211 echo '*** Allred ***' >> allred.out
212 mpirun $args -np 4 allred  $* >> allred.out
213 echo '*** Allred ***' >> allred.out
214 CleanExe allred
215
216 testfiles="$testfiles scatterv.out"
217 /bin/rm -f scatterv.out
218 MakeExe scatterv
219 echo '*** Scatterv ***'
220 echo '*** Scatterv ***' >> scatterv.out
221 mpirun $args -np 4 scatterv  $* >> scatterv.out
222 echo '*** Scatterv ***' >> scatterv.out
223 CleanExe scatterv
224
225 #
226 # Run Fortran tests ONLY if Fortran available
227 if [ 1 = 1 ] ; then 
228     echo "FORTRAN TESTS"
229     #
230     testfiles="$testfiles allredf.out"
231     /bin/rm -f allredf.out
232     MakeExe allredf
233     echo '*** Testing allreduce from Fortran ***'
234     echo '*** Testing allreduce from Fortran ***' >> allredf.out
235     mpirun $args -np 4 allredf "$@" >> allredf.out
236     echo '*** Testing allreduce from Fortran ***' >> allredf.out
237     CleanExe allredf
238     #
239     echo "END OF FORTRAN TESTS"
240 fi
241
242 else
243     # Just run checks
244     testfiles=`echo *.out`
245     if test "$testfiles" = "*.out" ; then
246         echo "No output files remain from previous test!"
247         exit 1
248     fi
249 fi
250
251 echo '*** Differences from expected output ***'
252 /bin/rm -f coll.diff
253 for file in $testfiles ; do
254     stdfile=`basename $file .out`.std
255     if [ -s $stdfile ] ; then
256         if diff -b $file `basename $file .out`.std > /dev/null ; then
257             true
258         else
259             echo "Differences in `basename $file .out`" >> coll.diff
260             diff -b $file `basename $file .out`.std >> coll.diff
261         fi
262     else
263         echo "Can not find file $stdfile to compare against for test `basename $file .out`"
264     fi
265 done
266 if [ -s coll.diff ] ; then
267    cat coll.diff
268 fi
269 exit 0