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 ad8295b..a61487a 100755 (executable)
@@ -23,6 +23,8 @@ 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 --------------------------------------
@@ -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