X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a78c4213215c3991c47dd32da49028c075d8d9d3..172a73b13fe909117c7fbf3d69d4ce5e87efdbc6:/src/smpi/smpirun.in diff --git a/src/smpi/smpirun.in b/src/smpi/smpirun.in index 8889a0059d..46e5b290a8 100755 --- a/src/smpi/smpirun.in +++ b/src/smpi/smpirun.in @@ -25,7 +25,7 @@ SPEED="${DEFAULT_SPEED}" PRIVATIZE="--cfg=smpi/privatization:@HAVE_PRIVATIZATION@" -SIMOPTS="--cfg=surf/precision:1e-9 --cfg=network/model:SMPI --cfg=network/TCP-gamma:4194304" +SIMOPTS="--cfg=surf/precision:1e-9 --cfg=network/model:SMPI" #usage to print the way this script should be called usage () { @@ -75,6 +75,11 @@ unset pid trapped_signals="HUP INT QUIT ILL ABRT SEGV FPE ALRM TERM USR1 USR2 BUS" +die () { + printf '[%s] ** error: %s. Aborting.\n' "$(basename $0)" "$*" >&2 + exit 1 +} + smpirun_cleanup() { if [ -z "${KEEP}" ] ; then @@ -138,24 +143,21 @@ while true; do "-platform") PLATFORM="$2" if [ ! -f "${PLATFORM}" ]; then - echo "[`basename $0`] ** error: the file '${PLATFORM}' does not exist. Aborting." - exit 1 + die "the file '${PLATFORM}' does not exist" fi shift 2 ;; "-hostfile") HOSTFILE="$2" if [ ! -f "${HOSTFILE}" ]; then - echo "[`basename $0`] ** error: the file '${HOSTFILE}' does not exist. Aborting." - exit 1 + die "the file '${HOSTFILE}' does not exist" fi shift 2 ;; "-machinefile") HOSTFILE="$2" if [ ! -f "${HOSTFILE}" ]; then - echo "[`basename $0`] ** error: the file '${HOSTFILE}' does not exist. Aborting." - exit 1 + die "the file '${HOSTFILE}' does not exist" fi shift 2 ;; @@ -313,8 +315,7 @@ fi # Don't use wc -l to compute it to avoid issues with trailing \n at EOF hostfile_procs=$(grep -c "[a-zA-Z0-9]" $HOSTFILE) if [ ${hostfile_procs} = 0 ] ; then - echo "[`basename $0`] ** error: the hostfile '${HOSTFILE}' is empty. Aborting." >&2 - exit 1 + die "the hostfile '${HOSTFILE}' is empty" fi if [ -z "${NUMPROCS}" ] ; then @@ -404,7 +405,7 @@ fi HAVE_SEQ="$(which seq 2>/dev/null)" if [ -n "${HAVE_SEQ}" ]; then - SEQ=$(${HAVE_SEQ} 0 $((${NUMPROCS}-1))) + SEQ=$(${HAVE_SEQ} 0 $(( NUMPROCS - 1))) else cnt=0 while [ $cnt -lt ${NUMPROCS} ] ; do @@ -424,7 +425,7 @@ done for i in ${SEQ} do - j=$(( $i % ${hostfile_procs} + 1 )) + j=$(( i % hostfile_procs + 1 )) host=$(eval "echo \${$j}") ##---- optional display of ranks to actor mapping @@ -520,7 +521,7 @@ pid="" # Keep temporary files on failures to help debugging # if [ ${status} -ne 0 ] ; then - if [ -z ${KEEP} ]; then + if [ -z "${KEEP}" ]; then echo ${EXEC} ${PRIVATIZE} ${TRACEOPTIONS} ${SIMOPTS} ${PLATFORMTMP} ${APPLICATIONTMP} if [ ${HOSTFILETMP} = 1 ] ; then echo "Generated hostfile ${HOSTFILE} kept."