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 / testhetero
1 #! /bin/sh
2 #
3 # This is a simple heterogeneous test which exploits the mpicc command and
4 # mpirun.  This is an example of how heterogeneous programs may be built and
5 # run
6 #
7 #
8 # Parameters for all programs and systems
9 set -x
10 device=ch_p4
11 mpihome=../../..
12 rshcmd=rsh
13 programs="sendrecv sendrecv2 sendrecv3 sendrecv4 getelm"
14 # Extra files needed for each program.
15 sendrecvfiles="test.c"
16 sendrecvargs="-nolongdouble"
17 sendrecv2files="dtypes.c gcomm.c"
18 sendrecv3files="dtypes.c gcomm.c"
19 sendrecv4files="dtypes.c gcomm.c"
20 getelmfiles=""
21 #
22 #
23 # arch1 is local, arch2 is remote
24 arch1=sun4
25 arch2=freebsd
26 name2=dogbert
27 #
28 debug_args=""
29 fail_hard=1
30 rebuild=0
31 mpirun_args=""
32 for arg in "$@" ; do
33     case "$arg" in 
34         -echo) set -x ;;
35         -noclean) noclean=1 ;;
36         -debug) debug_args="-p4dbg 99 -p4rdbg 99" ;;
37         -mpichdebug) debug_args="$debug_args -mpichdebug" ;;
38         -xxgdb) mpirun_args="-xxgdb" ;;
39         -soft) fail_hard=0 ;;
40         -force | -rebuild) rebuild=1 ;;
41         -alpha) arch2=alpha ; name2=ptera ;;
42         -help) 
43         echo "Test heterogeneous operation of MPICH with ch_p4 using"
44         echo "the versions of MPICH built in the current tree."
45         echo "Should be run on a sun4; it rsh's to other machines as"
46         echo "necessary."
47         exit 1
48         ;;
49         *) echo "Unrecognized argument $arg"
50         exit 1
51         ;;
52     esac
53 done
54 #
55 arches="$arch1 $arch2"
56 #
57 mypwd=`pwd`
58 # Fixup for brain-dead automounters
59 mypwd=`echo $mypwd | sed s%/tmp_mnt%%g`
60 #
61 # Build local versions
62 if [ 1 = 1 ] ; then
63     for pgm in $programs ; do
64         eval extrafiles=$"${pgm}files"
65         $mpihome/lib/$arch1/$device/mpicc -o $pgm.$arch1 $pgm.c $extrafiles
66     done
67 fi
68 #
69 # Build remote versions
70 for pgm in $programs ; do 
71     eval extrafiles=$"${pgm}files"
72     $rshcmd -n $name2 "(cd $mypwd ; $mpihome/lib/$arch2/$device/mpicc \
73         -o $pgm.$arch2 $pgm.c $extrafiles)"
74 done
75 #
76 # Run the programs
77 for pgm in $programs ; do
78     echo "Running $pgm..."
79     eval extraargs=$"${pgm}args"
80     $mpihome/lib/$arch1/$device/mpirun $mpirun_args \
81                 -arch $arch1 -np 1 -arch $arch2 -np 1 $pgm.%a $debug_args \
82                 $extraargs
83 done
84 #
85 # Remove the executables
86 if [ -z "$noclean" ] ; then 
87     for arch in $arches ; do
88         for pgm in $programs ; do
89             rm -f $pgm.$arch
90         done
91     done
92 fi