Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Added flag for printing more debug info
[simgrid.git] / src / smpi / smpirun.in
index 0fda9b4..ce3b1c5 100755 (executable)
@@ -43,14 +43,9 @@ while true; do
       fi
        shift 2
     ;;
-
+   
    "-map")
-       MAPOPT="on"
-      shift 1
-   ;;
-
-   "-quiet")
-       QUIET="true"
+       MAPOPT="true"
       shift 1
    ;;
 
@@ -68,7 +63,7 @@ while true; do
       exit
    ;;
    
-   "--cfg="*)
+   "--cfg="*|"--log="*)
      SIMOPTS="$SIMOPTS $1"
      shift 1
    ;;
@@ -145,15 +140,28 @@ fi
 ##  hostfile has less than i lines.
 ##----------------------------------------------------------
 
+HAVE_SEQ="`which seq`"
+HAVE_JOT="`which jot`"
+
+if [ -n "${HAVE_SEQ}" ]; then
+       SEQ=`${HAVE_SEQ} 0 $((${NUMPROCS}-1))`
+else
+      cnt=0
+       while (( $cnt < ${NUMPROCS} )) ; do
+           SEQ="$SEQ $cnt"
+           cnt=$((cnt + 1));
+       done
+fi
+
 ##---- generate <process> tags------------------------------
 
-for i in `seq 0 $((${NUMPROCS}-1))` 
+for i in ${SEQ} 
 do
   if [ -n "${HOSTFILE}" ]; then
        j=$(( $i % ${NUMHOSTS} ))
   fi 
   ##---- optional display of ranks to process mapping
-  if [ -n ${MAPOPT} ]; then
+  if [ -n "${MAPOPT}" ]; then
        echo "[rank $i] -> ${hostnames[$j]}"  
   fi
 
@@ -175,17 +183,14 @@ cat >> ${APPLICATIONTMP} <<APPLICATIONFOOT
 APPLICATIONFOOT
 ##-------------------------------- end DEFAULT APPLICATION --------------------------------------
 
-if [ -z "${QUIET}" ] ; then
+if [ -n "${KEEP}" ] ; then
   echo ${EXEC} ${SIMOPTS} ${PLATFORMTMP} ${APPLICATIONTMP}
 fi
 ${EXEC} ${SIMOPTS} ${PLATFORMTMP} ${APPLICATIONTMP}
 
-if [ "x$?" == "x0" ] && [ -n ${KEEP} ] ; then
-  if [ -z "${QUIET}" ] ; then
-    echo "[$0] cleaning up temp files" 
-  fi
+if [ -z "${KEEP}" ] ; then
    if [ -z "${PLATFORM}" ]; then
        rm ${PLATFORMTMP} 
    fi
    rm ${APPLICATIONTMP}
-fi
\ No newline at end of file
+fi