Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
optimize MPI_Sendrecv if a process has to exchange with himself only
[simgrid.git] / teshsuite / smpi / mpich-test / coll / runtests
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=
5 device=
6 MPICH_VERSION=
7 STOPFILE=${MPITEST_STOPTEST:-"$HOME/.stopmpichtests"}
8
9 MAKE="make --no-print-directory"
10 MPIRUNMVBACK=''
11 #
12
13 # Set mpirun to the name/path of the mpirun program
14 #FindMPIRUN
15 #
16 runtests=1
17 makeeach=0
18 writesummaryfile=no
19 have_fortran=0
20 have_selector="no"
21 quiet=0
22 MAKE="make --no-print-directory"
23 for arg in "$@" ; do
24     case $arg in
25     -basedir=* )
26         basedir=`echo $arg | sed 's/-basedir=//'`
27         ;; 
28     -srcdir=* )
29         srcdir=`echo $arg | sed 's/-srcdir=//'`
30         ;; 
31         -fort=* )
32         have_fortran=`echo $arg | sed 's/-fort=//'`
33         ;;
34         -selector=* )
35         have_selector=`echo $arg | sed 's/-selector=//'`
36         ;;
37         -checkonly )
38         runtests=0
39         ;;
40     -margs=*)
41         margs=`echo $arg | sed 's/-margs=//'`
42         args="$args $margs"
43         ;;
44         -small)
45         shift
46         makeeach=1
47         ;;
48         -summaryfile=*)
49         writesummaryfile=yes
50         summaryfile=`echo A$arg | sed 's/A-summaryfile=//'`
51         ;;
52         -quiet)
53         shift
54         quiet=1
55         ;;
56         -help|-u)
57         echo "runtests [-checkonly] [-margs='...']"
58         echo "run tests in this directory.  If -checkonly set, just run"
59         echo "the differences check (do NO rerun the test programs)."
60         echo "If -margs is used, these options are passed to mpirun."
61         echo "If -small is used, the examples are built, run, and deleted."
62         exit 1
63         ;;
64         *)
65         if test -n "$arg" ; then
66             echo "runtests: Unknown argument ($arg)"
67             exit 1
68         fi
69         ;;
70     esac
71 done
72 # Load basic procedures
73 . ${srcdir}/../runbase
74 #
75 # If the programs are not available, run make.
76 if [ ! -x coll1 -a $makeeach = 0 -a $runtests = 1 ] ; then
77     $MAKE
78 fi
79
80 if [ $have_selector -eq "" ] ; then 
81 selector=""
82 else
83 selector="--cfg=smpi/coll_selector:$have_selector"
84 fi
85
86 mpirun=" ${basedir}/bin/smpirun -platform ${srcdir}/../../../../examples/msg/small_platform_with_routers.xml -hostfile ${srcdir}/../../hostfile  --log=root.thres:critical  $selector "
87 testfiles=""
88 if [ $runtests = 1 ] ; then
89 echo '**** Testing MPI Collective routines ****'
90
91 RunTest barrier 4 "*** Barrier Test ***" "" "barrier-0.out"
92
93 RunTest bcast_mpich 4 "*** Broadcast Test ***" "" "bcast-0.out bcast-1.out bcast-2.out bcast-3.out"
94
95 RunTest bcastvec 4 "*** Broadcast Datatype Test ***" "" "bcastvec-0.out bcastvec-1.out bcastvec-2.out bcastvec-3.out"
96
97
98 #TODO : handle MPI_BOTTOM to allow som operations to use absolute addresses
99 RunTest coll1 4
100
101 RunTest coll2 5
102
103 RunTest coll3 5
104
105 RunTest coll4 4
106
107 RunTest coll5 4
108
109 RunTest coll6 5
110
111 RunTest coll7 5
112
113 RunTest coll8 4
114
115 RunTest coll9 4
116
117 RunTest coll10 4
118
119 RunTest coll11 4
120
121 #weird manipulations of ranks in split, and comms -> deadlock, removed
122 #RunTest scantst 4
123
124 RunTest coll12 4
125
126 # coll13 is very picky about arguments
127 RunTest coll13 14
128
129 RunTest longuser 4
130
131 # Some implementations (e.g., IBM's) forget to handle the np = 1 case.
132 #RunTest longuser 1 "*** longuser (np == 1) ***"
133 MakeExe longuser
134 cp longuser longuser1
135 RunTest longuser1 1 '*** longuser (np == 1) ***'
136 rm -f longuser1
137
138 #OutTime
139 #testfiles="$testfiles allredmany.out"
140 #rm -f allredmany.out
141 #MakeExe allredmany
142 #echo '**** allredmany ****'
143 #echo '*** allredmany ***' >> allredmany.out
144 #cnt=0
145 ## Run several times to try and catch timing/race conditions in managing
146 ## the flood of one-way messages.
147 #while [ $cnt -lt 20 ] ; do
148 #    echo "*** allredmany run $cnt ***" >> allredmany.out
149 #    $mpirun -np 2 $args allredmany >> allredmany.out 2>&1
150 #    cnt=`expr $cnt + 1`
151 #done
152 #echo '*** allredmany ***' >> allredmany.out
153 #CleanExe allredmany
154
155 RunTest grouptest 4
156
157 RunTest allred 4 "*** Allred ***"
158
159 RunTest allred2 4 "*** Allred2 ***"
160 #uses MPI_Dims_create, MPI_Cart_create ... removed
161 #RunTest scatterv 4 "*** Scatterv ***"
162
163 RunTest scattern 4 "*** Scattern ***"
164
165 RunTest redscat 4 "*** Reduce_scatter ***"
166
167 RunTest alltoallv_mpich 4 "*** Alltoallv ***"
168 echo "runtests: fortran ($have_fortran)"
169 #
170 # Run Fortran tests ONLY if Fortran available
171 if [ $have_fortran -eq "1" ] ; then 
172     echo "FORTRAN TESTS"
173
174     RunTest allredf 4 "*** Testing allreduce from Fortran ***"
175
176     RunTest assocf 4 "*** Testing allreduce from Fortran (2) ***"
177
178     RunTest bcastlog 4 "*** Testing logical datatype in BCAST ***"
179     #buggy test, not available in original test, removed
180     #RunTest allgatherf 2 "*** Testing allgather from Fortran ***"
181     echo "END OF FORTRAN TESTS"
182 fi
183
184 else
185     # Just run checks
186     testfiles=`echo *.out`
187     if test "$testfiles" = "*.out" ; then
188         echo "No output files remain from previous test!"
189         exit 1
190     fi
191 fi
192
193 echo '*** Checking for differences from expected output ***'
194 CheckAllOutput coll.diff
195 exit 0