From: genaud Date: Thu, 25 Jun 2009 10:30:44 +0000 (+0000) Subject: more in README X-Git-Tag: SVN~1288 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/10a7f95aedfe591594bf993e663e28956bdbaeee more in README mapping of ranks to hosts is done i) in order of hostfile ii) round-robin (if -np n > number of lines in hostfile) git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6352 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/src/smpi/README b/src/smpi/README index 7c5e1cd553..1d766f116c 100644 --- a/src/smpi/README +++ b/src/smpi/README @@ -2,6 +2,26 @@ 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 diff --git a/src/smpi/smpirun.in b/src/smpi/smpirun.in index a57e61aa4a..e9660c2300 100755 --- a/src/smpi/smpirun.in +++ b/src/smpi/smpirun.in @@ -44,9 +44,16 @@ while true; do shift 2 ;; + "-map") + MAPOPT="on" + shift 1 + ;; + "-help" | "--help" | "-h") echo "usage:" - echo "$0 [-np ] [-bandwidth ] [-latency ] [-platform ] [-hostfile ] program [program-options]" + echo "$0 [-np ] -platform -hostfile [-map] program [program-options]" + echo "or (deprecated usage):" + echo "$0 [-np ] [-bandwidth ] [-latency ] program [program-options]" echo exit ;; @@ -113,6 +120,7 @@ APPLICATIONHEAD ##---- cache hostnames of hostfile--------------- if [ -n "${HOSTFILE}" ] && [ -f ${HOSTFILE} ]; then hostnames=(`cat ${HOSTFILE} | tr \\\n " "`) + NUMHOSTS=`cat ${HOSTFILE} | wc -l` fi ##---------------------------------------------------------- @@ -121,30 +129,32 @@ 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 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 " " >> ${APPLICATIONTMP} - echo " " >> ${APPLICATIONTMP} + echo " " >> ${APPLICATIONTMP} for ARG in $*; do echo " " >> ${APPLICATIONTMP} done echo " " >> ${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