Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
use sensible process names (their rank) in SMPI, and get simix ignore that
[simgrid.git] / src / smpi / smpirun.in
index 6e5f71b..ad8295b 100755 (executable)
@@ -16,7 +16,29 @@ NETWORK_LATENCY="${DEFAULT_NETWORK_LATENCY}"
 NUMPROCS="${DEFAULT_NUMPROCS}"
 POWER="${DEFAULT_POWER}"
 
-SIMOPTS="--cfg=network/model:SMPI --cfg=TCP_gamma:4194304"
+SIMOPTS="--cfg=maxmin/precision:1e-9 --cfg=network/model:SMPI --cfg=network/TCP_gamma:4194304"
+
+#usage to print the way this script should be called
+function usage () {
+    echo "usage:"
+    echo "$0 [-quiet] [-keep-temps]"
+    echo "      [-np <numprocs>] -platform <xmldesc> -hostfile <hostfile> [-map] program [program-options]"
+    echo "      [-trace]                  # activate tracing"
+    echo "      [-trace-grouped]          # group MPI processes by location"
+    echo "      [-trace-resource]         # trace resource utilization"
+    echo "      [-trace-triva]            # generate configuration for Triva's GraphView"
+    echo "      [-trace-file <tracefile>] # name of the tracefile (simgrid_smpi.trace)"
+    echo "or (deprecated usage):"
+    echo "$0 [-quiet] [-keep-temps] [-np <numprocs>] [-bandwidth <bytes/sec>] [-latency <secs>] program [program-options]"
+    echo
+}
+
+#check if we have at least one parameter
+if [ $# -eq 0 ]
+then
+    usage
+    exit
+fi
 
 while true; do
   case "$1" in
@@ -55,8 +77,28 @@ while true; do
    ;;
 
    "-trace")
-       TRACEOPT="$2"
-         shift 2
+       TRACE_ACTIVE="true"
+         shift 1
+   ;;
+
+   "-trace-file")
+      TRACE_FILENAME="$2"
+      shift 2
+   ;;
+
+   "-trace-grouped")
+      TRACE_GROUPED="true"
+      shift 1
+   ;;
+
+   "-trace-resource")
+      TRACE_RESOURCE="true"
+      shift 1
+   ;;
+
+   "-trace-triva")
+       TRACE_TRIVA="true"
+         shift 1
    ;;
 
    "-keep-temps")
@@ -65,11 +107,7 @@ while true; do
    ;;
 
    "-help" | "--help" | "-h")
-      echo "usage:"
-      echo "$0 [-quiet] [-keep-temps] [-trace <tracefile>] [-np <numprocs>] -platform <xmldesc> -hostfile <hostfile> [-map] program [program-options]"
-      echo "or (deprecated usage):"
-      echo "$0 [-quiet] [-keep-temps] [-np <numprocs>] [-bandwidth <bytes/sec>] [-latency <secs>] program [program-options]"
-      echo
+      usage
       exit
    ;;
 
@@ -91,6 +129,13 @@ shift
 
 ##-----------------------------------
 
+# test if we have something to execute, otherwise show usage and exit
+if [ -z ${EXEC} ]
+then
+    echo "Program is missing"
+    usage
+    exit 1
+fi
 
 
 
@@ -100,8 +145,8 @@ if [ -z "${PLATFORM}" ]; then
 
        cat > ${PLATFORMTMP} <<PLATFORMHEAD
 <?xml version='1.0'?>
-<!DOCTYPE platform SYSTEM "simgrid.dtd">
-<platform version="2">
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
+<platform version="3">
 <AS id="AS0" routing="Full">
 PLATFORMHEAD
 
@@ -138,8 +183,8 @@ APPLICATIONTMP="$(mktemp tmpXXXXXX)"
 
 cat > ${APPLICATIONTMP} <<APPLICATIONHEAD
 <?xml version='1.0'?>
-<!DOCTYPE platform SYSTEM "simgrid.dtd">
-<platform version="2">
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
+<platform version="3">
 APPLICATIONHEAD
 
 ##---- cache hostnames of hostfile---------------
@@ -184,7 +229,7 @@ do
   else
        host="${hostnames[$j]}"
   fi
-  echo "  <process host=\"${host}\" function=\"smpi_simulated_main\">" >> ${APPLICATIONTMP}
+  echo "  <process host=\"${host}\" function=\"rank$i\"> <!-- function name used only for logging -->" >> ${APPLICATIONTMP}
   echo "    <argument value=\"$i\"/> <!-- rank -->" >> ${APPLICATIONTMP}
   for ARG in $*; do
     echo "    <argument value=\"${ARG}\"/>" >> ${APPLICATIONTMP}
@@ -198,11 +243,25 @@ APPLICATIONFOOT
 ##-------------------------------- end DEFAULT APPLICATION --------------------------------------
 
 ##---------------------- SMPI TRACING OPTIONS ---------------------------------
-  if [ -n "${TRACEOPT}" ]; then
-    TRACEOPTIONS="--cfg=tracing/filename:${TRACEOPT} --cfg=tracing/smpi:1 --cfg=tracing/platform:1"
-  else
-    TRACEOPTIONS=""
+if [ -n "${TRACE_ACTIVE}" ]; then
+  #define trace filename
+  if [ -z "${TRACE_FILENAME}" ]; then
+    TRACE_FILENAME="smpi_simgrid.trace"
+  fi
+  TRACEOPTIONS="--cfg=tracing:1 --cfg=tracing/filename:${TRACE_FILENAME} --cfg=tracing/smpi:1"
+
+  if [ -n "${TRACE_GROUPED}" ]; then
+    TRACEOPTIONS="${TRACEOPTIONS} --cfg=tracing/smpi/group:1"
   fi
+
+  if [ -n "${TRACE_RESOURCE}" ]; 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"
+  fi
+fi
 ##---------------------- end SMPI TRACING OPTIONS ---------------------------------
 
 export SMPI_GLOBAL_SIZE=${NUMPROCS}