From 8357b7e28bf0e8df4ba8de8db2151e6a99b13244 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 19 Aug 2025 10:12:04 +0200 Subject: [PATCH] CONFIG: handle mpirunDebug stdin redirection before execution (#3389) - previously handled stdin redirection as part of the run command but (as Alexey Matveichev noted) this meant the command would actually require an `eval` for this to work. Instead redirect before executing the run command. - can always use 'echo -e' (bash builtin) in mpirunDebug CONFIG: add removal of mpirun.files/ to CleanFunctions - leave mpirun.log/ files untouched, since they may still be useful for later diagnosis --- bin/mpirunDebug | 27 +++++++++------------------ bin/tools/CleanFunctions | 7 +++++-- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/bin/mpirunDebug b/bin/mpirunDebug index 9d4197c0e1..efc34eeda9 100755 --- a/bin/mpirunDebug +++ b/bin/mpirunDebug @@ -16,8 +16,7 @@ # mpirunDebug # # Description -# Invoke mpirun with separate per-processor log files -# or running in separate XTerms. +# Invoke mpirun with separate per-processor log files etc. # Requires bash on all processors. # #------------------------------------------------------------------------------ @@ -100,15 +99,6 @@ methodNumberToName() #------------------------------------------------------------------------------- # Basic settings -case "$(uname -s)" in -Linux) - ECHO='echo -e' - ;; -*) - ECHO='echo' - ;; -esac - unset appName appArgs nProcs unset method spawn optClean optValue opt_nocore optConfirm=true @@ -250,7 +240,7 @@ then echo "Cleanup old mpirunDebug files..." rm -f gdbCommands mpirun.schema vgcore.* rm -f processor*.log processor*.sh - rm -rf mpirun.log mpirun.files + rm -rf mpirun.files mpirun.log echo " gdbCommands mpirun.schema vgcore.*" echo " processor*.{log,sh}" echo " mpirun.{files,log}/" @@ -289,7 +279,7 @@ exec=$(command -v $appName) if [ -z "$method" ] then echo "Choose running method: ${methodPrompt}" - $ECHO "[normal] > \c" + echo -e "[normal] > \c" read input : "${input:=0}" # Default (0) normal @@ -301,7 +291,7 @@ fi if [ -z "$spawn" ] then echo "Run all processes local or distributed? 1)local 2)remote" - $ECHO "[local] > \c" + echo -e "[local] > \c" read input : "${input:=1}" # Default (1) local @@ -478,7 +468,7 @@ unset cmd case "$WM_MPLIB" in *OPENMPI*) - cmd="mpirun --oversubscribe -app "$schema_file" &2 if [ -n "$optConfirm" ] then # Pause before running - $ECHO "Press return to execute.\c" + echo -e "Press return to execute, or ^C to abort...\c" read input -else - echo "starting: $(date '+%Y-%m-%d %H:%M:%S %z' 2>/dev/null)" 1>&2 echo 1>&2 fi +echo "starting: $(date '+%Y-%m-%d %H:%M:%S %z' 2>/dev/null)" 1>&2 +echo 1>&2 +exec