Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
first commit to add the mpich-test suite to smpi tesh suite. Obviously all tests...
[simgrid.git] / teshsuite / smpi / mpich-test / pt2pt / runtests
1 #! /bin/sh
2 #
3 # Run some of the tests.  If any arguments are provided, pass them to the
4 # test programs.
5 #
6 # -mvhome is needed for the ANL SP, and is ignored by others
7 args=
8 device=
9 MPICH_VERSION=
10 STOPFILE=${MPITEST_STOPTEST:-"$HOME/.stopmpichtests"}
11 MAKE="make --no-print-directory"
12 MPIRUNMVBACK=""
13 #
14 # Load basic procedures
15
16 #
17 # Set mpirun to the name/path of the mpirun program
18 #FindMPIRUN
19 #
20 # If the programs are not available, run make.
21 runtests=1
22 makeeach=0
23 writesummaryfile=no
24 check_at_once=1
25 quiet=0
26 check_canrun=0
27 CheckOutputWhileRunning="yes"
28 # Using shifts should  remove args from the list.
29 for arg in "$@" ; do
30     case $arg in 
31     -basedir=* )
32         basedir=`echo $arg | sed 's/-basedir=//'`
33         ;; 
34     -srcdir=* )
35         srcdir=`echo $arg | sed 's/-srcdir=//'`
36         ;; 
37         -checkonly)
38         shift
39         runtests=0
40         ;;
41         -margs=*)
42         shift
43         margs=`echo $arg | sed 's/-margs=//'`
44         args="$args $margs"
45         ;;
46         -summaryfile=*)
47         writesummaryfile=yes
48         summaryfile=`echo A$arg | sed 's/A-summaryfile=//'`
49         ;;
50         -echo)
51         shift
52         set -x
53         ;;
54         -check)
55         check_canrun=1
56         ;;
57         -quiet)
58         shift
59         quiet=1
60         ;;
61         -small)
62         shift
63         makeeach=1
64         ;;
65         -atend)
66         shift
67         check_at_once=0
68         ;;
69         -help|-u)
70         shift
71         echo "runtests [-checkonly] [-margs='...'] [-atend] [-check]"
72         echo "run tests in this directory.  If -checkonly set, just run"
73         echo "the differences check (do NO rerun the test programs)."
74         echo "If -margs is used, these options are passed to mpirun."
75         echo "If -small is used, the examples are built, run, and deleted."
76         echo "If -atend is used, the success of the tests is checked only"
77         echo "at the end of the test rather than also after each test."
78         echo "If -check is used, only a single simple test is run; this"
79         echo "is used to check that mpirun can run an MPI program."
80         exit 1
81         ;;
82         *)
83         if test -n "$arg" ; then
84             echo "Passing remaining arguments to programs ($*)"
85             break
86         fi
87         ;;
88     esac
89 done
90
91 #
92 # Load basic procedures
93 . ${srcdir}/../runbase
94
95 # Do this because we're writing the output while running
96 savewritesummaryfile=$writesummaryfile
97 writesummaryfile=no
98
99 mpirun=" ${basedir}/bin/smpirun --cfg=smpi/running_power:108095000 -platform ${srcdir}/../../../../examples/msg/small_platform_with_routers.xml -hostfile ${srcdir}/../../hostfile  --log=root.thres:critical"
100
101 # If cannot run test, do that and exit
102 if [ $check_canrun = 1 ] ; then
103     # Make sure that we don't have an old file lying around
104     rm -f third third.o third.exe
105     MakeExe third
106     rm -f third.out
107     echo '*** Testing Unexpected messages ***' >> third.out
108     $mpirun $args -np 2 ./third </dev/null >> third.out 2>&1
109     echo '*** Testing Unexpected messages ***' >> third.out
110     rm -f third.stdo
111     cat >>third.stdo <<EOF
112 *** Testing Unexpected messages ***
113  No Errors
114 *** Testing Unexpected messages ***
115 EOF
116 #    if diff -b third.out third.stdo > /dev/null ; then
117         rc=0
118 #    else
119 #       echo "Failed to run simple program!"
120 #       echo "Output from run attempt was"
121 #       cat third.out
122 #        echo "mpirun program was $mpirun"
123 #       echo "mpirun command was "
124 #       echo "$mpirun $args -np 2 ./third </dev/null >>third.out 2>&1"
125 #       rc=1
126 #    fi
127 #    CleanExe third
128 #    rm -f third.out 
129 #    exit $rc
130 fi
131
132 # If the programs are not available, run make.
133 if [ ! -x sendrecv_mpich -a $makeeach = 0 -a $runtests = 1 ] ; then
134     $MAKE
135 fi
136
137 testfiles=""
138 if [ $runtests = 1 ] ; then
139 echo '**** Testing MPI Point-to-point routines ****'
140
141 RunTest sendrecv_mpich 2 "**** Testing MPI_Send and MPI_Recv ****" "" "sendrecv-0.out sendrecv-1.out"
142
143 RunTest sendrecv2 2 "**** Testing MPI_Send and MPI_Recv (2) ****"
144
145
146 #Uses MPI_Pack and Unpack
147 #RunTest sendrecv3 2 "**** Testing MPI_Send and MPI_Recv (3) ****"
148
149 RunTest sendrecv4 2 "**** Testing MPI_Send and MPI_Recv (4) ****"
150
151 #not supported
152 #RunTest bsendtest 2 "**** Testing MPI_Bsend and MPI_Recv (4) ****" "" "bsendtest-0.out bsendtest-1.out"
153
154 RunTest isndrcv 2 "**** Testing MPI_Isend and MPI_Irecv ****" "" "isndrcv-0.out isndrcv-1.out"
155
156 #RunTest irsend 2 "**** Testing MPI_Irsend ****"
157
158 #RunTest irsendinit 2 "**** Testing MPI_Rsend_init ****"
159
160
161 #rsend and ssend to implement, removed for now
162 RunTest longmsgs 2 "**** Testing long messages ****"
163
164 RunTest testsome 2 "**** Testing MPI_Testsome/Testany/Waitsome ****"
165
166 #issend used, replaced by isend - fails 
167 #RunTest testall_mpich 2 "**** Testing MPI_Testall ****"
168
169 #MPI_Cancel, not yet implemented
170 #RunTest cancel 2 "**** Checking MPI_Cancel (Irecv's) ****"
171
172 #RunTest cancel2 2 "**** Checking MPI_Cancel (Persistent Recv's) ****"
173
174 #RunTest cancel3 2 "**** Checking MPI_Cancel (Persistent Send's) ****"
175
176 #RunTest cancelmessages 2 "**** Checking MPI_Cancel (short/eager/rndv) ****"
177
178 #RunTest cancelibm 2 "**** Checking MPI_Cancel (successful/nonsuccessful) ****"
179
180 # This test exposes a SEGV in the MPICH1 code.  However, this is an
181 # uncommon situtation.  Users who need this feature should switch to 
182 # MPICH2 (www.mcs.anl.gov/mpi/mpich2)
183 #RunTest cancelissend 2 "**** Checking MPI_Cancel and MPI_Issend (short msgs) ****"
184
185 RunTest sndrcv 2 "**** Testing MPI_Sendrecv ****"
186
187 RunTest sndrcvrep 2 "**** Testing MPI_Sendrecv_replace ****"
188
189 #fails : check if buffer is correctly moved
190 RunTest sndrcvrpl2 2 "**** Testing MPI_Sendrecv_replace (long) ****"
191
192 #not implemented :TODO, should be simple, add a nbelements parameter to the datatype, compute it at creation time, then multiply status->count by this number
193 #RunTest getelm 2 "**** Testing MPI_Get_elements ****"
194
195 #uses Pack_size, Buffer_attach, Bsend, Buffer_detach
196 #RunTest overtake 2 "**** Verifying that messages are non-overtaking ****" "" "overtake-0.out overtake-1.out"
197
198 #RunTest ssendtest 2 "**** Verifying ssend ****"
199
200 #RunTest ssendtest2 2 "**** Verifying ssend (2) ****"
201
202 #RunTest issendtest 2 "**** Verifying Issend ****" "" "issendtest-1.out"
203
204 #RunTest issend2 2 "**** Verifying Issend (2) ****"
205
206 #uses MPI_Cancel, lets a lot of orphan comms.
207 #RunTest reqcreate 1 "**** Checking the request creation routines ****"
208
209
210 #hangs without reason: TODO debug
211 #RunTest reqfree 2 "**** Checking request free ****" "-req 2048"
212
213 RunTest typebase 1 "**** Checking the type (sizes) routines ****"
214
215 RunTest typecreate 1 "**** Checking the type creation routines ****"
216
217 RunTest typetest 2 "**** Checking the type routines ****" "" "typetest-0.out typetest-1.out"
218
219 #weird error, because comment says smpi returned value is same as expected from mpich .. modified to handle this value as correct
220 RunTest typeub 2 "**** Checking the type routines: MPI_UB ****"
221
222 #todo : handle lb correctly !
223 RunTest typeub2 1 "**** Checking the type routines: MPI_UB(2) ****"
224
225 #types too complex for smpi (structs of vectors)
226 #RunTest typeub3 1 "**** Checking the type routines: MPI_UB(3) ****"
227
228 #TODO: handle LB
229 RunTest typelb 1 "**** Checking the type routines: MPI_LB ****"
230
231 RunTest structlb 1 "**** Checking Type_struct routines: MPI_LB ****"
232
233 #ssend, replaced by send
234 RunTest dtypelife 2 "**** Checking the type routines: MPI_Type_free ****"
235
236 #TODO: handle alignment for extent values 
237 #RunTest dataalign 2 "**** Checking the type alignment ****"
238
239 RunTest dtyperecv 2 "**** Checking the type recv ****"
240
241 RunTest commit 1 "**** Checking the type routines: MPI_Type_commit ****"
242
243 RunTest third 2 "*** Testing Unexpected messages ***"
244
245 RunTest fourth 4 "*** Testing Irecv/Isend/Wait ***"
246
247 RunTest fifth 4 "*** Testing Irecv/Isend/Waitall ***"
248
249 #uses MPI_keyval_create, Attr_put, Attr_get, Attr_delete, Keyval_free
250 #RunTest sixth 2 "*** Testing attribute manipulation ***"
251
252 RunTest nblock 4 "*** Testing Isend/Irecv (large numbers) ***"
253
254 #TODO : unlock probing ...
255 #RunTest nbtest 4 "*** Testing Isend/Probe/Recv (large numbers) ***"
256
257 RunTest sendmany 8 "*** Testing Send (many procs) ***"
258
259 # ... replaced by smpi_sleep calls
260 RunTest order 2 "*** Testing Recv ordering ***"
261
262 RunTest sendorder 2 "**** Checking Message Ordering ****"
263
264 RunTest exittest 3 "**** Checking Exit Processing ****"
265
266 #uses MPI_Errors
267 #RunTest trunc 2 "*** Testing Message truncation ***"
268 #TODO: handle MPI_ERR_IN_STATUS
269 #RunTest truncmult 2 '*** Testing Message trunction in multiple completions ***'
270
271 RunTest nullproc 2 "*** Testing handling of MPI_PROC_NULL ***"
272
273 RunTest nullproc2 2 "*** Testing handling of MPI_PROC_NULL in blocking Recv ***"
274
275 RunTest relrank 2 "*** Testing handling of relative rank ***"
276
277 RunTest hvectest 2 "*** Testing Vector type ***"
278
279 RunTest hvectest2 2 "*** Testing struct type for vectors (MPI_UB) ***"
280
281 #too complex for now
282 RunTest hvec 2 "*** Testing Type_Hvector ***"
283 #fails
284 RunTest hindexed 1 "*** Testing Type_Hindexed ***"
285
286 RunTest probe 2 "*** Testing Probe and Get_count ***"
287
288 RunTest probe1 2 "*** Testing Iprobe and Get_count ***"
289
290 RunTest self 1 "*** Testing send to self ***"
291 #TODO : handle COMM_SELF
292 #RunTest selfvsworld 2 "*** Testing COMM_SELF and COMM_WORLD ***"
293
294 RunTest testtest1 2 "*** Testing MPI_Test ***"
295
296 RunTest persistent 4 "*** Testing MPI_Recv_init ***"
297
298 RunTest persist 4 "*** Testing MPI_Startall/Request_free ***"
299 #used MPI_Buffers and Bsends
300 #RunTest persist2 4 "*** Testing MPI_Startall(Bsend)/Request_free ***"
301
302 RunTest waitall 4 "*** Testing MPI_Waitall ***"
303
304 #uses issend, replaced by isend, and ssend replaced by send
305 #weirdly fails when launched by make
306 RunTest waitall2 2 "*** Testing MPI_Waitall (order) ***"
307
308 RunTest waitall3 4 "*** Testing MPI_Waitall (order-irecv) ***"
309
310 RunTest waitall4 4 "*** Testing MPI_Waitall (order-isend) ***"
311 #semi fails
312 RunTest waitany 4 "*** Testing MPI_Waitany ***"
313
314 #RunTest pack 2 "*** Testing MPI_Pack ***"
315
316 #calls to ssend replaced by send
317 RunTest flood 2 "**** Testing large messages ****"
318 RunTest sendcplx 2 "*** Testing Fortran send ***"
319 #very long
320 #RunTest flood2 2 "**** Testing large numbers of messages ****"
321 #
322 # Run Fortran tests ONLY if Fortran available
323 if [ 0 = 1 ] ; then 
324     echo "FORTRAN TESTS"
325     #
326     #echo "*** secondf ***" >> pt2pt.out
327     #$mpirun $args -np 2 ./secondf "$@" >> pt2pt.out 2>&1
328     #
329     RunTest isendf 2 "*** Testing isend from Fortran ***"
330
331     RunTest allpair 2 "*** Testing pt-2-pt from Fortran ***"
332
333     RunTest allpair2 2 "*** Testing pt-2-pt from Fortran (many calls) ***"
334     #
335     OutTime
336     testfiles="$testfiles structf.out"
337     rm -f structf.out
338     MakeExe structf
339     echo '*** Testing Type_struct from Fortran ***'
340     echo '*** Testing Type_struct from Fortran ***' >> structf.out
341     # This is tricky.  Because of a bug in IRIX64, we need to direct 
342     # input from /dev/null (so that we can know that we need a new process
343     # group).  This should be ok for everyone, but SunOS 4.1.4 tends to
344     # panic (!!) in this case.  Since both behaviors represent broken
345     # operating systems, we test for ARCH=IRIX64 
346     if [ "LINUX" = "IRIX64" ] ; then 
347       $mpirun $args -np 2 ./structf "$@" >> structf.out 2>&1 < /dev/null
348     else
349       $mpirun $args -np 2 ./structf "$@" >> structf.out 2>&1
350     fi
351     echo '*** Testing Type_struct from Fortran ***' >> structf.out
352     CheckOutput structf
353     CleanExe structf
354     #
355     RunTest send1 2 "*** Testing pt-2-pt from Fortran (2) ***"
356
357     RunTest sendfort 2 "*** Testing Fortran logical datatype ***"
358
359     #
360 #    testfiles="$testfiles pingpong.out"
361 #    rm -f pingpong.out
362 #    MakeExe pingpong
363 #    echo '*** Testing pt-2-pt from Fortran (3) ***'
364 #    echo '*** Testing pt-2-pt from Fortran (3) ***' >> pingpong.out
365 #    $mpirun $args -np 2 ./pingpong "$@" >> pingpong.out 2>&1
366 #    echo '*** Testing pt-2-pt from Fortran (3) ***' >> pingpong.out
367 #    CheckOutput pingpong
368 #    CleanExe pingpong
369     #
370     echo "END OF FORTRAN TESTS"
371 fi
372 #
373 else
374     # Just run checks
375     testfiles=`echo *.out`
376     if test "$testfiles" = "*.out" ; then
377         echo "No output files remain from previous test!"
378         exit 1
379     fi
380 fi
381 #
382 writesummaryfile=$savewritesummaryfile
383 echo '*** Checking for differences from expected output ***'
384 CheckAllOutput pt2pt.diff
385 exit 0
386