mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: added -decomposeParDict as argument to getNumberOfProcessors()
This commit is contained in:
22
bin/tools/RunFunctions
Normal file → Executable file
22
bin/tools/RunFunctions
Normal file → Executable 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-2016 OpenFOAM Foundation
|
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
# \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
# \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# License
|
# License
|
||||||
# This file is part of OpenFOAM.
|
# This file is part of OpenFOAM.
|
||||||
@ -41,8 +41,10 @@ isTest()
|
|||||||
|
|
||||||
getNumberOfProcessors()
|
getNumberOfProcessors()
|
||||||
{
|
{
|
||||||
expandDictionary system/decomposeParDict \
|
if [ -f $1 ]
|
||||||
| sed -ne 's/^numberOfSubdomains\s*\(.*\);/\1/p'
|
then
|
||||||
|
expandDictionary $1 | sed -ne 's/^numberOfSubdomains\s*\(.*\);/\1/p'
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
getApplication()
|
getApplication()
|
||||||
@ -100,10 +102,13 @@ runParallel()
|
|||||||
{
|
{
|
||||||
LOG_NAME=
|
LOG_NAME=
|
||||||
APP_RUN=
|
APP_RUN=
|
||||||
|
# Store any parsed additional arguments e.g. decomposeParDict
|
||||||
|
APP_PARARGS=
|
||||||
LOG_IGNORE=false
|
LOG_IGNORE=false
|
||||||
LOG_APPEND=false
|
LOG_APPEND=false
|
||||||
LOG_SUFFIX=
|
LOG_SUFFIX=
|
||||||
nProcs=$(getNumberOfProcessors)
|
# Check the default decomposeParDict if available
|
||||||
|
nProcs=$(getNumberOfProcessors "system/decomposeParDict")
|
||||||
|
|
||||||
# Parse options and executable
|
# Parse options and executable
|
||||||
while [ $# -gt 0 ] && [ -z "$APP_RUN" ] ; do
|
while [ $# -gt 0 ] && [ -z "$APP_RUN" ] ; do
|
||||||
@ -124,6 +129,11 @@ runParallel()
|
|||||||
nProcs="$2"
|
nProcs="$2"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
-decomposeParDict)
|
||||||
|
nProcs=$(getNumberOfProcessors "$2")
|
||||||
|
APP_PARARGS="$APP_PARARGS -decomposeParDict $2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
APP_RUN="$key"
|
APP_RUN="$key"
|
||||||
APP_NAME="${key##*/}"
|
APP_NAME="${key##*/}"
|
||||||
@ -141,9 +151,9 @@ runParallel()
|
|||||||
else
|
else
|
||||||
echo "Running $APP_RUN in parallel on $PWD using $nProcs processes"
|
echo "Running $APP_RUN in parallel on $PWD using $nProcs processes"
|
||||||
if [ "$LOG_APPEND" = "true" ]; then
|
if [ "$LOG_APPEND" = "true" ]; then
|
||||||
( mpirun -np $nProcs $APP_RUN -parallel "$@" < /dev/null >> log.$LOG_SUFFIX 2>&1 )
|
( mpirun -np $nProcs $APP_RUN $APP_PARARGS -parallel "$@" < /dev/null >> log.$LOG_SUFFIX 2>&1 )
|
||||||
else
|
else
|
||||||
( mpirun -np $nProcs $APP_RUN -parallel "$@" < /dev/null > log.$LOG_SUFFIX 2>&1 )
|
( mpirun -np $nProcs $APP_RUN $APP_PARARGS -parallel "$@" < /dev/null > log.$LOG_SUFFIX 2>&1 )
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user