X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/abacf1fc86b15392727e4fedb38da442167fd51d..10a7f95aedfe591594bf993e663e28956bdbaeee:/src/smpi/smpirun.in 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