Logo AND Algorithmique Numérique Distribuée

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