#!/bin/bash
if [ $# -lt 1 ]; then
    echo "Usage: bash $0 NUM_PROCESSES"
    exit 1
fi

# Build hosts string
START=16
cur=`expr $START + 1`
hosts="edu0$START,edu0$cur"
for i in `seq 3 $1`; do
    cur=`expr $cur + 1`
    hosts="$hosts,edu0$cur"
done

mpirun -mca plm_rsh_agent /usr/bin/rsh -n $1 -host $hosts ./ring
#mpirun -np $1 ./ring
