From aea5c0876fc390ab457e52cf48182b8a831a75da Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 6 Oct 2008 11:14:50 +0100 Subject: [PATCH 1/6] intel compiler warning --- .../intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C index dcf4730f7a..ffef30b10d 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C @@ -86,7 +86,7 @@ Foam::ReactingCloud::ReactingCloud ( IOobject ( - this->name() + "rhoTrans" + name(i), + this->name() + "rhoTrans" + Foam::name(i), this->db().time().timeName(), this->db(), IOobject::NO_READ, From dbd773a8aaa948c9c35c2145cfffeb561145d61d Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 6 Oct 2008 11:28:55 +0100 Subject: [PATCH 2/6] using default comms type --- .../mapPolyMesh/mapDistribute/mapDistribute.H | 49 +++++++++++++++---- 1 file changed, 40 insertions(+), 9 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.H b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.H index 65888ea79e..748834ca4d 100644 --- a/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.H +++ b/src/OpenFOAM/meshes/polyMesh/mapPolyMesh/mapDistribute/mapDistribute.H @@ -168,19 +168,50 @@ public: List& ); - //- Distribute data using scheduling. + //- Distribute data using default commsType. template void distribute(List& fld) const { - distribute + if ( - Pstream::scheduled, - schedule(), - constructSize_, - subMap_, - constructMap_, - fld - ); + Pstream::defaultCommsType == Pstream::nonBlocking + && contiguous() + ) + { + distribute + ( + Pstream::nonBlocking, + List(), + constructSize_, + subMap_, + constructMap_, + fld + ); + } + else if (Pstream::defaultCommsType == Pstream::scheduled) + { + distribute + ( + Pstream::scheduled, + schedule(), + constructSize_, + subMap_, + constructMap_, + fld + ); + } + else + { + distribute + ( + Pstream::blocking, + List(), + constructSize_, + subMap_, + constructMap_, + fld + ); + } } //- Correct for topo change. From 34b727e0987f2c7dbb835fd81e2d7b0a564ad05f Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 6 Oct 2008 14:32:17 +0100 Subject: [PATCH 3/6] addLib for multidir paths --- etc/settings.csh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/settings.csh b/etc/settings.csh index cfa1927ef2..4e08fbda12 100644 --- a/etc/settings.csh +++ b/etc/settings.csh @@ -32,7 +32,7 @@ #------------------------------------------------------------------------------ alias _foamAddPath 'set path=(\!* $path) ; if ( ! -d \!* ) mkdir -p \!*' -alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH} ; if ( ! -d \!* ) mkdir -p \!*' +alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH} ; set xx=`echo $LD_LIBRARY_PATH | sed -e "s/:.*//"`; if ( ! -d $xx ) mkdir -p $xx' #- Add the system-specific executables path to the path From 2bc4f64450ecc7d48cd51a5b0f21927d033eaa6f Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 6 Oct 2008 14:41:49 +0100 Subject: [PATCH 4/6] multi-dir path handling --- etc/settings.csh | 1 - 1 file changed, 1 deletion(-) diff --git a/etc/settings.csh b/etc/settings.csh index 4e08fbda12..32fac58a6f 100644 --- a/etc/settings.csh +++ b/etc/settings.csh @@ -82,7 +82,6 @@ switch ("$WM_COMPILER_INST") case OpenFOAM: switch ("$WM_COMPILER") case Gcc: - #setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/gcc-4.3.1/platforms/$WM_ARCH$WM_COMPILER_ARCH setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/gcc-4.3.2/platforms/$WM_ARCH$WM_COMPILER_ARCH _foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.3.2/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib _foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.3/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib From a819078614e3be36287e678db1bc836f035a5d2f Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 6 Oct 2008 14:42:22 +0100 Subject: [PATCH 5/6] multi-dir path handling --- etc/settings.sh | 45 +++++++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/etc/settings.sh b/etc/settings.sh index 743d8e1fc0..6c05f9f44e 100644 --- a/etc/settings.sh +++ b/etc/settings.sh @@ -33,22 +33,40 @@ _foamAddPath() { - while [ $# -ge 1 ] - do - [ -d $1 ] || mkdir -p $1 - export PATH=$1:$PATH - shift - done + if [ $# -eq 1 ] + then + oldIFS="$IFS" + IFS=':' # split on ':' + set -- $1 + IFS="$oldIFS" + unset oldIFS + fi + + while [ $# -ge 1 ] + do + [ -d $1 ] || mkdir -p $1 + export PATH=$1:$PATH + shift + done } _foamAddLib() { - while [ $# -ge 1 ] - do - [ -d $1 ] || mkdir -p $1 - export LD_LIBRARY_PATH=$1:$LD_LIBRARY_PATH - shift - done + if [ $# -eq 1 ] + then + oldIFS="$IFS" + IFS=':' # split on ':' + set -- $1 + IFS="$oldIFS" + unset oldIFS + fi + + while [ $# -ge 1 ] + do + [ -d $1 ] || mkdir -p $1 + export LD_LIBRARY_PATH=$1:$LD_LIBRARY_PATH + shift + done } @@ -99,7 +117,6 @@ case "$WM_COMPILER_INST" in OpenFOAM) case "$WM_COMPILER" in Gcc) - #export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/gcc-4.3.1/platforms/$WM_ARCH$WM_COMPILER_ARCH export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/gcc-4.3.2/platforms/$WM_ARCH$WM_COMPILER_ARCH _foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.3.2/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib _foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.3/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib @@ -127,7 +144,7 @@ esac if [ -d "$WM_COMPILER_BIN" ]; then _foamAddPath $WM_COMPILER_BIN - _foamAddLib $WM_COMPILER_LIB + _foamAddLib $WM_COMPILER_LIB fi unset WM_COMPILER_BIN WM_COMPILER_LIB From 6943d2fb6f63536bf6629cfc06021bce7b8ca744 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 6 Oct 2008 14:42:32 +0100 Subject: [PATCH 6/6] mark changes --- wmake/wmakeScheduler | 181 +++++++++++++++++++++++++------------------ 1 file changed, 104 insertions(+), 77 deletions(-) diff --git a/wmake/wmakeScheduler b/wmake/wmakeScheduler index 2a2ed0fd76..a4c88624ab 100755 --- a/wmake/wmakeScheduler +++ b/wmake/wmakeScheduler @@ -57,14 +57,15 @@ lockDir=$HOME/.wmakeScheduler # count the total number of slots available and exit if [ "$1" = "-count" ] then - expr $( - for slotGroup in $WM_HOSTS - do - n=${slotGroup##*:} - if [ "$n" = "${slotGroup%%:*}" ]; then n=1; fi # missing ':' - echo "+ ${n:-1}" - done) - exit 0 + expr $( + for slotGroup in $WM_HOSTS + do + n=${slotGroup##*:} + [ "$n" = "${slotGroup%%:*}" ] && n=1 # missing ':' + echo "+ ${n:-1}" + done + ) + exit 0 fi # where to source WM_PROJECT settings in a remote shell @@ -75,25 +76,26 @@ fi sourceFoam=false # fallback command case $SHELL in */csh | */tcsh ) # [t]csh vs bash|ksh|sh - shellRc=cshrc - ;; + shellRc=cshrc + ;; *) - shellRc=bashrc - ;; + shellRc=bashrc + ;; esac # check ~/.$WM_PROJECT/$WM_PROJECT_VERSION/ # check ~/.$WM_PROJECT/ # check /etc/ -if [ "$WM_PROJECT" ]; then - +if [ "$WM_PROJECT" ] +then for i in \ $HOME/.$WM_PROJECT/$WM_PROJECT_VERSION \ $HOME/.$WM_PROJECT \ $WM_PROJECT_DIR/etc \ ; do - if [ -f "$i/$shellRc" ]; then + if [ -f "$i/$shellRc" ] + then sourceFoam="$i/$shellRc" break fi @@ -105,7 +107,8 @@ fi # attempt to preserve the installation directory 'FOAM_INST_DIR' case $sourceFoam in */bashrc) - if [ "$FOAM_INST_DIR" ]; then + if [ "$FOAM_INST_DIR" ] + then sourceFoam='[ "$WM_PROJECT" ] || '"FOAM_INST_DIR=$FOAM_INST_DIR . $sourceFoam" else sourceFoam='[ "$WM_PROJECT" ] || '". $sourceFoam" @@ -125,25 +128,50 @@ rcmd=$(echo $* | sed -e s/\"/\'\"\'/g) # Convert WM_COLOURS into an array -declare colours +declare colourList nColours=0 for col in $WM_COLOURS do - colours[$nColours]=$col - ((nColours = $nColours + 1)) + colourList[$nColours]=$col + ((nColours = $nColours + 1)) done -# Bashism: make pipe fail early. This make sure return value of compilation -# is returned and not of colouring pipe. +# Bashism: make pipe fail early. +# This ensures the return value of the command is returned and not of the +# colouring pipe etc. set -o pipefail -# Define function to colour output by argument 1 -colourPipe(){ - if [ "$1" ]; then - (while read line; do setterm -foreground $1; echo "$line" ; done; setterm -foreground default) - else - cat - fi + +# +# colour output by argument 1 +# +colourPipe() +{ + if [ "$1" ] + then + ( + while read line + do + setterm -foreground $1 + echo "$line" + done + setterm -foreground default + ) + else + cat + fi +} + + +# +# prefix message with [HOSTNAME] +# +prefixPipe() +{ + while read line + do + echo "[$@] $line" + done } @@ -151,61 +179,60 @@ colourIndex=0 while : do - for slotGroup in $WM_HOSTS - do - # split 'host:N', but catch 'host:' and 'host' too - host=${slotGroup%%:*} - n=${slotGroup##*:} - if [ "$n" = "$host" ]; then n=1; fi # missing ':' - : ${n:=1} + for slotGroup in $WM_HOSTS + do + # split 'host:N', but catch 'host:' and 'host' too + host=${slotGroup%%:*} + n=${slotGroup##*:} + [ "$n" = "$host" ] && n=1 # missing ':' + : ${n:=1} - i=0 - while [ "$i" -lt "$n" ] - do - lockFile="$lockDir/$host:$i" - if lockfile -r0 "$lockFile" 2>/dev/null; then - if [ "$WM_COLOURS" ]; then - # Set colour - colour="${colours[$colourIndex]}" + i=0 + while [ "$i" -lt "$n" ] + do + lockFile="$lockDir/$host:$i" + if lockfile -r0 "$lockFile" 2>/dev/null + then + if [ "$nColours" -gt 0 ] + then + # Set colour and index to next colour + colour="${colourList[$colourIndex]}" + colourIndex=$(expr $colourIndex + 1) + [ "$colourIndex" -lt "$nColours" ] || colourIndex=0 - if [ "$host" = "$HOST" ]; then - eval $* 2>&1 | colourPipe "$colour" - elif [ -n "$JOB_ID" ]; then - qrsh -inherit -v PWD $host "$rcmd" - else - ssh $host "$sourceFoam 2>/dev/null; cd $PWD && $rcmd" 2>&1 | colourPipe "$colour" - fi - retval=$? - else - if [ "$host" = "$HOST" ]; then - eval $* - elif [ -n "$JOB_ID" ]; then - qrsh -inherit -v PWD $host "$rcmd" - else - ssh $host "$sourceFoam 2>/dev/null; cd $PWD && $rcmd" - fi - retval=$? - fi - - # Release lock - rm -f "$lockFile" 2>/dev/null - exit $retval + if [ "$host" = "$HOST" ]; then + eval $* 2>&1 | colourPipe "$colour" + elif [ -n "$JOB_ID" ]; then + qrsh -inherit -v PWD $host "$rcmd" + else + ssh $host "$sourceFoam 2>/dev/null; cd $PWD && $rcmd" 2>&1 | colourPipe "$colour" + fi + retval=$? + else + if [ "$host" = "$HOST" ]; then + eval $* 2>&1 | prefixPipe "$host" + elif [ -n "$JOB_ID" ]; then + qrsh -inherit -v PWD $host "$rcmd" | prefixPipe "$host" + else + ssh $host "$sourceFoam 2>/dev/null; cd $PWD && $rcmd" 2>&1 | prefixPipe "$host" + fi + retval=$? fi - i=$(expr $i + 1) - # Cycle through colours - colourIndex=$(expr $colourIndex + 1) - if (( $colourIndex >= $nColours )); then - colourIndex=0 - fi - done - done - # Did not find any free slots. Rest a bit. - sleep 1 + # Release lock + rm -f "$lockFile" 2>/dev/null + exit $retval + fi + i=$(expr $i + 1) + done + done + # Did not find any free slots. Rest a bit. + sleep 1 done -if [ "$WM_COLOURS" ]; then - setterm -foreground default +if [ "$nColours" -gt 0 ] +then + setterm -foreground default fi #------------------------------------------------------------------------------