Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Basic checks on the arguments provoded to smpirun
[simgrid.git] / src / smpi / smpirun.in
index e9eea0f..a61487a 100755 (executable)
@@ -16,13 +16,15 @@ NETWORK_LATENCY="${DEFAULT_NETWORK_LATENCY}"
 NUMPROCS="${DEFAULT_NUMPROCS}"
 POWER="${DEFAULT_POWER}"
 
-SIMOPTS="--cfg=maxmin/precision:1e-9 --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 "      [-keep-temps]             # don't remove the generated files after execution"
+    echo "      [-map]                    # display the machine on which each process rank is mapped"
     echo "      [-trace]                  # activate tracing"
     echo "      [-trace-grouped]          # group MPI processes by location"
     echo "      [-trace-resource]         # trace resource utilization"
@@ -129,14 +131,18 @@ shift
 
 ##-----------------------------------
 
-# test if we have something to execute, otherwise show usage and exit
-if [ -z ${EXEC} ]
-then
-    echo "Program is missing"
+# Basic checks on the provided arguments
+if [ -z ${EXEC} ] ; then
+    echo "You must provide a program to execute."
     usage
     exit 1
 fi
 
+if [ -z ${HOSTFILE} ] ; then
+    echo "No hostfile specified."
+    usage
+    exit 1
+fi
 
 
 ##-------------------------------- DEFAULT or SPECIFIED PLATFORM --------------------------------------
@@ -229,7 +235,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}
@@ -259,7 +265,7 @@ if [ -n "${TRACE_ACTIVE}" ]; then
   fi
 
   if [ -n "${TRACE_TRIVA}" ]; then
-    TRACEOPTIONS="${TRACEOPTIONS} --cfg=tracing/categorized:smpi_cat.plist --cfg=tracing/uncategorized:smpi_uncat.plist"
+    TRACEOPTIONS="${TRACEOPTIONS} --cfg=triva/categorized:smpi_cat.plist --cfg=triva/uncategorized:smpi_uncat.plist"
   fi
 fi
 ##---------------------- end SMPI TRACING OPTIONS ---------------------------------
@@ -269,6 +275,7 @@ if [ -n "${KEEP}" ] ; then
   echo ${EXEC} ${SIMOPTS} ${TRACEOPTIONS} ${PLATFORMTMP} ${APPLICATIONTMP}
 fi
 ${EXEC} ${SIMOPTS} ${TRACEOPTIONS} ${PLATFORMTMP} ${APPLICATIONTMP}
+status=$?
 
 if [ -z "${KEEP}" ] ; then
    if [ -z "${PLATFORM}" ]; then
@@ -276,3 +283,5 @@ if [ -z "${KEEP}" ] ; then
    fi
    rm ${APPLICATIONTMP}
 fi
+
+exit $status