/usr/lib/mpich/bin/mpirun.rand is in mpich-bin 1.2.7-10ubuntu1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 | #!/bin/sh
# This script randomly permutes the machines file
#
machinesFile=$1
machines_randFile=$2
#
machines_temp="$TEMPDIR/mpitemp-${LOGNAME}$$"
machines_temp2="$TEMPDIR/mpitemp2-${LOGNAME}$$"
#
cat $machinesFile | sed -e '/^#/d' -e 's/#.*^//g' > $machines_temp
#
if [ -f "$machines_temp" ] ; then
machine_num=`wc -l $machines_temp | sed "s/\([\/]\).*//g"`
fi
#
while [ ${machine_num} -gt 0 ]
do
n=`expr $RANDOM % $machine_num`
n=`expr ${n} + 1`
#
if [ ${n} -eq 1 ] ; then
cat $machines_temp | head ${HEADARG}1 >> $machines_randFile
cat $machines_temp | tail ${HEADARG}`expr ${machine_num} - 1` >> $machines_temp2
elif [ ${n} -eq ${machine_num} ] ; then
cat $machines_temp | tail ${HEADARG}1 >> $machines_randFile
cat $machines_temp | head ${HEADARG}`expr ${n} - 1` >> $machines_temp2
else
cat $machines_temp | head ${HEADARG}${n} | tail ${HEADARG}1 >> $machines_randFile
cat $machines_temp | head ${HEADARG}`expr ${n} - 1` > $machines_temp2
cat $machines_temp | tail ${HEADARG}`expr ${machine_num} - ${n}` >> $machines_temp2
fi
#
mv $machines_temp2 $machines_temp
machine_num=`expr ${machine_num} - 1`
done
#
rm -f $machines_temp $machines_temp2
|