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
This commit is contained in:
Mark Olesen
2025-08-19 10:12:04 +02:00
parent 828693bc90
commit 8357b7e28b
2 changed files with 14 additions and 20 deletions

View File

@ -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" </dev/null"
cmd="mpirun --oversubscribe -app "$schema_file""
;;
MPICH)
cmd="mpiexec"
@ -511,13 +501,14 @@ echo 1>&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 </dev/null
exec $cmd
#------------------------------------------------------------------------------

View File

@ -6,7 +6,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2015-2023 OpenCFD Ltd.
# Copyright (C) 2015-2025 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -32,10 +32,13 @@ cleanTimeDirectories()
}
# Various files (logs, paraview, etc)
# Various files (logs, paraview, some mpirunDebug, etc)
# Note: leave mpirun.log/ files untouched, since they may still be useful
# for later diagnosis
cleanAuxiliary()
{
rm -rf \
./mpirun.files \
./log ./log.* ./log-* ./logSummary.* \
./.fxLock ./*.xml ./ParaView* ./paraFoam* \
./*.blockMesh ./*.foam ./*.OpenFOAM \