View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000256 | OpenFOAM | Bug | public | 2011-07-18 17:24 | 2014-12-14 21:47 |
Reporter | Assigned To | henry | |||
Priority | normal | Severity | feature | Reproducibility | N/A |
Status | resolved | Resolution | fixed | ||
Summary | 0000256: wmake and Allwmake scripts should abort on *first* error | ||||
Description | When people try to compile OpenFOAM and something goes wrong, they usually only notice after a very long time, and then report the wrong error message (e.g. see #248). Often they think something is wrong with OpenFOAM, because the error says that the "OpenFOAM" library can't be found, or similar. It would be good if the wmake and all the Allwmake scripts used 'set -e', causing the build to abort on first error. Alternatively, one might make this conditional via a WM_CONTINUE_ON_ERROR variable. | ||||
Additional Information | Inserting a line like [ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e in all the Allwmake scripts, and substituting the following line in wmake/wmake $make -k -f $WM_DIR/MakefileApps FOAM_APPS="$FOAM_APPS" with $make ${WM_CONTINUE_ON_ERROR:+-k} -f $WM_DIR/MakefileApps FOAM_APPS="$FOAM_APPS" should do the trick. Attached patch does so. | ||||
Tags | No tags attached. | ||||
2011-07-18 17:24
|
0001-ENH-Abort-All-wmake-on-first-error.patch (24,110 bytes)
From daf666d717b9cb741690ed2ee867dbe32ce0a303 Mon Sep 17 00:00:00 2001 From: Michael Wild <themiwi@users.sourceforge.net> Date: Mon, 18 Jul 2011 17:34:39 +0200 Subject: [PATCH] ENH: Abort {All,}wmake on first error Signed-off-by: Michael Wild <themiwi@users.sourceforge.net> --- Allwmake | 1 + applications/Allwmake | 1 + .../solvers/compressible/rhoCentralFoam/Allwmake | 1 + .../solvers/compressible/rhoPimpleFoam/Allwmake | 1 + .../solvers/compressible/rhoSimpleFoam/Allwmake | 1 + .../solvers/compressible/sonicFoam/Allwmake | 1 + .../heatTransfer/chtMultiRegionFoam/Allwmake | 1 + .../solvers/incompressible/pimpleFoam/Allwmake | 1 + .../solvers/incompressible/simpleFoam/Allwmake | 1 + .../multiphase/compressibleInterFoam/Allwmake | 1 + applications/solvers/multiphase/interFoam/Allwmake | 1 + .../multiphase/multiphaseInterFoam/Allwmake | 1 + .../solvers/multiphase/twoPhaseEulerFoam/Allwmake | 1 + .../utilities/mesh/conversion/Optional/Allwmake | 1 + .../utilities/mesh/generation/extrude/Allwmake | 1 + .../utilities/mesh/manipulation/setSet/Allwmake | 1 + .../dataConversion/foamToTecplot360/Allwmake | 1 + .../postProcessing/graphics/PV3Readers/Allwmake | 1 + .../graphics/PV3Readers/PV3FoamReader/Allwmake | 1 + .../PV3Readers/PV3blockMeshReader/Allwmake | 1 + .../graphics/ensightFoamReader/Allwmake | 1 + .../graphics/fieldview9Reader/Allwmake | 1 + .../preProcessing/wallFunctionTable/Allwmake | 1 + doc/Allwmake | 1 + doc/Doxygen/Allwmake | 1 + etc/config/unset.csh | 1 + etc/config/unset.sh | 1 + src/Allwmake | 1 + src/OSspecific/POSIX/Allwmake | 1 + src/Pstream/Allwmake | 1 + src/conversion/Allwmake | 1 + src/dummyThirdParty/Allwmake | 1 + src/fvAgglomerationMethods/Allwmake | 1 + src/lagrangian/Allwmake | 1 + src/lagrangian/molecularDynamics/Allwmake | 1 + src/mesh/Allwmake | 1 + src/parallel/Allwmake | 1 + src/parallel/decompose/Allwmake | 1 + src/parallel/reconstruct/Allwmake | 1 + src/postProcessing/Allwmake | 1 + src/postProcessing/functionObjects/Allwmake | 1 + src/regionModels/Allwmake | 1 + src/thermophysicalModels/Allwmake | 1 + src/thermophysicalModels/properties/Allwmake | 1 + src/transportModels/Allwmake | 1 + src/turbulenceModels/Allwmake | 1 + src/turbulenceModels/LES/Allwmake | 1 + src/turbulenceModels/compressible/Allwmake | 1 + src/turbulenceModels/incompressible/Allwmake | 1 + wmake/wmake | 2 +- 50 files changed, 50 insertions(+), 1 deletions(-) diff --git a/Allwmake b/Allwmake index 16edfd1..08a7654 100755 --- a/Allwmake +++ b/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e wmakeCheckPwd "$WM_PROJECT_DIR" || { echo "Error: Current directory is not \$WM_PROJECT_DIR" diff --git a/applications/Allwmake b/applications/Allwmake index 00bc326..600af6c 100755 --- a/applications/Allwmake +++ b/applications/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e wmakeCheckPwd "$WM_PROJECT_DIR/applications" || { echo "Error: Current directory is not \$WM_PROJECT_DIR/applications" diff --git a/applications/solvers/compressible/rhoCentralFoam/Allwmake b/applications/solvers/compressible/rhoCentralFoam/Allwmake index 671c640..6bdc6d4 100755 --- a/applications/solvers/compressible/rhoCentralFoam/Allwmake +++ b/applications/solvers/compressible/rhoCentralFoam/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmake libso BCs diff --git a/applications/solvers/compressible/rhoPimpleFoam/Allwmake b/applications/solvers/compressible/rhoPimpleFoam/Allwmake index 241e22e..d504f90 100755 --- a/applications/solvers/compressible/rhoPimpleFoam/Allwmake +++ b/applications/solvers/compressible/rhoPimpleFoam/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmake diff --git a/applications/solvers/compressible/rhoSimpleFoam/Allwmake b/applications/solvers/compressible/rhoSimpleFoam/Allwmake index 33916c7..3c5925e 100755 --- a/applications/solvers/compressible/rhoSimpleFoam/Allwmake +++ b/applications/solvers/compressible/rhoSimpleFoam/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmake diff --git a/applications/solvers/compressible/sonicFoam/Allwmake b/applications/solvers/compressible/sonicFoam/Allwmake index 27c1194..957a32d 100755 --- a/applications/solvers/compressible/sonicFoam/Allwmake +++ b/applications/solvers/compressible/sonicFoam/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmake diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/Allwmake b/applications/solvers/heatTransfer/chtMultiRegionFoam/Allwmake index be40e0c..79383da 100755 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/Allwmake +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmake libso coupledDerivedFvPatchFields diff --git a/applications/solvers/incompressible/pimpleFoam/Allwmake b/applications/solvers/incompressible/pimpleFoam/Allwmake index 71517c7..5dbea42 100755 --- a/applications/solvers/incompressible/pimpleFoam/Allwmake +++ b/applications/solvers/incompressible/pimpleFoam/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmake diff --git a/applications/solvers/incompressible/simpleFoam/Allwmake b/applications/solvers/incompressible/simpleFoam/Allwmake index 79109c8..a417448 100755 --- a/applications/solvers/incompressible/simpleFoam/Allwmake +++ b/applications/solvers/incompressible/simpleFoam/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmake diff --git a/applications/solvers/multiphase/compressibleInterFoam/Allwmake b/applications/solvers/multiphase/compressibleInterFoam/Allwmake index 644094d..1b9de12 100755 --- a/applications/solvers/multiphase/compressibleInterFoam/Allwmake +++ b/applications/solvers/multiphase/compressibleInterFoam/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmake diff --git a/applications/solvers/multiphase/interFoam/Allwmake b/applications/solvers/multiphase/interFoam/Allwmake index 8044426..ef4e495 100755 --- a/applications/solvers/multiphase/interFoam/Allwmake +++ b/applications/solvers/multiphase/interFoam/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmake diff --git a/applications/solvers/multiphase/multiphaseInterFoam/Allwmake b/applications/solvers/multiphase/multiphaseInterFoam/Allwmake index 6e47f91..260d95d 100755 --- a/applications/solvers/multiphase/multiphaseInterFoam/Allwmake +++ b/applications/solvers/multiphase/multiphaseInterFoam/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmake libso multiphaseMixture diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/Allwmake b/applications/solvers/multiphase/twoPhaseEulerFoam/Allwmake index 29294d1..ad016d5 100755 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/Allwmake +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmake libso phaseModel diff --git a/applications/utilities/mesh/conversion/Optional/Allwmake b/applications/utilities/mesh/conversion/Optional/Allwmake index 2580037..33fb4bb 100755 --- a/applications/utilities/mesh/conversion/Optional/Allwmake +++ b/applications/utilities/mesh/conversion/Optional/Allwmake @@ -3,6 +3,7 @@ # Build optional components (eg, may depend on third-party libraries) # ----------------------------------------------------------------------------- cd ${0%/*} || exit 1 # run from this directory +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x # build libccmio and create lnInclude directory diff --git a/applications/utilities/mesh/generation/extrude/Allwmake b/applications/utilities/mesh/generation/extrude/Allwmake index 091ec04..6b46fcf 100755 --- a/applications/utilities/mesh/generation/extrude/Allwmake +++ b/applications/utilities/mesh/generation/extrude/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmake libso extrudeModel diff --git a/applications/utilities/mesh/manipulation/setSet/Allwmake b/applications/utilities/mesh/manipulation/setSet/Allwmake index 3be0afc..79df68b 100755 --- a/applications/utilities/mesh/manipulation/setSet/Allwmake +++ b/applications/utilities/mesh/manipulation/setSet/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e unset COMP_FLAGS LINK_FLAGS diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/Allwmake b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/Allwmake index 99e4ccb..a82f439 100755 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/Allwmake +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e if [ ! -d ${WM_THIRD_PARTY_DIR}/tecio ] then diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/Allwmake b/applications/utilities/postProcessing/graphics/PV3Readers/Allwmake index 6851210..7d59d09 100755 --- a/applications/utilities/postProcessing/graphics/PV3Readers/Allwmake +++ b/applications/utilities/postProcessing/graphics/PV3Readers/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ] diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/Allwmake b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/Allwmake index c99e05f..85e5c9c 100755 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/Allwmake +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ] diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/Allwmake b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/Allwmake index 4f055b3..70a7764 100755 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/Allwmake +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ] diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/Allwmake b/applications/utilities/postProcessing/graphics/ensightFoamReader/Allwmake index f29cdda..279e17b 100755 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/Allwmake +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e wmake libso diff --git a/applications/utilities/postProcessing/graphics/fieldview9Reader/Allwmake b/applications/utilities/postProcessing/graphics/fieldview9Reader/Allwmake index e482554..c40595d 100755 --- a/applications/utilities/postProcessing/graphics/fieldview9Reader/Allwmake +++ b/applications/utilities/postProcessing/graphics/fieldview9Reader/Allwmake @@ -2,6 +2,7 @@ # disabled +# [ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e # if [ "$FV_HOME" -a -r $FV_HOME ] # then # wmake fieldview9Reader diff --git a/applications/utilities/preProcessing/wallFunctionTable/Allwmake b/applications/utilities/preProcessing/wallFunctionTable/Allwmake index 55a6cbd..abf1d4d 100755 --- a/applications/utilities/preProcessing/wallFunctionTable/Allwmake +++ b/applications/utilities/preProcessing/wallFunctionTable/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmake libso tabulatedWallFunction diff --git a/doc/Allwmake b/doc/Allwmake index 5d8ed9c..9de40f5 100755 --- a/doc/Allwmake +++ b/doc/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x # fix permissions (NB: '+X' and not '+x'!) diff --git a/doc/Doxygen/Allwmake b/doc/Doxygen/Allwmake index fbc20d9..41d3d54 100755 --- a/doc/Doxygen/Allwmake +++ b/doc/Doxygen/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e [ -d "$WM_PROJECT_DIR" ] || { echo "Error: WM_PROJECT_DIR directory does not exist" diff --git a/etc/config/unset.csh b/etc/config/unset.csh index d9a3d69..43526e5 100644 --- a/etc/config/unset.csh +++ b/etc/config/unset.csh @@ -85,6 +85,7 @@ unsetenv WM_PROJECT_USER_DIR unsetenv WM_PROJECT_VERSION unsetenv WM_SCHEDULER unsetenv WM_THIRD_PARTY_DIR +unsetenv WM_CONTINUE_ON_ERROR #------------------------------------------------------------------------------ diff --git a/etc/config/unset.sh b/etc/config/unset.sh index 66ee2e3..add32e6 100644 --- a/etc/config/unset.sh +++ b/etc/config/unset.sh @@ -72,6 +72,7 @@ unset WM_PROJECT_USER_DIR unset WM_PROJECT_VERSION unset WM_SCHEDULER unset WM_THIRD_PARTY_DIR +unset WM_CONTINUE_ON_ERROR #------------------------------------------------------------------------------ diff --git a/src/Allwmake b/src/Allwmake index aa17b41..52d7182 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -1,6 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory makeType=${1:-libso} +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e wmakeCheckPwd "$WM_PROJECT_DIR/src" || { echo "Error: Current directory is not \$WM_PROJECT_DIR/src" diff --git a/src/OSspecific/POSIX/Allwmake b/src/OSspecific/POSIX/Allwmake index c68f089..9474b99 100755 --- a/src/OSspecific/POSIX/Allwmake +++ b/src/OSspecific/POSIX/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e unset COMP_FLAGS LINK_FLAGS diff --git a/src/Pstream/Allwmake b/src/Pstream/Allwmake index 50ccb5f..1d26981 100755 --- a/src/Pstream/Allwmake +++ b/src/Pstream/Allwmake @@ -1,6 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory makeType=${1:-libso} +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e # diff --git a/src/conversion/Allwmake b/src/conversion/Allwmake index 014885d..6b87795 100755 --- a/src/conversion/Allwmake +++ b/src/conversion/Allwmake @@ -1,6 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory makeType=${1:-libso} +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmake $makeType diff --git a/src/dummyThirdParty/Allwmake b/src/dummyThirdParty/Allwmake index d747a47..4c0472b 100755 --- a/src/dummyThirdParty/Allwmake +++ b/src/dummyThirdParty/Allwmake @@ -1,6 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory makeType=${1:-libso} +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmake $makeType scotchDecomp diff --git a/src/fvAgglomerationMethods/Allwmake b/src/fvAgglomerationMethods/Allwmake index aa03907..9c322a0 100755 --- a/src/fvAgglomerationMethods/Allwmake +++ b/src/fvAgglomerationMethods/Allwmake @@ -1,6 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory makeType=${1:-libso} +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x export ParMGridGen=$WM_THIRD_PARTY_DIR/ParMGridGen-1.0 diff --git a/src/lagrangian/Allwmake b/src/lagrangian/Allwmake index bedfd29..0854392 100755 --- a/src/lagrangian/Allwmake +++ b/src/lagrangian/Allwmake @@ -1,6 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory makeType=${1:-libso} +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmake $makeType distributionModels diff --git a/src/lagrangian/molecularDynamics/Allwmake b/src/lagrangian/molecularDynamics/Allwmake index 7c17819..479a9f5 100755 --- a/src/lagrangian/molecularDynamics/Allwmake +++ b/src/lagrangian/molecularDynamics/Allwmake @@ -1,6 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory makeType=${1:-libso} +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmake $makeType potential diff --git a/src/mesh/Allwmake b/src/mesh/Allwmake index 7120940..b1707a2 100755 --- a/src/mesh/Allwmake +++ b/src/mesh/Allwmake @@ -1,6 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory makeType=${1:-libso} +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmake $makeType autoMesh diff --git a/src/parallel/Allwmake b/src/parallel/Allwmake index ab84e5b..db736bd 100755 --- a/src/parallel/Allwmake +++ b/src/parallel/Allwmake @@ -1,6 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory makeType=${1:-libso} +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x decompose/Allwmake $* diff --git a/src/parallel/decompose/Allwmake b/src/parallel/decompose/Allwmake index b620b27..d027391 100755 --- a/src/parallel/decompose/Allwmake +++ b/src/parallel/decompose/Allwmake @@ -1,6 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory makeType=${1:-libso} +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e # get SCOTCH_VERSION, SCOTCH_ARCH_PATH if settings=`$WM_PROJECT_DIR/bin/foamEtcFile config/scotch.sh` diff --git a/src/parallel/reconstruct/Allwmake b/src/parallel/reconstruct/Allwmake index 85e8e97..837aaa0 100755 --- a/src/parallel/reconstruct/Allwmake +++ b/src/parallel/reconstruct/Allwmake @@ -1,6 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory makeType=${1:-libso} +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmake $makeType reconstruct diff --git a/src/postProcessing/Allwmake b/src/postProcessing/Allwmake index 24b764c..bcb8e1d 100755 --- a/src/postProcessing/Allwmake +++ b/src/postProcessing/Allwmake @@ -1,6 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory makeType=${1:-libso} +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmake libo postCalc diff --git a/src/postProcessing/functionObjects/Allwmake b/src/postProcessing/functionObjects/Allwmake index e62cdf8..3224d6d 100755 --- a/src/postProcessing/functionObjects/Allwmake +++ b/src/postProcessing/functionObjects/Allwmake @@ -1,6 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory makeType=${1:-libso} +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmake $makeType field diff --git a/src/regionModels/Allwmake b/src/regionModels/Allwmake index 5c97cae..827e76e 100755 --- a/src/regionModels/Allwmake +++ b/src/regionModels/Allwmake @@ -1,6 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory makeType=${1:-libso} +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmake $makeType regionModel diff --git a/src/thermophysicalModels/Allwmake b/src/thermophysicalModels/Allwmake index 7927a97..7fdd4a1 100755 --- a/src/thermophysicalModels/Allwmake +++ b/src/thermophysicalModels/Allwmake @@ -1,6 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory makeType=${1:-libso} +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmake $makeType specie diff --git a/src/thermophysicalModels/properties/Allwmake b/src/thermophysicalModels/properties/Allwmake index f088d14..81b52f3 100755 --- a/src/thermophysicalModels/properties/Allwmake +++ b/src/thermophysicalModels/properties/Allwmake @@ -1,6 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory makeType=${1:-libso} +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmake $makeType liquidProperties diff --git a/src/transportModels/Allwmake b/src/transportModels/Allwmake index 21078c0..07cc886 100755 --- a/src/transportModels/Allwmake +++ b/src/transportModels/Allwmake @@ -1,6 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory makeType=${1:-libso} +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmake $makeType incompressible diff --git a/src/turbulenceModels/Allwmake b/src/turbulenceModels/Allwmake index e78f0c3..95fb990 100755 --- a/src/turbulenceModels/Allwmake +++ b/src/turbulenceModels/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x LES/Allwmake $* diff --git a/src/turbulenceModels/LES/Allwmake b/src/turbulenceModels/LES/Allwmake index 6ee54e6..c87a64f 100755 --- a/src/turbulenceModels/LES/Allwmake +++ b/src/turbulenceModels/LES/Allwmake @@ -1,6 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory makeType=${1:-libso} +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmakeLnInclude ../incompressible/LES diff --git a/src/turbulenceModels/compressible/Allwmake b/src/turbulenceModels/compressible/Allwmake index 6e230c0..cfb2bb8 100755 --- a/src/turbulenceModels/compressible/Allwmake +++ b/src/turbulenceModels/compressible/Allwmake @@ -1,6 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory makeType=${1:-libso} +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmake $makeType turbulenceModel diff --git a/src/turbulenceModels/incompressible/Allwmake b/src/turbulenceModels/incompressible/Allwmake index 6e230c0..cfb2bb8 100755 --- a/src/turbulenceModels/incompressible/Allwmake +++ b/src/turbulenceModels/incompressible/Allwmake @@ -1,6 +1,7 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory makeType=${1:-libso} +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e set -x wmake $makeType turbulenceModel diff --git a/wmake/wmake b/wmake/wmake index abb6aa8..b68a8cb 100755 --- a/wmake/wmake +++ b/wmake/wmake @@ -182,7 +182,7 @@ then # FOAM_APPS=$(find . -maxdepth 1 \( -type d -a ! -name "." -a ! -name Optional -a ! -name Make \) -printf "%f ") # avoid 'find' with '-printf' ... not entirely portable FOAM_APPS=$(for d in *; do [ -d "$d" -a "$d" != Optional -a "$d" != Make ] && echo "$d"; done | xargs) - $make -k -f $WM_DIR/MakefileApps FOAM_APPS="$FOAM_APPS" + $make ${WM_CONTINUE_ON_ERROR:+-k} -f $WM_DIR/MakefileApps FOAM_APPS="$FOAM_APPS" exit $? fi fi -- 1.7.4.1 |
|
I agree with your preference that the Allwmake scripts should abort on first error and indeed this is the way they used to be but we changed them to continue regardless by popular demand from users. Perhaps it would be better if this behavior were switchable but I am not convinced that using an environment variable is the best way to achieve this; wouldn't it be better to use a command-line option like -k, --keep-going as provided by make? |
|
Sure. As I've said in #211, comment 421, I'd like the Allwmake scripts to accept some flags, such as -k and -j. I just proposed the environment variable because I thought it would fit the current way things work, thinking of WM_NCOMPPROCS. |
|
Yes using another environment variable would be easier to implement but I think it is time we stopped cluttering-up the environment and added option handling to wmake/Allwmake for controls which need to be overridden occasionally. This will take a little longer to do though. |
|
My sentiment too. OpenFOAM uses way too many environment variables already. IMHO it would be better to have only one environment variable, e.g. WM_PROJECT_DIR, and then in $WM_PROJECT_DIR/bin/foamShellSetup a script which works similar to git-sh-setup. Hmm, another problem: Seems like # and ~ tags don't work in bug notes. |
|
patch_allwmake_with_options (34,292 bytes)
diff --git a/Allwmake b/Allwmake index 16edfd1..a5ef923 100755 --- a/Allwmake +++ b/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +allwmakeOptions='-allow-doc doDoxygen' && . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments wmakeCheckPwd "$WM_PROJECT_DIR" || { echo "Error: Current directory is not \$WM_PROJECT_DIR" @@ -29,7 +30,7 @@ fi src/Allwmake applications/Allwmake -if [ "$1" = doc ] +if [ $doDoxygen -gt 0 ] then doc/Allwmake fi diff --git a/applications/Allwmake b/applications/Allwmake index 00bc326..e9212d8 100755 --- a/applications/Allwmake +++ b/applications/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments wmakeCheckPwd "$WM_PROJECT_DIR/applications" || { echo "Error: Current directory is not \$WM_PROJECT_DIR/applications" diff --git a/applications/solvers/compressible/rhoCentralFoam/Allwmake b/applications/solvers/compressible/rhoCentralFoam/Allwmake index 671c640..5ca08e8 100755 --- a/applications/solvers/compressible/rhoCentralFoam/Allwmake +++ b/applications/solvers/compressible/rhoCentralFoam/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmake libso BCs diff --git a/applications/solvers/compressible/rhoPimpleFoam/Allwmake b/applications/solvers/compressible/rhoPimpleFoam/Allwmake index 241e22e..9f213da 100755 --- a/applications/solvers/compressible/rhoPimpleFoam/Allwmake +++ b/applications/solvers/compressible/rhoPimpleFoam/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmake diff --git a/applications/solvers/compressible/rhoSimpleFoam/Allwmake b/applications/solvers/compressible/rhoSimpleFoam/Allwmake index 33916c7..57a276d 100755 --- a/applications/solvers/compressible/rhoSimpleFoam/Allwmake +++ b/applications/solvers/compressible/rhoSimpleFoam/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmake diff --git a/applications/solvers/compressible/sonicFoam/Allwmake b/applications/solvers/compressible/sonicFoam/Allwmake index 27c1194..8ea5e5e 100755 --- a/applications/solvers/compressible/sonicFoam/Allwmake +++ b/applications/solvers/compressible/sonicFoam/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmake diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/Allwmake b/applications/solvers/heatTransfer/chtMultiRegionFoam/Allwmake index be40e0c..432ec68 100755 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/Allwmake +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmake libso coupledDerivedFvPatchFields diff --git a/applications/solvers/incompressible/pimpleFoam/Allwmake b/applications/solvers/incompressible/pimpleFoam/Allwmake index 8727bdb..2c31a48 100755 --- a/applications/solvers/incompressible/pimpleFoam/Allwmake +++ b/applications/solvers/incompressible/pimpleFoam/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmake diff --git a/applications/solvers/incompressible/simpleFoam/Allwmake b/applications/solvers/incompressible/simpleFoam/Allwmake index 79109c8..b6ec6fc 100755 --- a/applications/solvers/incompressible/simpleFoam/Allwmake +++ b/applications/solvers/incompressible/simpleFoam/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmake diff --git a/applications/solvers/multiphase/compressibleInterFoam/Allwmake b/applications/solvers/multiphase/compressibleInterFoam/Allwmake index 644094d..bc45dba 100755 --- a/applications/solvers/multiphase/compressibleInterFoam/Allwmake +++ b/applications/solvers/multiphase/compressibleInterFoam/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmake diff --git a/applications/solvers/multiphase/interFoam/Allwmake b/applications/solvers/multiphase/interFoam/Allwmake index 8044426..fd2d880 100755 --- a/applications/solvers/multiphase/interFoam/Allwmake +++ b/applications/solvers/multiphase/interFoam/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmake diff --git a/applications/solvers/multiphase/multiphaseInterFoam/Allwmake b/applications/solvers/multiphase/multiphaseInterFoam/Allwmake index 6e47f91..4879568 100755 --- a/applications/solvers/multiphase/multiphaseInterFoam/Allwmake +++ b/applications/solvers/multiphase/multiphaseInterFoam/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmake libso multiphaseMixture diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/Allwmake b/applications/solvers/multiphase/twoPhaseEulerFoam/Allwmake index 29294d1..b6cb96c 100755 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/Allwmake +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmake libso phaseModel diff --git a/applications/utilities/mesh/conversion/Optional/Allwmake b/applications/utilities/mesh/conversion/Optional/Allwmake index 2580037..d43fdf1 100755 --- a/applications/utilities/mesh/conversion/Optional/Allwmake +++ b/applications/utilities/mesh/conversion/Optional/Allwmake @@ -3,6 +3,7 @@ # Build optional components (eg, may depend on third-party libraries) # ----------------------------------------------------------------------------- cd ${0%/*} || exit 1 # run from this directory +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x # build libccmio and create lnInclude directory diff --git a/applications/utilities/mesh/generation/extrude/Allwmake b/applications/utilities/mesh/generation/extrude/Allwmake index 091ec04..679858f 100755 --- a/applications/utilities/mesh/generation/extrude/Allwmake +++ b/applications/utilities/mesh/generation/extrude/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmake libso extrudeModel diff --git a/applications/utilities/mesh/manipulation/setSet/Allwmake b/applications/utilities/mesh/manipulation/setSet/Allwmake index 3be0afc..f368535 100755 --- a/applications/utilities/mesh/manipulation/setSet/Allwmake +++ b/applications/utilities/mesh/manipulation/setSet/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +allwmakeOptions='-allow-readline readingMode' && . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments unset COMP_FLAGS LINK_FLAGS @@ -10,7 +11,7 @@ unset COMP_FLAGS LINK_FLAGS # eg, ./Allwmake NO_READLINE # -if [ -f /usr/include/readline/readline.h -a "${1%NO_READLINE}" = "$1" ] +if [ -f /usr/include/readline/readline.h -a "${readingMode%NO_READLINE}" = "$readingMode" ] then echo "Found <readline/readline.h> -- enabling readline support." export COMP_FLAGS="-DHAS_READLINE" diff --git a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/Allwmake b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/Allwmake index 99e4ccb..a6161d3 100755 --- a/applications/utilities/postProcessing/dataConversion/foamToTecplot360/Allwmake +++ b/applications/utilities/postProcessing/dataConversion/foamToTecplot360/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments if [ ! -d ${WM_THIRD_PARTY_DIR}/tecio ] then diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/Allwmake b/applications/utilities/postProcessing/graphics/PV3Readers/Allwmake index 6851210..49748dd 100755 --- a/applications/utilities/postProcessing/graphics/PV3Readers/Allwmake +++ b/applications/utilities/postProcessing/graphics/PV3Readers/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ] diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/Allwmake b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/Allwmake index c99e05f..fa0178c 100755 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/Allwmake +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ] diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/Allwmake b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/Allwmake index 4f055b3..e450716 100755 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/Allwmake +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3blockMeshReader/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x if [ -d "$ParaView_DIR" -a -r "$ParaView_DIR" ] diff --git a/applications/utilities/postProcessing/graphics/ensightFoamReader/Allwmake b/applications/utilities/postProcessing/graphics/ensightFoamReader/Allwmake index f29cdda..9cad647 100755 --- a/applications/utilities/postProcessing/graphics/ensightFoamReader/Allwmake +++ b/applications/utilities/postProcessing/graphics/ensightFoamReader/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments wmake libso diff --git a/applications/utilities/postProcessing/graphics/fieldview9Reader/Allwmake b/applications/utilities/postProcessing/graphics/fieldview9Reader/Allwmake index e482554..f5e05df 100755 --- a/applications/utilities/postProcessing/graphics/fieldview9Reader/Allwmake +++ b/applications/utilities/postProcessing/graphics/fieldview9Reader/Allwmake @@ -2,6 +2,7 @@ # disabled +# . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments # if [ "$FV_HOME" -a -r $FV_HOME ] # then # wmake fieldview9Reader diff --git a/applications/utilities/preProcessing/wallFunctionTable/Allwmake b/applications/utilities/preProcessing/wallFunctionTable/Allwmake index 55a6cbd..b0cdd1e 100755 --- a/applications/utilities/preProcessing/wallFunctionTable/Allwmake +++ b/applications/utilities/preProcessing/wallFunctionTable/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmake libso tabulatedWallFunction diff --git a/doc/Allwmake b/doc/Allwmake index 5d8ed9c..f7bf825 100755 --- a/doc/Allwmake +++ b/doc/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x # fix permissions (NB: '+X' and not '+x'!) diff --git a/doc/Doxygen/Allwmake b/doc/Doxygen/Allwmake index fbc20d9..10d0711 100755 --- a/doc/Doxygen/Allwmake +++ b/doc/Doxygen/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +. $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments [ -d "$WM_PROJECT_DIR" ] || { echo "Error: WM_PROJECT_DIR directory does not exist" diff --git a/etc/config/aliases.csh b/etc/config/aliases.csh index 6573c91..b6b6c57 100644 --- a/etc/config/aliases.csh +++ b/etc/config/aliases.csh @@ -47,6 +47,11 @@ alias wmUNSET='source $WM_PROJECT_DIR/etc/config/unset.csh' alias wmSchedON 'setenv WM_SCHEDULER $WM_PROJECT_DIR/wmake/wmakeScheduler' alias wmSchedOFF 'unsetenv WM_SCHEDULER' +# Toggle WM_CONTINUE_ON_ERROR on/off +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +alias wmNONSTOP 'setenv WM_CONTINUE_ON_ERROR 1' +alias wmSTOPON1st 'unsetenv WM_CONTINUE_ON_ERROR' + # Change ParaView version # ~~~~~~~~~~~~~~~~~~~~~~~ alias foamPV 'source `$WM_PROJECT_DIR/etc/config/paraview.csh` ParaView_VERSION=\!*; echo paraview-$ParaView_VERSION' diff --git a/etc/config/aliases.sh b/etc/config/aliases.sh index 1881597..e651e37 100644 --- a/etc/config/aliases.sh +++ b/etc/config/aliases.sh @@ -47,6 +47,11 @@ alias wmUNSET='. $WM_PROJECT_DIR/etc/config/unset.sh' alias wmSchedON='export WM_SCHEDULER=$WM_PROJECT_DIR/wmake/wmakeScheduler' alias wmSchedOFF='unset WM_SCHEDULER' +# Toggle WM_CONTINUE_ON_ERROR on/off +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +alias wmNONSTOP='export WM_CONTINUE_ON_ERROR=1' +alias wmSTOPON1st='unset WM_CONTINUE_ON_ERROR' + # Change ParaView version # ~~~~~~~~~~~~~~~~~~~~~~~ unset foamPV diff --git a/etc/config/unset.csh b/etc/config/unset.csh index d9a3d69..43526e5 100644 --- a/etc/config/unset.csh +++ b/etc/config/unset.csh @@ -85,6 +85,7 @@ unsetenv WM_PROJECT_USER_DIR unsetenv WM_PROJECT_VERSION unsetenv WM_SCHEDULER unsetenv WM_THIRD_PARTY_DIR +unsetenv WM_CONTINUE_ON_ERROR #------------------------------------------------------------------------------ diff --git a/etc/config/unset.sh b/etc/config/unset.sh index 66ee2e3..add32e6 100644 --- a/etc/config/unset.sh +++ b/etc/config/unset.sh @@ -72,6 +72,7 @@ unset WM_PROJECT_USER_DIR unset WM_PROJECT_VERSION unset WM_SCHEDULER unset WM_THIRD_PARTY_DIR +unset WM_CONTINUE_ON_ERROR #------------------------------------------------------------------------------ diff --git a/src/Allwmake b/src/Allwmake index aa17b41..8980d12 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -1,6 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -makeType=${1:-libso} +allwmakeOptions='-allow-lib makeType' && . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments wmakeCheckPwd "$WM_PROJECT_DIR/src" || { echo "Error: Current directory is not \$WM_PROJECT_DIR/src" @@ -22,7 +22,7 @@ wmakePrintBuild -check || /bin/rm -f OpenFOAM/Make/*/global.? 2>/dev/null wmakeLnInclude OpenFOAM wmakeLnInclude OSspecific/${WM_OSTYPE:-POSIX} -Pstream/Allwmake $* +Pstream/Allwmake $OriginalOptions OSspecific/${WM_OSTYPE:-POSIX}/Allwmake wmake $makeType OpenFOAM @@ -36,7 +36,7 @@ wmake $makeType surfMesh # Decomposition methods needed by dummyThirdParty parallel/decompose/AllwmakeLnInclude # dummyThirdParty (dummy metisDecomp, scotchDecomp etc) needed by e.g. meshTools -dummyThirdParty/Allwmake $* +dummyThirdParty/Allwmake $OriginalOptions wmake $makeType finiteVolume wmake $makeType lagrangian/basic @@ -44,7 +44,7 @@ wmake $makeType lagrangian/distributionModels wmake $makeType genericPatchFields # Build the proper scotchDecomp, metisDecomp etc. -parallel/Allwmake $* +parallel/Allwmake $OriginalOptions wmake $makeType conversion @@ -57,16 +57,16 @@ wmake $makeType topoChangerFvMesh wmake $makeType ODE wmake $makeType randomProcesses -thermophysicalModels/Allwmake $* -transportModels/Allwmake $* -turbulenceModels/Allwmake $* +thermophysicalModels/Allwmake $OriginalOptions +transportModels/Allwmake $OriginalOptions +turbulenceModels/Allwmake $OriginalOptions wmake $makeType combustionModels -regionModels/Allwmake $* -lagrangian/Allwmake $* -postProcessing/Allwmake $* -mesh/Allwmake $* +regionModels/Allwmake $OriginalOptions +lagrangian/Allwmake $OriginalOptions +postProcessing/Allwmake $OriginalOptions +mesh/Allwmake $OriginalOptions -fvAgglomerationMethods/Allwmake $* +fvAgglomerationMethods/Allwmake $OriginalOptions wmake $makeType fvMotionSolver wmake $makeType engine diff --git a/src/OSspecific/POSIX/Allwmake b/src/OSspecific/POSIX/Allwmake index c68f089..15bedf5 100755 --- a/src/OSspecific/POSIX/Allwmake +++ b/src/OSspecific/POSIX/Allwmake @@ -1,5 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory +allwmakeOptions='-allow-inotify notificationMode' && . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments unset COMP_FLAGS LINK_FLAGS @@ -9,7 +10,7 @@ unset COMP_FLAGS LINK_FLAGS # # eg, ./Allwmake USE_STAT # -if [ -f /usr/include/sys/inotify.h -a "${1%USE_STAT}" = "$1" ] +if [ -f /usr/include/sys/inotify.h -a "${notificationMode%USE_STAT}" = "$notificationMode" ] then echo "Found <sys/inotify.h> -- enabling inotify for file monitoring." export COMP_FLAGS="-DFOAM_USE_INOTIFY" diff --git a/src/Pstream/Allwmake b/src/Pstream/Allwmake index 50ccb5f..f321c23 100755 --- a/src/Pstream/Allwmake +++ b/src/Pstream/Allwmake @@ -1,7 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -makeType=${1:-libso} - +allwmakeOptions='-allow-lib makeType' && . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments # # define how to create an mpi-versioned library of $makeType diff --git a/src/conversion/Allwmake b/src/conversion/Allwmake index 014885d..db0e6f2 100755 --- a/src/conversion/Allwmake +++ b/src/conversion/Allwmake @@ -1,6 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -makeType=${1:-libso} +allwmakeOptions='-allow-lib makeType' && . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmake $makeType diff --git a/src/dummyThirdParty/Allwmake b/src/dummyThirdParty/Allwmake index d747a47..f9b9df3 100755 --- a/src/dummyThirdParty/Allwmake +++ b/src/dummyThirdParty/Allwmake @@ -1,6 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -makeType=${1:-libso} +allwmakeOptions='-allow-lib makeType' && . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmake $makeType scotchDecomp diff --git a/src/fvAgglomerationMethods/Allwmake b/src/fvAgglomerationMethods/Allwmake index aa03907..0d27bff 100755 --- a/src/fvAgglomerationMethods/Allwmake +++ b/src/fvAgglomerationMethods/Allwmake @@ -1,6 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -makeType=${1:-libso} +allwmakeOptions='-allow-lib makeType' && . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x export ParMGridGen=$WM_THIRD_PARTY_DIR/ParMGridGen-1.0 diff --git a/src/lagrangian/Allwmake b/src/lagrangian/Allwmake index bedfd29..7df0ad7 100755 --- a/src/lagrangian/Allwmake +++ b/src/lagrangian/Allwmake @@ -1,6 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -makeType=${1:-libso} +allwmakeOptions='-allow-lib makeType' && . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmake $makeType distributionModels @@ -12,6 +12,6 @@ wmake $makeType dieselSpray wmake $makeType dsmc wmake $makeType coalCombustion -molecularDynamics/Allwmake $* +molecularDynamics/Allwmake $OriginalOptions # ----------------------------------------------------------------- end-of-file diff --git a/src/lagrangian/molecularDynamics/Allwmake b/src/lagrangian/molecularDynamics/Allwmake index 7c17819..bd5dd8b 100755 --- a/src/lagrangian/molecularDynamics/Allwmake +++ b/src/lagrangian/molecularDynamics/Allwmake @@ -1,6 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -makeType=${1:-libso} +allwmakeOptions='-allow-lib makeType' && . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmake $makeType potential diff --git a/src/mesh/Allwmake b/src/mesh/Allwmake index 7120940..e4e9f92 100755 --- a/src/mesh/Allwmake +++ b/src/mesh/Allwmake @@ -1,6 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -makeType=${1:-libso} +allwmakeOptions='-allow-lib makeType' && . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmake $makeType autoMesh diff --git a/src/parallel/Allwmake b/src/parallel/Allwmake index ab84e5b..f088afd 100755 --- a/src/parallel/Allwmake +++ b/src/parallel/Allwmake @@ -1,10 +1,10 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -makeType=${1:-libso} +allwmakeOptions='-allow-lib makeType' && . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x -decompose/Allwmake $* -reconstruct/Allwmake $* +decompose/Allwmake $OriginalOptions +reconstruct/Allwmake $OriginalOptions wmake $makeType distributed diff --git a/src/parallel/decompose/Allwmake b/src/parallel/decompose/Allwmake index b620b27..63878b8 100755 --- a/src/parallel/decompose/Allwmake +++ b/src/parallel/decompose/Allwmake @@ -1,6 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -makeType=${1:-libso} +allwmakeOptions='-allow-lib makeType' && . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments # get SCOTCH_VERSION, SCOTCH_ARCH_PATH if settings=`$WM_PROJECT_DIR/bin/foamEtcFile config/scotch.sh` diff --git a/src/parallel/reconstruct/Allwmake b/src/parallel/reconstruct/Allwmake index 85e8e97..e99f649 100755 --- a/src/parallel/reconstruct/Allwmake +++ b/src/parallel/reconstruct/Allwmake @@ -1,6 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -makeType=${1:-libso} +allwmakeOptions='-allow-lib makeType' && . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmake $makeType reconstruct diff --git a/src/postProcessing/Allwmake b/src/postProcessing/Allwmake index 24b764c..c3accbe 100755 --- a/src/postProcessing/Allwmake +++ b/src/postProcessing/Allwmake @@ -1,11 +1,11 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -makeType=${1:-libso} +allwmakeOptions='-allow-lib makeType' && . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmake libo postCalc wmake $makeType foamCalcFunctions -functionObjects/Allwmake $* +functionObjects/Allwmake $OriginalOptions # ----------------------------------------------------------------- end-of-file diff --git a/src/postProcessing/functionObjects/Allwmake b/src/postProcessing/functionObjects/Allwmake index e62cdf8..496e336 100755 --- a/src/postProcessing/functionObjects/Allwmake +++ b/src/postProcessing/functionObjects/Allwmake @@ -1,6 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -makeType=${1:-libso} +allwmakeOptions='-allow-lib makeType' && . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmake $makeType field diff --git a/src/regionModels/Allwmake b/src/regionModels/Allwmake index 5c97cae..4394c59 100755 --- a/src/regionModels/Allwmake +++ b/src/regionModels/Allwmake @@ -1,6 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -makeType=${1:-libso} +allwmakeOptions='-allow-lib makeType' && . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmake $makeType regionModel diff --git a/src/thermophysicalModels/Allwmake b/src/thermophysicalModels/Allwmake index 7927a97..69f74f9 100755 --- a/src/thermophysicalModels/Allwmake +++ b/src/thermophysicalModels/Allwmake @@ -1,12 +1,12 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -makeType=${1:-libso} +allwmakeOptions='-allow-lib makeType' && . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmake $makeType specie wmake $makeType solid wmake $makeType thermophysicalFunctions -./properties/Allwmake $* +./properties/Allwmake $OriginalOptions wmake $makeType basic wmake $makeType reactionThermo diff --git a/src/thermophysicalModels/properties/Allwmake b/src/thermophysicalModels/properties/Allwmake index f088d14..cf63d2b 100755 --- a/src/thermophysicalModels/properties/Allwmake +++ b/src/thermophysicalModels/properties/Allwmake @@ -1,6 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -makeType=${1:-libso} +allwmakeOptions='-allow-lib makeType' && . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmake $makeType liquidProperties diff --git a/src/transportModels/Allwmake b/src/transportModels/Allwmake index 21078c0..351bd1e 100755 --- a/src/transportModels/Allwmake +++ b/src/transportModels/Allwmake @@ -1,6 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -makeType=${1:-libso} +allwmakeOptions='-allow-lib makeType' && . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmake $makeType incompressible diff --git a/src/turbulenceModels/Allwmake b/src/turbulenceModels/Allwmake index 3cba27e..abfd728 100755 --- a/src/turbulenceModels/Allwmake +++ b/src/turbulenceModels/Allwmake @@ -1,11 +1,12 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -makeType=${1:-libso} +allwmakeOptions='-allow-lib makeType' && . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments + set -x -LES/Allwmake $* -incompressible/Allwmake $* -compressible/Allwmake $* +LES/Allwmake $OriginalOptions +incompressible/Allwmake $OriginalOptions +compressible/Allwmake $OriginalOptions wmake $makeType derivedFvPatchFields # ----------------------------------------------------------------- end-of-file diff --git a/src/turbulenceModels/LES/Allwmake b/src/turbulenceModels/LES/Allwmake index 6ee54e6..e65f987 100755 --- a/src/turbulenceModels/LES/Allwmake +++ b/src/turbulenceModels/LES/Allwmake @@ -1,6 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -makeType=${1:-libso} +allwmakeOptions='-allow-lib makeType' && . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmakeLnInclude ../incompressible/LES diff --git a/src/turbulenceModels/compressible/Allwmake b/src/turbulenceModels/compressible/Allwmake index 6e230c0..c8a4018 100755 --- a/src/turbulenceModels/compressible/Allwmake +++ b/src/turbulenceModels/compressible/Allwmake @@ -1,6 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -makeType=${1:-libso} +allwmakeOptions='-allow-lib makeType' && . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmake $makeType turbulenceModel diff --git a/src/turbulenceModels/incompressible/Allwmake b/src/turbulenceModels/incompressible/Allwmake index 6e230c0..c8a4018 100755 --- a/src/turbulenceModels/incompressible/Allwmake +++ b/src/turbulenceModels/incompressible/Allwmake @@ -1,6 +1,6 @@ #!/bin/sh cd ${0%/*} || exit 1 # run from this directory -makeType=${1:-libso} +allwmakeOptions='-allow-lib makeType' && . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments set -x wmake $makeType turbulenceModel diff --git a/wmake/scripts/AllwmakeArguments b/wmake/scripts/AllwmakeArguments new file mode 100644 index 0000000..18e265a --- /dev/null +++ b/wmake/scripts/AllwmakeArguments @@ -0,0 +1,219 @@ +#----------------------------------*-sh-*-------------------------------------- +# License +# +# This file is part of a patch submitted here: +# http://www.openfoam.com/mantisbt/view.php?id=256 +# It's licensed under the same license of the target software, namely GPL +# v3 or above (see <http://www.gnu.org/licenses/>). +# +# File +# wmake/scripts/AllwmakeArguments +# +# Description +# Parses arguments (options) sent to any Allwmake scripts that source this file. +# The variable "OriginalOptions" will save the original options, in case +# the Allwmake script needs them. +# +# Usage +# . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments +# or +# allwmakeOptions='-allow-doc doDoxygen' && . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments +# +# Valid arguments +# -h or -help : shows a list of valid arguments and respective descriptions. +# -helpdev : shows a list of hidden arguments and respective descriptions +# relevant only to developers. +# -k or -nonstop : argument used for building without stopping when errors occur. +# -j or -j N : argument used for either running with all available +# cores/hyperthreads or with just N cores. +# -j+ : variant of the previous option, but running with all available +# cores/hyperthreads + 1. +# -schedoff : build without wmakeScheduler. +# +# Arguments for "allwmakeOptions" +# -allow-doc docvarname : if "doc" is picked up later on during parsing, then +# "docvarname" will be set to 1. +# -allow-lib libvarname : if "lib", "libo" or "libso" are detected during parsing, +# "libvarname" will be assigned that value. +# -allow-inotify varname : if "USE_STAT" is detected, it will assigned to "varname". +# -allow-readline varname : if "NO_READLINE" is detected, it will assigned to "varname". +# +#------------------------------------------------------------------------------ + +Script=${0##*/} +OriginalOptions=$* + +usage() { + exec 1>&2 + while [ "$#" -ge 1 ]; do echo "$1"; shift; done + + #show normal usage options + cat<<USAGE + +Usage: $Script [OPTIONS] + +options: + -h or -help shows a list of valid options and respective descriptions + -helpdev shows a list of hidden options and respective descriptions relevant only to developers + -k or -nonstop option used for building without stopping when errors occur + -j , -jN or -j N option used for either running with all available cores/hyperthreads or with just N cores + -j+ variant of the previous option, but running with all available cores/hyperthreads + 1 (optimum build speed) + -schedoff build without wmakeScheduler +USAGE + + #show options for building code documentation + test -n "$doc_varname" && cat<<USAGE_DOC + doc build code documentation (requires Doxygen to be installed) +USAGE_DOC + + #show options for building libraries + test -n "$lib_varname" && cat<<USAGE_LIB + lib build statically linked archive lib (.a) + libo build statically linked lib (.o) + libso build dynamically linked lib (.so) +USAGE_LIB + + #show options for inotify/stat + test -n "$inotify_varname" && cat<<USAGE_INOTF + USE_STAT don't use <sys/inotify.h> if found (Linux) +USAGE_INOTF + + #show options for readline + test -n "$readline_varname" && cat<<USAGE_RL + NO_READLINE don't use <readline/readline.h> if found +USAGE_RL + exit 1 +} + +usage_dev() { + exec 1>&2 + while [ "$#" -ge 1 ]; do echo "$1"; shift; done + + #show options for developers + cat<<USAGE_DEV + +Options to be used only within Allwmake scripts via "allwmakeOptions": + -allow-doc docvarname if "doc" is picked up later on during parsing, then "docvarname" will be set to 1. + -allow-lib libvarname if "liba", "libo" or "libso" are detected during parsing, "libvarname" will be assigned that value. + -allow-inotify varname if "USE_STAT" is detected, it will assigned to "varname". + -allow-readline varname if "NO_READLINE" is detected, it will assigned to "varname". + +USAGE_DEV + exit 1 +} + +#based on ThirdParty-1.7.x/tools/makeThirdPartyFunctions +getNCOMPPROCS() +{ + if [ -r /proc/cpuinfo ] + then + WM_NCOMPPROCS=$(egrep "^processor" /proc/cpuinfo | wc -l) + [ $WM_NCOMPPROCS -le 8 ] || WM_NCOMPPROCS=8 + else + WM_NCOMPPROCS=1 + fi + + export WM_NCOMPPROCS +} + +resetParser() +{ + optcount=0; opt1="" +} + +unset doc_varname lib_varname inotify_varname readline_varname + +#parse internal options first +resetParser +for internalOpt in $allwmakeOptions +do + if [ $optcount -eq 0 ]; then + opt1=$internalOpt + optcount=1 + else + case "$opt1" in + -allow-doc) + doc_varname="$internalOpt" # save "docvarname" + eval $doc_varname=0 #set libso as default option + ;; + -allow-lib) + lib_varname="$internalOpt" # save "libvarname" + eval $lib_varname="libso" #set libso as default option + ;; + -allow-inotify) + inotify_varname="$internalOpt" # save "varname" + ;; + -allow-readline) + readline_varname="$internalOpt" # save "varname" + ;; + *) + usage_dev "'$1' is an invalid internal option" + ;; + esac + resetParser + fi +done + +# parse options +while [ "$#" -gt 0 ] +do + case "$1" in + -h | -help) + usage + ;; + -helpdev) + usage_dev + ;; + -j) + getNCOMPPROCS + test $# -ge 2 && expr $2 + 1 > /dev/null 2>&1 && shift && export WM_NCOMPPROCS=$1 + echo "Building enabled for $WM_NCOMPPROCS cores" + ;; + -j+) + getNCOMPPROCS + export WM_NCOMPPROCS=`expr $WM_NCOMPPROCS + 1` + echo "Building enabled for $WM_NCOMPPROCS cores" + ;; + -j*) + export WM_NCOMPPROCS=${1#-j} + echo "Building enabled for $WM_NCOMPPROCS cores" + ;; + -k | -nonstop) + export WM_CONTINUE_ON_ERROR=1 + ;; + -schedoff) + unset WM_SCHEDULER + ;; + doc) + test -n "$doc_varname" || usage "invalid option '$1'" + eval $doc_varname="$1" + ;; + lib | libo | libso) + test -n "$lib_varname" || usage "invalid option '$1'" + eval $lib_varname="$1" + ;; + USE_STAT) + test -n "$inotify_varname" || usage "invalid option '$1'" + eval $inotify_varname="$1" + ;; + NO_READLINE) + test -n "$readline_varname" || usage "invalid option '$1'" + eval $readline_varname="$1" + ;; + --) + shift + break + ;; + -* | *) + usage "invalid option '$1'" + ;; + esac + shift +done + +#local cleanup +unset getNCOMPPROCS usage optcount opt1 allwmakeOptions + +#if WM_CONTINUE_ON_ERROR has not been set, then +# activate the shell option "stop on error" +[ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e diff --git a/wmake/wmake b/wmake/wmake index abb6aa8..b68a8cb 100755 --- a/wmake/wmake +++ b/wmake/wmake @@ -182,7 +182,7 @@ then # FOAM_APPS=$(find . -maxdepth 1 \( -type d -a ! -name "." -a ! -name Optional -a ! -name Make \) -printf "%f ") # avoid 'find' with '-printf' ... not entirely portable FOAM_APPS=$(for d in *; do [ -d "$d" -a "$d" != Optional -a "$d" != Make ] && echo "$d"; done | xargs) - $make -k -f $WM_DIR/MakefileApps FOAM_APPS="$FOAM_APPS" + $make ${WM_CONTINUE_ON_ERROR:+-k} -f $WM_DIR/MakefileApps FOAM_APPS="$FOAM_APPS" exit $? fi fi |
|
Greetings to all! I just attached a proposed near-definitive patch file (needs reviewing) named "patch_allwmake_with_options", based on the original patch by Michael Wild. The objective of this proposition is to include the suggestions "-k and -j" by mwild, but also adding a few more possible options and still giving an easy way to extend options for Allwmake scripts. This patch still relies on the current OpenFOAM environment structure, but it's easily adaptable to the other proposition of reducing "global environmental clutter". Additional alias commands were also added, namely wmNONSTOP and wmSTOPON1st for (de)activating the new variable globally. Hopefully I didn't miss any detail operational-wise, but the code itself is not respecting the 80 columns coding standard. I've tested as much as I could with dash (instead of bash) on Ubuntu 10.10, so it should work as intended. In a nutshell, the following options are automatically added with this patch: -h or -help shows a list of valid options and respective descriptions -helpdev shows a list of hidden options and respective descriptions relevant only to developers -k or -nonstop option used for building without stopping when errors occur -j , -jN or -j N option used for either running with all available cores/hyperthreads or with just N cores -j+ variant of the previous option, but running with all available cores/hyperthreads + 1 (optimum build speed) -schedoff build without wmakeScheduler The following options are added via local variable "allwmakeOptions", which are meant to be used by specific Allwmake scripts: -allow-doc docvarname if "doc" is picked up later on during parsing, then "docvarname" will be set to 1. -allow-lib libvarname if "liba", "libo" or "libso" are detected during parsing, "libvarname" will be assigned that value. -allow-inotify varname if "USE_STAT" is detected, it will assigned to "varname". -allow-readline varname if "NO_READLINE" is detected, it will assigned to "varname". Last but not least, I would like to add to mwild's suggestion for the system "similar to git-sh-setup": * the current concept of having "prefs.sh" files placed in key folders can still be reused, working similarly to "git-sh-setup"; * multiple "prefs.sh" files can still coexist in the same system, but now distinguished by session names/hashes. Example: "prefs-ab23b123.sh" * these session names/hashes can then be used later on to extend the security options discussed in the bug report #236 (http://www.openfoam.com/mantisbt/view.php?id=236). In other words, if the last time a case that needs "allowSystemOperations 1" was not executed with the current session name/hash, then request the user to check and validate/extend permissions for the current session as well. This way it will enforce more security on collaborative/shared CFD cases. This way it should be easier to make things more secure, even if they can become a bit annoying at times.... similarly to ssh's machine id checking mechanism. Best regards, Bruno |
|
Usage examples by the user, from the 2.0.x project folder: ./Allwmake doc -j 4 ./Allwmake doc -j6 ./Allwmake -j The next two commands are useful for running and then finishing the build on a multiple machine environment (at least for me): ./Allwmake -k ./Allwmake -j+ -k -schedoff On the src folder, defining the library type still works: src/Allwmake -j+ libo Additionally, I've just reviewed a bit the AllwmakeArguments file and found a few bugs... will attach the fixed version as AllwmakeArguments_rev2. |
|
AllwmakeArguments_rev2 (6,898 bytes)
#----------------------------------*-sh-*-------------------------------------- # License # # This file is part of a patch submitted here: # http://www.openfoam.com/mantisbt/view.php?id=256 # It's licensed under the same license of the target software, namely GPL # v3 or above (see <http://www.gnu.org/licenses/>). # # File # wmake/scripts/AllwmakeArguments # # Description # Parses arguments (options) sent to any Allwmake scripts that source this file. # The variable "OriginalOptions" will save the original options, in case # the Allwmake script needs them. # # Usage # . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments # or # allwmakeOptions='-allow-doc doDoxygen' && . $WM_PROJECT_DIR/wmake/scripts/AllwmakeArguments # # Valid arguments # -h or -help : shows a list of valid arguments and respective descriptions. # -helpdev : shows a list of hidden arguments and respective descriptions # relevant only to developers. # -k or -nonstop : argument used for building without stopping when errors occur. # -j or -j N : argument used for either running with all available # cores/hyperthreads or with just N cores. # -j+ : variant of the previous option, but running with all available # cores/hyperthreads + 1. # -schedoff : build without wmakeScheduler. # # Arguments for "allwmakeOptions" # -allow-doc docvarname : if "doc" is picked up later on during parsing, then # "docvarname" will be set to 1. # -allow-lib libvarname : if "lib", "libo" or "libso" are detected during parsing, # "libvarname" will be assigned that value. # -allow-inotify varname : if "USE_STAT" is detected, it will assigned to "varname". # -allow-readline varname : if "NO_READLINE" is detected, it will assigned to "varname". # #------------------------------------------------------------------------------ Script=${0##*/} OriginalOptions=$* usage() { exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done #show normal usage options cat<<USAGE Usage: $Script [OPTIONS] options: -h or -help shows a list of valid options and respective descriptions -helpdev shows a list of hidden options and respective descriptions relevant only to developers -k or -nonstop option used for building without stopping when errors occur -j , -jN or -j N option used for either running with all available cores/hyperthreads or with just N cores -j+ variant of the previous option, but running with all available cores/hyperthreads + 1 (optimum build speed) -schedoff build without wmakeScheduler USAGE #show options for building code documentation test -n "$doc_varname" && cat<<USAGE_DOC doc build code documentation (requires Doxygen to be installed) USAGE_DOC #show options for building libraries test -n "$lib_varname" && cat<<USAGE_LIB lib build statically linked archive lib (.a) libo build statically linked lib (.o) libso build dynamically linked lib (.so) USAGE_LIB #show options for inotify/stat test -n "$inotify_varname" && cat<<USAGE_INOTF USE_STAT don't use <sys/inotify.h> if found (Linux) USAGE_INOTF #show options for readline test -n "$readline_varname" && cat<<USAGE_RL NO_READLINE don't use <readline/readline.h> if found USAGE_RL exit 1 } usage_dev() { exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done #show options for developers cat<<USAGE_DEV Options to be used only within Allwmake scripts via "allwmakeOptions": -allow-doc docvarname if "doc" is picked up later on during parsing, then "docvarname" will be set to 1. -allow-lib libvarname if "liba", "libo" or "libso" are detected during parsing, "libvarname" will be assigned that value. -allow-inotify varname if "USE_STAT" is detected, it will assigned to "varname". -allow-readline varname if "NO_READLINE" is detected, it will assigned to "varname". USAGE_DEV exit 1 } #based on ThirdParty-1.7.x/tools/makeThirdPartyFunctions getNCOMPPROCS() { if [ -r /proc/cpuinfo ] then WM_NCOMPPROCS=$(egrep "^processor" /proc/cpuinfo | wc -l) [ $WM_NCOMPPROCS -le 8 ] || WM_NCOMPPROCS=8 else WM_NCOMPPROCS=1 fi export WM_NCOMPPROCS } resetParser() { optcount=0; opt1="" } unset doc_varname lib_varname inotify_varname readline_varname #parse internal options first resetParser for internalOpt in $allwmakeOptions do if [ $optcount -eq 0 ]; then opt1=$internalOpt optcount=1 else case "$opt1" in -allow-doc) doc_varname="$internalOpt" # save "docvarname" eval $doc_varname=0 #set "no doc" as default option ;; -allow-lib) lib_varname="$internalOpt" # save "libvarname" eval $lib_varname="libso" #set libso as default option ;; -allow-inotify) inotify_varname="$internalOpt" # save "varname" ;; -allow-readline) readline_varname="$internalOpt" # save "varname" ;; *) usage_dev "'$1' is an invalid internal option" ;; esac resetParser fi done # parse options while [ "$#" -gt 0 ] do case "$1" in -h | -help) usage ;; -helpdev) usage_dev ;; -j) getNCOMPPROCS test $# -ge 2 && expr $2 + 1 > /dev/null 2>&1 && shift && export WM_NCOMPPROCS=$1 echo "Building enabled for $WM_NCOMPPROCS cores" ;; -j+) getNCOMPPROCS export WM_NCOMPPROCS=`expr $WM_NCOMPPROCS + 1` echo "Building enabled for $WM_NCOMPPROCS cores" ;; -j*) export WM_NCOMPPROCS=${1#-j} echo "Building enabled for $WM_NCOMPPROCS cores" ;; -k | -nonstop) export WM_CONTINUE_ON_ERROR=1 ;; -schedoff) unset WM_SCHEDULER ;; doc) test -n "$doc_varname" || usage "invalid option '$1'" eval $doc_varname=1 ;; lib | libo | libso) test -n "$lib_varname" || usage "invalid option '$1'" eval $lib_varname="$1" ;; USE_STAT) test -n "$inotify_varname" || usage "invalid option '$1'" eval $inotify_varname="$1" ;; NO_READLINE) test -n "$readline_varname" || usage "invalid option '$1'" eval $readline_varname="$1" ;; --) shift break ;; -* | *) usage "invalid option '$1'" ;; esac shift done #local cleanup unset getNCOMPPROCS usage optcount opt1 allwmakeOptions #if WM_CONTINUE_ON_ERROR has not been set, then # activate the shell option "stop on error" [ -n "${WM_CONTINUE_ON_ERROR}" ] || set -e |
|
Since I was curious about using N+1 processes, I've built OpenFOAM 3 times on my machine that has 8GB of DDR2 800MHz and one AMD 1055T X6, using Ubuntu 10.10 with its original gcc version: * 1st build with 6 processes; * 2nd build with 7 processes; * 3rd build with 6 processes again, to account for file cache on RAM; Which resulted in the following timings: 1st: 10273.99user 372.12system 36:14.82elapsed 489%CPU (0avgtext+0avgdata 2001584maxresident)k 227072inputs+4583896outputs (452major+127455000minor)pagefaults 0swaps 2nd: 10274.53user 368.04system 36:10.27elapsed 490%CPU (0avgtext+0avgdata 2001552maxresident)k 56inputs+4584104outputs (0major+127470259minor)pagefaults 0swaps 3rd: 10209.99user 366.84system 35:49.39elapsed 492%CPU (0avgtext+0avgdata 2001536maxresident)k 200inputs+4583880outputs (0major+127473965minor)pagefaults 0swaps Conclusion: at least on my machine, it does not justify using N+1. @mwild: can you check on your machine(s), since it was you who has been suggesting N+1? The test script "TestBuildTimes" is attached and uses the patch I submitted. |
|
TestBuildTimes (317 bytes)
#!/bin/sh echo "Running with 6 cores:" wcleanAll wcleanLnIncludeAll time ./Allwmake -j -k > make_j.log 2>&1 echo "Running with 7 cores:" wcleanAll wcleanLnIncludeAll time ./Allwmake -j+ -k > make_j+.log 2>&1 echo "Running with 6 cores again:" wcleanAll wcleanLnIncludeAll time ./Allwmake -j -k > make_j2.log 2>&1 |
|
While some people claim one should use N+1 (e.g. [1]), others claim 1.5*N (e.g. [2]) is the best, and others again say that anything beyond N doesn't help at all. So I guess using N by default if only -j (without argument) is passed is safest, and then leave it to the user if he wants something else. Handling it like GNU make by assuming "-j" means "-j infinity" is certainly a bad idea, though. [1] http://stackoverflow.com/questions/2499070/gnu-make-should-j-equal-number-the-number-of-cpu-cores-in-a-system/2500791#2500791 [2] http://stackoverflow.com/questions/414714/compiling-with-g-using-multiple-cores/414725#414725 |
|
Indeed, "-j infinity" would be extremely bad... fortunately the one implemented on the submitted patches will only use the number of detected cores, or 8 when lacking system information (i.e., no permissions to access "/proc/cpuinfo"). So I suspect that N+1 and 1.5*N are only good when disk access is a bit slow during long/frequent read times. And as long as it doesn't hit the swap memory... edit: In order to clean up a bit this bug report page, I've moved the timings I had for building OpenFOAM to here: http://www.cfd-online.com/Forums/blogs/wyldckat/923-build-times-openfoam-2-0-x-code-ubuntu-10-10-its-gcc-4-4-5.html |
|
In getNCOMPPROCS() you might first want to try "getconf _NPROCESSORS_ONLN" on Linux and "sysctl -n hw.ncpu" on BSD Unix systems, and only then proceed to parsing /proc/cpuinfo. |
|
Thanks for the suggestions and demonstration implementation of the functionality. I have updated the Allwmake scripts with equivalent functionality for handling optional stop/continue-on-error, control of number of processors for compilation and cleaned-up the argument handling which will be included in the next major release of OpenFOAM. |
|
Resolved by commit bc5134a55ec35950a302608c81b47b8efe84798b in https://github.com/OpenFOAM/OpenFOAM-dev |
Date Modified | Username | Field | Change |
---|---|---|---|
2011-07-18 17:24 |
|
New Issue | |
2011-07-18 17:24 |
|
File Added: 0001-ENH-Abort-All-wmake-on-first-error.patch | |
2011-07-18 22:17 | henry | Note Added: 0000561 | |
2011-07-19 12:17 |
|
Note Added: 0000564 | |
2011-07-19 12:22 |
|
Note Edited: 0000564 | |
2011-07-19 12:23 | henry | Note Added: 0000566 | |
2011-07-19 12:23 |
|
Note Edited: 0000564 | |
2011-07-19 12:28 |
|
Note Added: 0000567 | |
2011-08-08 03:03 | wyldckat | File Added: patch_allwmake_with_options | |
2011-08-08 03:35 | wyldckat | Note Added: 0000611 | |
2011-08-08 03:47 | wyldckat | Note Added: 0000612 | |
2011-08-08 03:47 | wyldckat | File Added: AllwmakeArguments_rev2 | |
2011-08-08 14:54 | wyldckat | Note Added: 0000613 | |
2011-08-08 14:55 | wyldckat | File Added: TestBuildTimes | |
2011-08-08 15:16 |
|
Note Added: 0000614 | |
2011-08-08 21:12 | wyldckat | Note Added: 0000615 | |
2011-08-09 05:55 |
|
Note Added: 0000616 | |
2011-08-09 11:08 | wyldckat | Note Edited: 0000615 | |
2011-08-27 18:43 | wyldckat | Note Edited: 0000615 | |
2014-05-29 17:37 | henry | Note Added: 0003092 | |
2014-05-29 17:37 | henry | Status | new => resolved |
2014-05-29 17:37 | henry | Resolution | open => fixed |
2014-05-29 17:37 | henry | Assigned To | => henry |
2014-12-14 21:47 | henry | Note Added: 0003317 |