Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
remove a few more leaks to please valgrind, but nothing important
[simgrid.git] / src / smpi / smpirun.in
index 70a4fba..e290d20 100755 (executable)
@@ -23,6 +23,7 @@ cat <<EOF
 Usage: $0 [OPTIONS] -platform <xmldesc> -hostfile <hostfile> program [program-options]
 Options:
   -keep-temps                # don't remove the generated files after execution
+  -wrapper <command>         # use command to run the program (e.g. "valgrind")
   -map                       # display the machine on which each process rank is mapped
   -np <numprocs>             # use that amount of processes from the hostfile.
                              # By default, all processes of the hostfile are used.
@@ -31,7 +32,7 @@ Options:
   -trace-comment-file <file> # put file contents on the top of the trace file as comment
   -trace-grouped             # group MPI processes by location
   -trace-resource            # trace resource utilization
-  -trace-triva               # generate configuration for Triva's GraphView
+  -trace-viva               # generate configuration for Viva's GraphView
   -trace-file <tracefile>    # name of the tracefile (simgrid_smpi.trace)
   -ext <value>               # additional parameter (reserved)
 
@@ -49,6 +50,7 @@ then
 fi
 
 EXTOPT=""
+WRAPPER=""
 
 while true; do
   case "$1" in
@@ -121,8 +123,8 @@ while true; do
       shift 1
    ;;
 
-   "-trace-triva")
-       TRACE_TRIVA="true"
+   "-trace-viva")
+       TRACE_VIVA="true"
          shift 1
    ;;
 
@@ -131,6 +133,11 @@ while true; do
       shift 1
    ;;
 
+   "-wrapper")
+      WRAPPER="$2"
+      shift 2
+      ;;
+
    "-help" | "--help" | "-h")
       usage
       exit
@@ -149,9 +156,31 @@ while true; do
   esac
 done
 
-EXEC="$1"
+if [ -n "$WRAPPER" ]; then
+    EXEC="$WRAPPER $1"
+else
+    EXEC="$1"
+fi
 shift
 
+# steel --cfg and --logs options
+while [ $# -gt 0 ]; do
+  case "$1" in
+   "--cfg="*|"--log="*)
+     for OPT in ${1#*=}
+     do
+       SIMOPTS="$SIMOPTS ${1%%=*}=$OPT"
+     done
+     shift 1
+   ;;
+    *)
+      PROC_ARGS="${PROC_ARGS:+$PROC_ARGS }$1"
+      shift      
+    ;;
+  esac
+done
+
+
 ##-----------------------------------
 
 # Basic checks on the provided arguments
@@ -235,10 +264,13 @@ if [ -n "${HOSTFILE}" ] && [ -f ${HOSTFILE} ]; then
 fi
 
 if [ "${EXTOPT}" = "smpi_replay" ]; then
-  APP_TRACES=$1;
-  if [ -n "${APP_TRACES}" ] && [ -f ${APP_TRACES} ]; then
+  APP_TRACES=$PROC_ARGS
+  if [ -n "${APP_TRACES}" ] && [ -f "${APP_TRACES}" ]; then
      hosttraces=(`cat ${APP_TRACES} | tr \\\n " "`)
      NUMTRACES=`cat ${APP_TRACES} | wc -l`
+  else
+     printf "File not found: %s\n", "${APP_TRACES:-\${APP_TRACES\}}" >&2
+     exit 1
   fi
 fi
 
@@ -287,7 +319,7 @@ do
       echo "    <argument value=\"${hosttraces[0]}\"/>" >> ${APPLICATIONTMP}
     fi
   else 
-    for ARG in $*; do
+    for ARG in $PROC_ARGS; do
        echo "    <argument value=\"${ARG}\"/>" >> ${APPLICATIONTMP}
     done
   fi
@@ -323,17 +355,17 @@ if [ -n "${TRACE_ACTIVE}" ]; then
     TRACEOPTIONS="${TRACEOPTIONS} --cfg=tracing/categorized:1 --cfg=tracing/uncategorized:1"
   fi
 
-  if [ -n "${TRACE_TRIVA}" ]; then
-    TRACEOPTIONS="${TRACEOPTIONS} --cfg=triva/categorized:smpi_cat.plist --cfg=triva/uncategorized:smpi_uncat.plist"
+  if [ -n "${TRACE_VIVA}" ]; then
+    TRACEOPTIONS="${TRACEOPTIONS} --cfg=viva/categorized:smpi_cat.plist --cfg=viva/uncategorized:smpi_uncat.plist"
   fi
 fi
 ##---------------------- end SMPI TRACING OPTIONS ---------------------------------
 
 export SMPI_GLOBAL_SIZE=${NUMPROCS}
 if [ -n "${KEEP}" ] ; then
-  echo ${EXEC} ${SIMOPTS} ${TRACEOPTIONS} ${PLATFORMTMP} ${APPLICATIONTMP}
+  echo ${EXEC} ${TRACEOPTIONS} ${SIMOPTS} ${PLATFORMTMP} ${APPLICATIONTMP}
 fi
-${EXEC} ${SIMOPTS} ${TRACEOPTIONS} ${PLATFORMTMP} ${APPLICATIONTMP}
+${EXEC} ${TRACEOPTIONS} ${SIMOPTS} ${PLATFORMTMP} ${APPLICATIONTMP}
 status=$?
 
 if [ -z "${KEEP}" ] ; then