Quick Notes : getting started with the examples
===============================================
+..:: What you need ::..
+
+- a platform file describing the environment. You can go to
+ the Platform Description Archive (http://pda.gforge.inria.fr/) to
+ get an existing one or generate your own platform with the
+ SIMULACRUM tool (see 'Download' section there).
+
+- a hostfile. Like in almost all MPI distributions, the hostfile
+ list the hosts which the processes will be mapped on. At present,
+ the format is one hostname per line. The hostnames must be present
+ in the platform file.
+
+ Note: the mapping of MPI processes (ranks) follows the order of the
+ hostfile. Rank 0 is mapped to first hostname in hostfile, Rank 1
+ on second hostname, etc. If n (where -np n) is greater than the
+ number l of lines in hostfile, the mapping is done round-robin.
+
+
+..:: Try the examples ::..
+
Go to :
# cd simgrid/src/smpi/sample
shift 2
;;
+ "-map")
+ MAPOPT="on"
+ shift 1
+ ;;
+
"-help" | "--help" | "-h")
echo "usage:"
- echo "$0 [-np <numprocs>] [-bandwidth <bytes/sec>] [-latency <secs>] [-platform <xmldesc>] [-hostfile <hostfile>] program [program-options]"
+ echo "$0 [-np <numprocs>] -platform <xmldesc> -hostfile <hostfile> [-map] program [program-options]"
+ echo "or (deprecated usage):"
+ echo "$0 [-np <numprocs>] [-bandwidth <bytes/sec>] [-latency <secs>] program [program-options]"
echo
exit
;;
##---- cache hostnames of hostfile---------------
if [ -n "${HOSTFILE}" ] && [ -f ${HOSTFILE} ]; then
hostnames=(`cat ${HOSTFILE} | tr \\\n " "`)
+ NUMHOSTS=`cat ${HOSTFILE} | wc -l`
fi
##----------------------------------------------------------
## in hostfile (where -hostfile hostfile), or "host$i" if
## hostfile has less than i lines.
##----------------------------------------------------------
-for (( i=${NUMPROCS}; $i ; i=$i-1 )) do
- j=$(( $i-1 ))
+
+##---- generate <process> tags------------------------------
+
+for i in `seq 0 $((${NUMPROCS}-1))`
+do
+ if [ -n "${HOSTFILE}" ]; then
+ j=$(( $i % ${NUMHOSTS} ))
+ fi
+ ##---- optional display of ranks to process mapping
+ if [ -n ${MAPOPT} ]; then
+ echo "[rank $j] -> ${hostnames[$j]}"
+ fi
+
if [ -z "${hostnames[$j]}" ]; then
- host="host"$i
+ host="host"$(($j+1))
else
host="${hostnames[$j]}"
fi
echo " <process host=\"${host}\" function=\"smpi_simulated_main\">" >> ${APPLICATIONTMP}
- echo " <argument value=\"$j\"/> <!-- rank -->" >> ${APPLICATIONTMP}
+ echo " <argument value=\"$i\"/> <!-- rank -->" >> ${APPLICATIONTMP}
for ARG in $*; do
echo " <argument value=\"${ARG}\"/>" >> ${APPLICATIONTMP}
done
echo " </process>" >> ${APPLICATIONTMP}
done
-for (( i=${NUMPROCS}; $i ; i=$i-1 )) do
- j=$(( $i-1 ))
- if [ -z "${hostnames[$j]}" ]; then
- host="host"$i
- else
- host="${hostnames[$j]}"
- fi
-done
-
cat >> ${APPLICATIONTMP} <<APPLICATIONFOOT
</platform>
APPLICATIONFOOT