1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
#! /bin/sh
##
## Copyright (C) by Argonne National Laboratory
## See COPYRIGHT in top-level directory
##
file=`pwd`/test-port
prefix="@prefix@"
exec_prefix="@exec_prefix@"
mpiexec="@bindir@/mpiexec"
starter="$mpiexec -n 1"
testpgm=testconnect
rm -f $file
# Default number of processes to start (the test is for large numbers
# of processes; use "manyconnect 10" to start with fewer for debugging)
nconn=100
# To avoid problems with listener queues, we pause every blockstart
# processes
blockstart=10
# Print help/usage information if requested
if [ "$1" = "-help" -o "$1" = "-usage" ] ; then
echo "$0 [ -singleton ] [ nconn [ testprogram ] ]"
exit 0
fi
if [ "$1" = "-singleton" ] ; then
starter=eval
shift
fi
if [ -n "$1" ] ; then
nconn=$1
shift
fi
if [ -n "$1" ] ; then
if [ -x "$1" ] ; then
testpgm=$1
else
echo "Expected to find an executable program; found $1"
exit 1
fi
shift
fi
# Make sure that the program is executable
if [ ! -x "$testpgm" ] ; then
# Try to make it
echo "Making $testpgm"
make $testpgm
if [ $? != 0 ] ; then
echo "Failure in make $testpgm"
exit 1
fi
if [ ! -x "$testpgm" ] ; then
echo "The program $testpgm either does not exist or is not executable"
exit 1
fi
fi
# Start one and sleep to avoid problems with two processes opening the
# test-port file for writing
$starter ./$testpgm $file $nconn 1 &
sleep 1
nstarted=2
blockcount=2
while [ $nstarted -lt $nconn ] ; do
#echo "Starting $nstarted"
$starter ./$testpgm $file $nconn $nstarted &
echo "Started process $! (num $nstarted)"
nstarted=`expr $nstarted + 1`
blockcount=`expr $blockcount + 1`
if [ -n "$2" ] ; then
sleep $2
elif [ $blockcount -ge $blockstart ] ; then
blockcount=0
sleep 1
fi
done
#echo "Starting $nstarted"
$starter ./$testpgm $file $nconn $nstarted
wait
|