Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
xbt_swag: remove duplicated code.
[simgrid.git] / src / smpi / smpirun.in
index 09ea663..aea4116 100755 (executable)
@@ -18,6 +18,24 @@ POWER="${DEFAULT_POWER}"
 
 SIMOPTS="--cfg=maxmin/precision:1e-9 --cfg=network/model:SMPI --cfg=TCP_gamma:4194304"
 
+
+#usage to print the way this script should be called
+function usage () {
+    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
+}
+
+#check if we have at least one parameter
+if [ $# -eq 0 ]
+then
+    usage
+    exit
+fi
+
+
 while true; do
   case "$1" in
    "-np" | "-n")
@@ -59,6 +77,11 @@ while true; do
          shift 2
    ;;
 
+   "-trace-grouped")
+    TRACE_GROUPED="true"
+      shift 1
+   ;;
+
    "-triva")
        TRIVA="true"
          shift 1
@@ -70,11 +93,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
    ;;
 
@@ -96,6 +115,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
 
 
 
@@ -210,17 +236,19 @@ APPLICATIONFOOT
   fi
 
   if [ -n "${TRIVA}" ]; then
-    TRIVAOPTIONS="--cfg=triva/categorized:smpi_cat.plist --cfg=triva/uncategorized:smpi_uncat.plist"
-  else
-    TRIVAOPTIONS=""
+    TRACEOPTIONS="$TRACEOPTIONS --cfg=triva/categorized:smpi_cat.plist --cfg=triva/uncategorized:smpi_uncat.plist"
+  fi
+
+  if [ -n "${TRACE_GROUPED}" ]; then
+    TRACEOPTIONS="$TRACEOPTIONS --cfg=tracing/smpi/group:1"
   fi
 ##---------------------- end SMPI TRACING OPTIONS ---------------------------------
 
 export SMPI_GLOBAL_SIZE=${NUMPROCS}
 if [ -n "${KEEP}" ] ; then
-  echo ${EXEC} ${SIMOPTS} ${TRACEOPTIONS} ${TRIVAOPTIONS} ${PLATFORMTMP} ${APPLICATIONTMP}
+  echo ${EXEC} ${SIMOPTS} ${TRACEOPTIONS} ${PLATFORMTMP} ${APPLICATIONTMP}
 fi
-${EXEC} ${SIMOPTS} ${TRACEOPTIONS} ${TRIVAOPTIONS} ${PLATFORMTMP} ${APPLICATIONTMP}
+${EXEC} ${SIMOPTS} ${TRACEOPTIONS} ${PLATFORMTMP} ${APPLICATIONTMP}
 
 if [ -z "${KEEP}" ] ; then
    if [ -z "${PLATFORM}" ]; then