Scripts in bin: improved -help message for mpirunDebug

This commit is contained in:
Chris Greenshields
2017-05-29 23:06:29 +01:00
parent 87eeba42c4
commit 4eaafb3e11

View File

@ -3,7 +3,7 @@
# ========= | # ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License
@ -44,10 +44,16 @@ usage()
cat<<USAGE cat<<USAGE
Usage: ${0##*/} -np <dd> <executable> <args> Usage: ${0##*/} -np <dd> <executable> <args>
options:
-help | -h print the usage
* This will run like mpirun but with each process in an XTerm This application runs like mpirun but with each process in an XTerm
USAGE USAGE
}
error() {
usage
exit 1 exit 1
} }
@ -57,6 +63,9 @@ while [ "$1" != "" ]
do do
echo "$1" echo "$1"
case $1 in case $1 in
-help | -h)
usage && exit 0
;;
-np) -np)
nProcs=$2 nProcs=$2
shift shift
@ -80,15 +89,15 @@ echo "nProcs=$nProcs"
echo "exec=$exec" echo "exec=$exec"
echo "args=$args" echo "args=$args"
[ "$nProcs" ] || usage [ "$nProcs" ] || error
[ "$args" ] || usage [ "$args" ] || error
[ "$exec" ] || usage [ "$exec" ] || error
exec=`which $exec` exec=`which $exec`
if [ ! -x "$exec" ] if [ ! -x "$exec" ]
then then
echo "Cannot find executable $exec or is not executable" echo "Cannot find executable $exec or is not executable"
usage error
fi fi
if [ ! "$PWD" ] if [ ! "$PWD" ]
@ -107,7 +116,7 @@ case "$method" in
# okay # okay
;; ;;
*) *)
usage error
;; ;;
esac esac
@ -115,7 +124,7 @@ $ECHO "Run all processes local or distributed? 1)local 2)remote: \c"
read spawn read spawn
if [ "$spawn" -ne 1 -a "$spawn" -ne 2 ] if [ "$spawn" -ne 1 -a "$spawn" -ne 2 ]
then then
usage error
fi fi
@ -250,8 +259,7 @@ MPICH)
*) *)
echo echo
echo "Unsupported WM_MPLIB setting : $WM_MPLIB" echo "Unsupported WM_MPLIB setting : $WM_MPLIB"
usage error
exit 1
esac esac
echo "Constructed $PWD/mpirun.schema file." echo "Constructed $PWD/mpirun.schema file."