X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/bb03887eafe6f404c6ccf9dad8ad22fefc9b4422..b209fd002b9ef31307f6f604254ad84a6628d5b0:/src/smpi/smpirun.in diff --git a/src/smpi/smpirun.in b/src/smpi/smpirun.in index 97fad0ba95..28ae8b0829 100755 --- a/src/smpi/smpirun.in +++ b/src/smpi/smpirun.in @@ -1,7 +1,6 @@ #! /bin/sh -# Copyright (c) 2007-2015. The SimGrid Team. -# All rights reserved. +# Copyright (c) 2007-2016, The SimGrid Team. All rights reserved. # This program is free software; you can redistribute it and/or modify it # under the terms of the license (GNU LGPL) which comes with this package. @@ -24,6 +23,8 @@ NETWORK_BANDWIDTH="${DEFAULT_NETWORK_BANDWIDTH}" NETWORK_LATENCY="${DEFAULT_NETWORK_LATENCY}" SPEED="${DEFAULT_SPEED}" +PRIVATIZE="--cfg=smpi/privatize-global-variables:yes" + SIMOPTS="--cfg=surf/precision:1e-9 --cfg=network/model:SMPI --cfg=network/TCP-gamma:4194304" #usage to print the way this script should be called @@ -36,6 +37,7 @@ Options: -map # display the machine on which each process rank is mapped -np # use that amount of processes from the hostfile. # By default, all processes of the hostfile are used. + -no-privatize # Disable the globals privatization, that is activated by default -trace-ti # activate time independant tracing (for replay, default in smpi_simgrid.txt) -trace # activate tracing (Paje, default in smpi_simgrid.trace) -trace-comment # put a comment on the top of the trace file @@ -66,6 +68,8 @@ EXTOPT="" WRAPPER="" HOSTFILE="" HOSTFILETMP=0 +MAPOPT=0 +REPLAY=0 unset pid @@ -159,8 +163,12 @@ while true; do EXTOPT="$2" shift 2 ;; + "-no-privatize") + PRIVATIZE="" + shift 1 + ;; "-map") - MAPOPT="true" + MAPOPT=1 shift 1 ;; "-trace") @@ -233,6 +241,13 @@ while true; do esac done +# check if we still have at least one parameter beyond options +if [ $# -eq 0 ] +then + usage + exit +fi + if [ -n "$WRAPPER" ]; then EXEC="$WRAPPER $1" else @@ -376,6 +391,7 @@ if [ "${EXTOPT}" = "smpi_replay" ]; then if [ -n "${APP_TRACES}" ] && [ -f "${APP_TRACES}" ]; then hosttraces=$(cat ${APP_TRACES} | tr '\n\r' ' ' ) NUMTRACES=$(cat ${APP_TRACES} | wc -l) + REPLAY=1 else printf "File not found: %s\n" "${APP_TRACES:-\${APP_TRACES\}}" >&2 exit 1 @@ -400,35 +416,36 @@ else done fi +set -- $hostnames + ##---- generate tags------------------------------ +#prepare arguments at once +for ARG in $PROC_ARGS; do + XML_ARGS="${XML_ARGS}"" +" +done + for i in ${SEQ} do - if [ -n "${HOSTFILE}" ]; then - j=$(( $i % ${NUMHOSTS} + 1 )) - fi + j=$(( $i % ${NUMHOSTS} + 1 )) + host=$(eval "echo \${$j}") + ##---- optional display of ranks to process mapping - if [ -n "${MAPOPT}" ]; then - echo "[rank $i] -> $(echo $hostnames|cut -d' ' -f$j)" + if [ ${MAPOPT} = 1 ]; then + echo "[rank $i] -> $host" fi - if [ -z "$(echo $hostnames|cut -d' ' -f$j)" ]; then - host="host"$($j) - else - host="$(echo $hostnames|cut -d' ' -f$j)" - fi - echo " " >> ${APPLICATIONTMP} - echo " " >> ${APPLICATIONTMP} - echo " " >> ${APPLICATIONTMP} - if [ "${EXTOPT}" = "smpi_replay" ]; then + echo " + + " >> ${APPLICATIONTMP} + if [ ${REPLAY} = 1 ]; then if [ ${NUMTRACES} -gt 1 ]; then echo " " >> ${APPLICATIONTMP} else echo " " >> ${APPLICATIONTMP} fi else - for ARG in $PROC_ARGS; do - echo " " >> ${APPLICATIONTMP} - done + echo ${XML_ARGS} >> ${APPLICATIONTMP} fi echo " " >> ${APPLICATIONTMP} done @@ -476,7 +493,7 @@ fi export SMPI_GLOBAL_SIZE=${NUMPROCS} if [ -n "${KEEP}" ] ; then - echo ${EXEC} ${TRACEOPTIONS} ${SIMOPTS} ${PLATFORMTMP} ${APPLICATIONTMP} + echo ${EXEC} ${TRACEOPTIONS} ${SIMOPTS} ${PRIVATIZE} ${PLATFORMTMP} ${APPLICATIONTMP} if [ ${HOSTFILETMP} = 1 ] ; then echo "Generated hostfile ${HOSTFILE} kept." fi @@ -503,6 +520,22 @@ wait $pid status=$? pid="" +# Keep temporary files on failures to help debugging +# +if [ ${status} -ne 0 ] ; then + if [ -z ${KEEP} ]; then + echo ${EXEC} ${TRACEOPTIONS} ${SIMOPTS} ${PRIVATIZE} ${PLATFORMTMP} ${APPLICATIONTMP} + if [ ${HOSTFILETMP} = 1 ] ; then + echo "Generated hostfile ${HOSTFILE} kept." + fi + if [ ${UNROLLEDHOSTFILETMP} = 1 ] ; then + echo "Generated unrolled hostfile ${UNROLLEDHOSTFILE} kept." + fi + fi + echo "Execution failed with code ${status}." + KEEP=true +fi + smpirun_cleanup exit $status