Skip to content
Snippets Groups Projects
Commit 8596a86a authored by mattijs's avatar mattijs
Browse files

ENH: bin/foamRunTutorials: run in parallel

parent 9b38b768
Branches
Tags
No related merge requests found
......@@ -3,7 +3,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
......@@ -31,6 +31,39 @@
#
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Select the version of make to be used
#------------------------------------------------------------------------------
# normally use "make"
make="make"
# set WM_NCOMPPROCS automatically when both WM_HOSTS and WM_SCHEDULER are set
if [ -z "$WM_NCOMPPROCS" -a -n "$WM_HOSTS" -a -n "$WM_SCHEDULER" ]
then
WM_NCOMPPROCS=$(wmakeScheduler -count)
[ $? -eq 0 ] || unset WM_NCOMPPROCS
fi
if [ "$WM_NCOMPPROCS" ]
then
if [ "$WM_NCOMPPROCS" -gt 1 -a ! "$MAKEFLAGS" ]
then
lockDir=$HOME/.$WM_PROJECT/.wmake
if [ -d $lockDir ]
then
rm -f $lockDir/*
else
mkdir -p $lockDir
fi
make="make --no-print-directory -j "$WM_NCOMPPROCS
fi
fi
# Source tutorial functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
......@@ -62,13 +95,15 @@ else
fi
done
# Recurse to subdirectories
for caseName in *
do
if [ -d $caseName ]
then
( cd $caseName && $thisScript )
fi
done
#for caseName in *
#do
# if [ -d $caseName ]
# then
# ( cd $caseName && $thisScript )
# fi
#done
FOAM_TARGETS=$(for d in *; do [ -d "$d" ] && echo "$d"; done | xargs)
$make -k -f $WM_PROJECT_DIR/bin/tools/MakefileDirs FOAM_TARGETS="$FOAM_TARGETS" FOAM_APP=$thisScript
fi
#------------------------------------------------------------------------------
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment