function spawn() { NODE=$1 COUNT=$2 echo Spawning $COUNT on $NODE rsh $NODE -n “~/mark.sh” & #rsh $NODE -n “cd $PWD ; ./run.sh –agent –threads $COUNT” &
}
LAST= COUNT=0 for N in $NODES ; do if [ “$N” = “$LAST” ] ; then COUNT=$[COUNT+1] else if [ 0 -ne $COUNT ] ; then spawn $LAST $COUNT fi COUNT=1 LAST=$N fi done
if [ 0 -ne $COUNT ] ; then spawn $LAST $COUNT fi
Wait for children to exit
wait