Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
more in README
authorgenaud <genaud@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 25 Jun 2009 10:30:44 +0000 (10:30 +0000)
committergenaud <genaud@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 25 Jun 2009 10:30:44 +0000 (10:30 +0000)
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

src/smpi/README
src/smpi/smpirun.in

index 7c5e1cd..1d766f1 100644 (file)
@@ -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
 
index a57e61a..e9660c2 100755 (executable)
@@ -44,9 +44,16 @@ while true; do
        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
    ;;
@@ -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 <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