Updated instructions. Miguel Nobrega
[foam-extend-3.2.git] / etc / settings.sh
blob1333e93a220b18f046cdb161e99cc966d58ed680
1 #!/bin/bash
2 #----------------------------------*-sh-*--------------------------------------
3 # ========= |
4 # \\ / F ield | foam-extend: Open Source CFD
5 # \\ / O peration | Version: 3.2
6 # \\ / A nd | Web: http://www.foam-extend.org
7 # \\/ M anipulation | For copyright notice see file Copyright
8 #------------------------------------------------------------------------------
9 # License
10 # This file is part of foam-extend.
12 # foam-extend is free software: you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License as published by the
14 # Free Software Foundation, either version 3 of the License, or (at your
15 # option) any later version.
17 # foam-extend is distributed in the hope that it will be useful, but
18 # WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 # General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
25 # Script
26 # etc/settings.sh
28 # Description
29 # Startup file for FOAM
30 # Sourced from FOAM-??/etc/bashrc
32 #------------------------------------------------------------------------------
34 # prefix to PATH
35 _foamAddPath()
37 while [ $# -ge 1 ]
39 export PATH=$1:$PATH
40 shift
41 done
44 # prefix to LD_LIBRARY_PATH
45 _foamAddLib()
47 while [ $# -ge 1 ]
49 export LD_LIBRARY_PATH=$1:$LD_LIBRARY_PATH
50 if [ "$WM_ARCH_BASE" = "darwin" ]
51 then
52 # do NOT add the lib of MacPort as this might break programs
53 if [ "$1" != "/opt/local/lib" ]
54 then
55 export DYLD_LIBRARY_PATH=$1:$DYLD_LIBRARY_PATH
58 shift
59 done
62 # Source files, possibly with some verbosity
63 # Yes, this is the same definition as in the file etc/bash
64 # We need that definition available for scripts sourcing
65 # settings.sh directly.
66 _foamSource()
68 while [ $# -ge 1 ]
70 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo "Sourcing: $1"
71 . $1
72 shift
73 done
76 # location of the jobControl directory
77 export FOAM_JOB_DIR=$HOME/$WM_PROJECT/jobControl
79 # wmake configuration
80 export WM_DIR=$WM_PROJECT_DIR/wmake
81 export WM_LINK_LANGUAGE=c++
82 export WM_OPTIONS=$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_COMPILE_OPTION
83 export PATH=$WM_DIR:$PATH
85 # base configuration
86 export FOAM_APP=$WM_PROJECT_DIR/applications
87 export FOAM_APPBIN=$WM_PROJECT_DIR/applications/bin/$WM_OPTIONS
88 export FOAM_LIB=$WM_PROJECT_DIR/lib
89 export FOAM_LIBBIN=$WM_PROJECT_DIR/lib/$WM_OPTIONS
90 export FOAM_SRC=$WM_PROJECT_DIR/src
92 # shared site configuration - similar naming convention as ~FOAM expansion
93 export FOAM_SITE_APPBIN=$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/bin/$WM_OPTIONS
94 export FOAM_SITE_LIBBIN=$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/lib/$WM_OPTIONS
96 # user configuration
97 export FOAM_USER_APPBIN=$WM_PROJECT_USER_DIR/applications/bin/$WM_OPTIONS
98 export FOAM_USER_LIBBIN=$WM_PROJECT_USER_DIR/lib/$WM_OPTIONS
100 # convenience
101 export FOAM_TUTORIALS=$WM_PROJECT_DIR/tutorials
102 export FOAM_UTILITIES=$FOAM_APP/utilities
103 export FOAM_SOLVERS=$FOAM_APP/solvers
104 export FOAM_RUN=$WM_PROJECT_USER_DIR/run
106 # add FOAM scripts and wmake to the path
107 export PATH=$WM_DIR:$WM_PROJECT_DIR/bin:$PATH
109 _foamAddPath $FOAM_APPBIN $FOAM_SITE_APPBIN $FOAM_USER_APPBIN
110 _foamAddLib $FOAM_LIBBIN $FOAM_SITE_LIBBIN $FOAM_USER_LIBBIN
113 # Compiler settings
114 # ~~~~~~~~~~~~~~~~~
115 unset compilerBin compilerLib
117 # Select compiler installation
118 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
119 # compilerInstall = FOAM | System
121 # We can override the value of compilerInstall from prefs.sh
122 : ${compilerInstall:=System}
124 # Or we can force it right here
125 #compilerInstall=FOAM
126 #compilerInstall=System
128 case "${compilerInstall}" in
129 FOAM)
130 case "$WM_COMPILER" in
131 Gcc)
132 export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/packages/gcc-4.6.4/platforms/$WM_OPTIONS
133 _foamSource $WM_THIRD_PARTY_DIR/packages/gmp-5.1.2/platforms/$WM_OPTIONS/etc/gmp-5.1.2.sh
134 _foamSource $WM_THIRD_PARTY_DIR/packages/mpfr-3.1.2/platforms/$WM_OPTIONS/etc/mpfr-3.1.2.sh
135 _foamSource $WM_THIRD_PARTY_DIR/packages/mpc-1.0.1/platforms/$WM_OPTIONS/etc/mpc-1.0.1.sh
136 _foamSource $WM_THIRD_PARTY_DIR/packages/gcc-4.6.4/platforms/$WM_OPTIONS/etc/gcc-4.6.4.sh
138 Gcc49)
139 export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/packages/gcc-4.9.2/platforms/$WM_OPTIONS
140 _foamSource $WM_THIRD_PARTY_DIR/packages/gcc-4.9.2/platforms/$WM_OPTIONS/etc/gcc-4.9.2.sh
142 Gcc48)
143 export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/packages/gcc-4.8.4/platforms/$WM_OPTIONS
144 _foamSource $WM_THIRD_PARTY_DIR/packages/gcc-4.8.4/platforms/$WM_OPTIONS/etc/gcc-4.8.4.sh
146 Gcc47)
147 export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/packages/gcc-4.7.4/platforms/$WM_OPTIONS
148 _foamSource $WM_THIRD_PARTY_DIR/packages/gmp-5.1.2/platforms/$WM_OPTIONS/etc/gmp-5.1.2.sh
149 _foamSource $WM_THIRD_PARTY_DIR/packages/mpfr-3.1.2/platforms/$WM_OPTIONS/etc/mpfr-3.1.2.sh
150 _foamSource $WM_THIRD_PARTY_DIR/packages/mpc-1.0.1/platforms/$WM_OPTIONS/etc/mpc-1.0.1.sh
151 _foamSource $WM_THIRD_PARTY_DIR/packages/gcc-4.7.4/platforms/$WM_OPTIONS/etc/gcc-4.7.4.sh
153 Gcc45)
154 export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/packages/gcc-4.5.1/platforms/$WM_OPTIONS
155 _foamSource $WM_THIRD_PARTY_DIR/packages/gmp-5.0.1/platforms/$WM_OPTIONS/etc/gmp-5.0.1.sh
156 _foamSource $WM_THIRD_PARTY_DIR/packages/mpfr-3.0.1/platforms/$WM_OPTIONS/etc/mpfr-3.0.1.sh
157 _foamSource $WM_THIRD_PARTY_DIR/packages/mpc-0.8.2/platforms/$WM_OPTIONS/etc/mpc-0.8.2.sh
158 _foamSource $WM_THIRD_PARTY_DIR/packages/gcc-4.5.1/platforms/$WM_OPTIONS/etc/gcc-4.5.1.sh
160 Gcc44)
161 export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/packages/gcc-4.4.5/platforms/$WM_OPTIONS
162 _foamSource $WM_THIRD_PARTY_DIR/packages/gmp-5.0.1/platforms/$WM_OPTIONS/etc/gmp-5.0.1.sh
163 _foamSource $WM_THIRD_PARTY_DIR/packages/mpfr-3.0.1/platforms/$WM_OPTIONS/etc/mpfr-3.0.1.sh
164 _foamSource $WM_THIRD_PARTY_DIR/packages/gcc-4.4.5/platforms/$WM_OPTIONS/etc/gcc-4.4.5.sh
166 esac
168 # Check that the compiler directory can be found
169 if [ ! -d "$WM_COMPILER_DIR" ]
170 then
171 echo
172 echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:"
173 echo " Cannot find $WM_COMPILER_DIR installation."
174 echo " Please install this compiler version or if you wish to use the system compiler,"
175 echo " change the 'compilerInstall' setting to 'System' in this file"
176 echo
179 compilerBin=$WM_COMPILER_DIR/bin
180 compilerLib=$WM_COMPILER_DIR/lib$WM_COMPILER_LIB_ARCH:$WM_COMPILER_DIR/lib
182 esac
184 if [ -d "$compilerBin" ]
185 then
186 _foamAddPath $compilerBin
187 _foamAddLib $compilerLib
190 unset compilerBin compilerLib compilerInstall
193 if [ -z "$WM_CC" ]
194 then
195 case "$WM_COMPILER" in
196 Gcc*)
197 export WM_CC='gcc'
198 export WM_CXX='g++'
200 Icc)
201 export WM_CC='icc'
202 export WM_CXX='icpc'
204 esac
207 # Communications library
208 # ~~~~~~~~~~~~~~~~~~~~~~
210 unset MPI_ARCH_PATH
211 mpi_version=unknown
212 case "$WM_MPLIB" in
213 OPENMPI)
214 if [ ! -z $WM_THIRD_PARTY_USE_OPENMPI_188 ] && [ -e $WM_THIRD_PARTY_DIR/packages/openmpi-1.8.8/platforms/$WM_OPTIONS ]
215 then
216 mpi_version=openmpi-1.8.8
217 if [ "$FOAM_VERBOSE" -a "$PS1" ]
218 then
219 echo "Using openmpi-1.8.8 from the ThirdParty package: $WM_THIRD_PARTY_DIR/packages/$mpi_version"
221 _foamSource $WM_THIRD_PARTY_DIR/packages/$mpi_version/platforms/$WM_OPTIONS/etc/$mpi_version.sh
223 elif [ ! -z $WM_THIRD_PARTY_USE_OPENMPI_165 ] && [ -e $WM_THIRD_PARTY_DIR/packages/openmpi-1.6.5/platforms/$WM_OPTIONS ]
224 then
225 mpi_version=openmpi-1.6.5
226 if [ "$FOAM_VERBOSE" -a "$PS1" ]
227 then
228 echo "Using openmpi-1.6.5 from the ThirdParty package: $WM_THIRD_PARTY_DIR/packages/$mpi_version"
230 _foamSource $WM_THIRD_PARTY_DIR/packages/$mpi_version/platforms/$WM_OPTIONS/etc/$mpi_version.sh
232 elif [ ! -z $WM_THIRD_PARTY_USE_OPENMPI_143 ] && [ -e $WM_THIRD_PARTY_DIR/packages/openmpi-1.4.3/platforms/$WM_OPTIONS ]
233 then
234 mpi_version=openmpi-1.4.3
235 if [ "$FOAM_VERBOSE" -a "$PS1" ]
236 then
237 echo "Using openmpi-1.4.3 from the ThirdParty package: $WM_THIRD_PARTY_DIR/packages/$mpi_version"
239 _foamSource $WM_THIRD_PARTY_DIR/packages/$mpi_version/platforms/$WM_OPTIONS/etc/$mpi_version.sh
241 elif [ ! -z $WM_THIRD_PARTY_USE_OPENMPI_15 ] && [ -e $WM_THIRD_PARTY_DIR/packages/openmpi-1.5/platforms/$WM_OPTIONS ]
242 then
243 mpi_version=openmpi-1.5
244 if [ "$FOAM_VERBOSE" -a "$PS1" ]
245 then
246 echo "Using openmpi-1.5 from the ThirdParty package: $WM_THIRD_PARTY_DIR/packages/$mpi_version"
248 _foamSource $WM_THIRD_PARTY_DIR/packages/$mpi_version/platforms/$WM_OPTIONS/etc/$mpi_version.sh
251 # On Windows set mpi_version from value defined in bashrc.mingw:
252 if [ "$WM_ARCH_BASE" == "mingw" ]
253 then
254 mpi_version=$MPI_VERSION_MINGW
257 unset mpi_version
260 MACPORTOPENMPI)
261 unset OPAL_PREFIX
263 export FOAM_MPI=openmpi-macport-$WM_MACPORT_MPI_VERSION
265 # Currently not correctly working on MacPorts
266 # libDir=`mpicc-openmpi-$WM_MACPORT_MPI_VERSION --showme:libdirs`
267 libDir=/opt/local/lib/openmpi-$WM_MACPORT_MPI_VERSION
269 _foamAddLib $libDir
270 unset libDir
272 which mpirun >/dev/null
273 if [ $? -ne 0 ]
274 then
275 export WM_MPIRUN_PROG=mpirun-openmpi-$WM_MACPORT_MPI_VERSION
279 MACPORTMPICH)
280 export FOAM_MPI=mpich-macports-$WM_MACPORT_MPI_VERSION
281 export MPI_HOME=$WM_THIRD_PARTY_DIR/$FOAM_MPI
283 libDir=/opt/local/lib/mpich-$WM_MACPORT_MPI_VERSION
285 _foamAddLib $libDir
286 unset libDir
288 which mpirun >/dev/null
289 if [ $? -ne 0 ]
290 then
291 export WM_MPIRUN_PROG=mpirun-mpich-$WM_MACPORT_MPI_VERSION
295 SYSTEMOPENMPI)
296 mpi_version=openmpi-system
298 # make sure not the "old" mpi is used
299 # Not sure if this is necessary anymore.
300 # export OPAL_PREFIX=
302 # Make sure OPENMPI_BIN_DIR is set and valid
303 if [ -n "${OPENMPI_BIN_DIR}" ] && [ -d "${OPENMPI_BIN_DIR}" ]
304 then
305 # User defined value specified for OPENMPI_BIN_DIR
307 # WARNING:
308 # We assume this path specified by $OPENMPI_BIN_DIR is valid
309 # We assume the command mpicc is located somewhere under this path
310 # We assume the file mpi.h is located somewhere under this path
312 # Otherwise, please double check your openmpi installation, you are
313 # probably missing the openmpi runtime and/or development packages
314 # available for your system.
316 _foamAddPath $OPENMPI_BIN_DIR
317 else
318 # Here, we assume your environment is already set for running
319 # and developping with openmpi.
321 # Initialize OPENMPI_BIN_DIR using the path to mpicc
322 export OPENMPI_BIN_DIR=$(dirname `which mpicc`)
325 # Make sure OPENMPI_LIB_DIR is set
326 if [ ! -n "${OPENMPI_LIB_DIR}" ]
327 then
328 # Initialize OPENMPI_LIB_DIR using the path to mpicc
329 export OPENMPI_LIB_DIR="`mpicc --showme:libdirs`"
332 # Make sure the dynamic libraries are accessible
333 [ -n "${OPENMPI_LIB_DIR}" ] && _foamAddLib $OPENMPI_LIB_DIR
335 export MPI_HOME=`dirname $OPENMPI_BIN_DIR`
336 export MPI_ARCH_PATH=$MPI_HOME
337 export OPAL_PREFIX=$MPI_ARCH_PATH
339 # We initialize the rest of the environment using mpicc --showme:
340 [ ! -n "${OPENMPI_INCLUDE_DIR}" ] && export OPENMPI_INCLUDE_DIR="`mpicc --showme:incdirs`"
341 [ ! -n "${OPENMPI_COMPILE_FLAGS}" ] && export OPENMPI_COMPILE_FLAGS="`mpicc --showme:compile`"
342 [ ! -n "${OPENMPI_LINK_FLAGS}" ] && export OPENMPI_LINK_FLAGS="`mpicc --showme:link`"
345 # WARNING: We assume the file mpi.h will be available under the directories identified
346 # by the variable $OPENMPI_INCLUDE_DIR. Otherwise, please double check your
347 # system openmpi installation.
349 # Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI
350 export PINC="${OPENMPI_COMPILE_FLAGS}"
351 export PLIBS="${OPENMPI_LINK_FLAGS}"
353 # No longer needed, but we keep this as a reference, just in case...
354 #libDir=`echo "$PLIBS" | sed -e 's/.*-L\([^ ]*\).*/\1/'`
355 #_foamAddLib $libDir
357 if [ "$FOAM_VERBOSE" -a "$PS1" ]
358 then
359 echo " Environment variables defined for OpenMPI:"
360 echo " OPENMPI_BIN_DIR : $OPENMPI_BIN_DIR"
361 echo " OPENMPI_LIB_DIR : $OPENMPI_LIB_DIR"
362 echo " OPENMPI_INCLUDE_DIR : $OPENMPI_INCLUDE_DIR"
363 echo " OPENMPI_COMPILE_FLAGS : $OPENMPI_COMPILE_FLAGS"
364 echo " OPENMPI_LINK_FLAGS : $OPENMPI_LINK_FLAGS"
365 echo ""
366 echo " MPI_HOME : $MPI_HOME"
367 echo " MPI_ARCH_PATH : $MPI_ARCH_PATH"
368 echo " OPAL_PREFIX : $OPAL_PREFIX"
369 echo " PINC : $PINC"
370 echo " PLIBS : $PLIBS"
373 unset mpi_version
376 MVAPICH2)
377 mpi_version=mvapich2
379 if [ -n "${MVAPICH2_BIN_DIR}" ] && [ -d "${MVAPICH2_BIN_DIR}" ]
380 then
381 _foamAddPath $MVAPICH2_BIN_DIR
382 else
383 MVAPICH2_BIN_DIR=$(dirname `which mpicc`)
386 if which mpicc >/dev/null
387 then
388 mpicc -v 2>/dev/null | grep -q "mpicc for MVAPICH2" ||
389 echo "Warning: `which mpicc` does not appear to be for MVAPICH2"
390 else
391 echo "Warning: mpicc not available"
394 export MPI_HOME=`dirname $MVAPICH2_BIN_DIR`
395 export MPI_ARCH_PATH=$MPI_HOME
397 export PINC="`mpicc -show -cc= -nativelinking`"
398 export PLIBS="`mpicc -show -cc= | sed "s%$PINC%%"`"
400 if [ "$FOAM_VERBOSE" -a "$PS1" ]
401 then
402 echo " Environment variables defined for MVAPICH2:"
403 echo " MPI_ARCH_PATH : $MPI_ARCH_PATH"
404 echo " PINC : $PINC"
405 echo " PLIBS : $PLIBS"
408 unset mpi_version
411 MPICH)
412 mpi_version=mpich-1.2.4
413 export MPI_HOME=$WM_THIRD_PARTY_DIR/$mpi_version
414 export MPI_ARCH_PATH=$MPI_HOME/platforms/$WM_OPTIONS
415 export MPICH_ROOT=$MPI_ARCH_PATH
417 _foamAddPath $MPI_ARCH_PATH/bin
418 _foamAddLib $MPI_ARCH_PATH/lib
420 unset mpi_version
423 MPICH-GM)
424 export MPI_ARCH_PATH=/opt/mpi
425 export MPICH_PATH=$MPI_ARCH_PATH
426 export MPICH_ROOT=$MPI_ARCH_PATH
427 export GM_LIB_PATH=/opt/gm/lib64
429 _foamAddPath $MPI_ARCH_PATH/bin
430 _foamAddLib $MPI_ARCH_PATH/lib
431 _foamAddLib $GM_LIB_PATH
435 HPMPI)
436 export MPI_HOME=/opt/hpmpi
437 export MPI_ARCH_PATH=$MPI_HOME
438 export MPICH_ROOT=$MPI_ARCH_PATH
440 _foamAddPath $MPI_ARCH_PATH/bin
442 case `uname -m` in
443 i686)
444 _foamAddLib $MPI_ARCH_PATH/lib/linux_ia32
447 x86_64)
448 _foamAddLib $MPI_ARCH_PATH/lib/linux_amd64
450 ia64)
451 _foamAddLib $MPI_ARCH_PATH/lib/linux_ia64
454 echo Unknown processor type `uname -m` for Linux
456 esac
460 GAMMA)
461 export MPI_ARCH_PATH=/usr
464 MPI)
465 export MPI_ARCH_PATH=/opt/mpi
468 FJMPI)
469 export MPI_ARCH_PATH=/opt/FJSVmpi2
471 _foamAddPath $MPI_ARCH_PATH/bin
472 _foamAddLib $MPI_ARCH_PATH/lib/sparcv9
473 _foamAddLib /opt/FSUNf90/lib/sparcv9
474 _foamAddLib /opt/FJSVpnidt/lib
477 QSMPI)
478 export MPI_ARCH_PATH=/usr/lib/mpi
480 _foamAddPath $MPI_ARCH_PATH/bin
481 _foamAddLib $MPI_ARCH_PATH/lib
484 SGIMPI)
485 # no trailing slash
486 [ "${MPI_ROOT%/}" = "${MPI_ROOT}" ] || MPI_ROOT="${MPI_ROOT%/}"
488 export FOAM_MPI="${MPI_ROOT##*/}"
489 export MPI_ARCH_PATH=$MPI_ROOT
491 if [ ! -d "$MPI_ROOT" -o -z "$MPI_ARCH_PATH" ]
492 then
493 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
494 echo " MPI_ROOT not a valid mpt installation directory or ending" \
495 " in a '/'." 1>&2
496 echo " Please set MPI_ROOT to the mpt installation directory." 1>&2
497 echo " MPI_ROOT currently set to '$MPI_ROOT'" 1>&2
500 if [ "$FOAM_VERBOSE" -a "$PS1" ]
501 then
502 echo "Using SGI MPT:" 1>&2
503 echo " MPI_ROOT : $MPI_ROOT" 1>&2
504 echo " FOAM_MPI : $FOAM_MPI" 1>&2
507 _foamAddPath $MPI_ARCH_PATH/bin
508 _foamAddLib $MPI_ARCH_PATH/lib
510 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/sgimpi
513 INTELMPI)
514 # no trailing slash
515 [ "${MPI_ROOT%/}" = "${MPI_ROOT}" ] || MPI_ROOT="${MPI_ROOT%/}"
517 export FOAM_MPI="${MPI_ROOT##*/}"
518 export MPI_ARCH_PATH=$MPI_ROOT
520 if [ ! -d "$MPI_ROOT" -o -z "$MPI_ARCH_PATH" ]
521 then
522 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
523 echo " MPI_ROOT not a valid mpt installation directory or ending" \
524 " in a '/'." 1>&2
525 echo " Please set MPI_ROOT to the mpt installation directory." 1>&2
526 echo " MPI_ROOT currently set to '$MPI_ROOT'" 1>&2
529 if [ "$FOAM_VERBOSE" -a "$PS1" ]
530 then
531 echo "Using INTEL MPI:" 1>&2
532 echo " MPI_ROOT : $MPI_ROOT" 1>&2
533 echo " FOAM_MPI : $FOAM_MPI" 1>&2
536 _foamAddPath $MPI_ARCH_PATH/intel64/bin
537 _foamAddLib $MPI_ARCH_PATH/intel64/lib
539 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/intelmpi
544 esac
546 # Removed $FOAM_MPI_LIBBIN. HJ, 8/Aug/2015
549 # Set the minimum MPI buffer size (used by all platforms except SGI MPI)
550 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
551 minBufferSize=20000000
553 if [ "${MPI_BUFFER_SIZE:=$minBufferSize}" -lt $minBufferSize ]
554 then
555 MPI_BUFFER_SIZE=$minBufferSize
557 export MPI_BUFFER_SIZE
560 # CUDA if available
561 # ~~~~~~~~~~~~~~~~~
562 [ -z "$CUDA_SYSTEM" ] && [ -e /usr/local/cuda-5.5/bin/nvcc ] && {
563 export CUDA_DIR=/usr/local/cuda-5.5
564 export CUDA_BIN_DIR=$CUDA_DIR/bin
565 export CUDA_LIB_DIR=$CUDA_DIR/lib64
566 export CUDA_INCLUDE_DIR=$CUDA_DIR/include
569 [ -d "$CUDA_LIB_DIR" ] && _foamAddPath $CUDA_BIN_DIR && _foamAddLib $CUDA_LIB_DIR
572 # CGAL library if available
573 # ~~~~~~~~~~~~~~~~~~~~~~~~~
574 [ -d "$CGAL_LIB_DIR" ] && _foamAddLib $CGAL_LIB_DIR
577 # Switch on the hoard memory allocator if available
578 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
579 #if [ -f $FOAM_LIBBIN/libhoard.so ]
580 #then
581 # export LD_PRELOAD=$FOAM_LIBBIN/libhoard.so:$LD_PRELOAD
584 # HOARD seems to crash Paraview on Mac OS X 10.6
585 #if [ -f $FOAM_LIBBIN/libhoard.dylib ]
586 #then
587 # if [ -z "$DYLD_INSERT_LIBRARIES" ]
588 # then
589 # export DYLD_INSERT_LIBRARIES=$FOAM_LIBBIN/libhoard.dylib
590 # else
591 # export DYLD_INSERT_LIBRARIES=$FOAM_LIBBIN/libhoard.dylib:$DYLD_INSERT_LIBRARIES
592 # fi
596 # Third party packages
598 # In order to use a pre-installed version of the ThirdParty packages, just set the
599 # appropriate XXX_SYSTEM environment variable for a given package in your prefs.sh
600 # file in order to disable the activation of the ThirdParty version of the same package.
602 # Load Mesquite library
603 # ~~~~~~~~~~~~~~~~~~~~~~
604 [ -z "$MESQUITE_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_MESQUITE_212 ] && [ -e $WM_THIRD_PARTY_DIR/packages/mesquite-2.1.2/platforms/$WM_OPTIONS ] && {
605 _foamSource $WM_THIRD_PARTY_DIR/packages/mesquite-2.1.2/platforms/$WM_OPTIONS/etc/mesquite-2.1.2.sh
607 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " MESQUITE_DIR is initialized to: $MESQUITE_DIR"
610 # Load Metis library
611 # ~~~~~~~~~~~~~~~~~~
612 [ -z "$METIS_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_METIS_510 ] && [ -e $WM_THIRD_PARTY_DIR/packages/metis-5.1.0/platforms/$WM_OPTIONS ] && {
613 _foamSource $WM_THIRD_PARTY_DIR/packages/metis-5.1.0/platforms/$WM_OPTIONS/etc/metis-5.1.0.sh
615 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " METIS_DIR is initialized to: $METIS_DIR"
618 # Load ParMetis library
619 # ~~~~~~~~~~~~~~~~~~~~~
620 [ -z "$PARMETIS_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_PARMETIS_403 ] && [ -e $WM_THIRD_PARTY_DIR/packages/parmetis-4.0.3/platforms/$WM_OPTIONS ] && {
621 _foamSource $WM_THIRD_PARTY_DIR/packages/parmetis-4.0.3/platforms/$WM_OPTIONS/etc/parmetis-4.0.3.sh
623 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " PARMETIS_DIR is initialized to: $PARMETIS_DIR"
626 # Load ParMGridGen library
627 # ~~~~~~~~~~~~~~~~~~~~~~~~~
628 [ -z "$PARMGRIDGEN_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_PARMGRIDGEN_10 ] && [ -e $WM_THIRD_PARTY_DIR/packages/ParMGridGen-1.0/platforms/$WM_OPTIONS ] && {
629 _foamSource $WM_THIRD_PARTY_DIR/packages/ParMGridGen-1.0/platforms/$WM_OPTIONS/etc/ParMGridGen-1.0.sh
631 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " PARMGRIDGEN_DIR is initialized to: $PARMGRIDGEN_DIR"
634 # Load Libccmio library
635 # ~~~~~~~~~~~~~~~~~~~~~
636 [ -z "$LIBCCMIO_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_LIBCCMIO_261 ] && [ -e $WM_THIRD_PARTY_DIR/packages/libccmio-2.6.1/platforms/$WM_OPTIONS ] && {
637 _foamSource $WM_THIRD_PARTY_DIR/packages/libccmio-2.6.1/platforms/$WM_OPTIONS/etc/libccmio-2.6.1.sh
639 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " LIBCCMIO_DIR is initialized to: $LIBCCMIO_DIR"
642 # Load Scotch library
643 # ~~~~~~~~~~~~~~~~~~~
644 [ -z "$SCOTCH_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_SCOTCH_604 ] && [ -e $WM_THIRD_PARTY_DIR/packages/scotch-6.0.4/platforms/$WM_OPTIONS ] && {
645 _foamSource $WM_THIRD_PARTY_DIR/packages/scotch-6.0.4/platforms/$WM_OPTIONS/etc/scotch-6.0.4.sh
647 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " SCOTCH_DIR is initialized to: $SCOTCH_DIR"
649 [ -z "$SCOTCH_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_SCOTCH_600 ] && [ -e $WM_THIRD_PARTY_DIR/packages/scotch-6.0.0/platforms/$WM_OPTIONS ] && {
650 _foamSource $WM_THIRD_PARTY_DIR/packages/scotch-6.0.0/platforms/$WM_OPTIONS/etc/scotch-6.0.0.sh
652 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " SCOTCH_DIR is initialized to: $SCOTCH_DIR"
655 # Load cmake
656 # ~~~~~~~~~~
657 [ -z "$CMAKE_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_CMAKE_322 ] && [ -e $WM_THIRD_PARTY_DIR/packages/cmake-3.2.2/platforms/$WM_OPTIONS ] && {
658 _foamSource $WM_THIRD_PARTY_DIR/packages/cmake-3.2.2/platforms/$WM_OPTIONS/etc/cmake-3.2.2.sh
660 [ -z "$CMAKE_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_CMAKE_2812 ] && [ -e $WM_THIRD_PARTY_DIR/packages/cmake-2.8.12/platforms/$WM_OPTIONS ] && {
661 _foamSource $WM_THIRD_PARTY_DIR/packages/cmake-2.8.12/platforms/$WM_OPTIONS/etc/cmake-2.8.12.sh
663 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " CMAKE_DIR is initialized to: $CMAKE_DIR"
665 # Load m4
666 # ~~~~~~~~~~
667 [ -z "$M4_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_M4_1416 ] && [ -e $WM_THIRD_PARTY_DIR/packages/m4-1.4.16/platforms/$WM_OPTIONS ] && {
668 _foamSource $WM_THIRD_PARTY_DIR/packages/m4-1.4.16/platforms/$WM_OPTIONS/etc/m4-1.4.16.sh
670 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " M4_DIR is initialized to: $M4_DIR"
672 # Load bison
673 # ~~~~~~~~~~
674 [ -z "$BISON_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_BISON_27 ] && [ -e $WM_THIRD_PARTY_DIR/packages/bison-2.7/platforms/$WM_OPTIONS ] && {
675 _foamSource $WM_THIRD_PARTY_DIR/packages/bison-2.7/platforms/$WM_OPTIONS/etc/bison-2.7.sh
677 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " BISON_DIR is initialized to: $BISON_DIR"
679 # Load flex
680 # ~~~~~~~~~~
681 [ -z "$FLEX_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_FLEX_2535 ] && [ -e $WM_THIRD_PARTY_DIR/packages/flex-2.5.35/platforms/$WM_OPTIONS ] && {
682 _foamSource $WM_THIRD_PARTY_DIR/packages/flex-2.5.35/platforms/$WM_OPTIONS/etc/flex-2.5.35.sh
684 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " FLEX_DIR is initialized to: $FLEX_DIR"
687 # Load zoltan
688 # ~~~~~~~~~~
689 [ -z "$ZOLTAN_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_ZOLTAN_36 ] && [ -e $WM_THIRD_PARTY_DIR/packages/zoltan_3.6 ] && {
690 _foamSource $WM_THIRD_PARTY_DIR/packages/zoltan_3.6/platforms/$WM_OPTIONS/etc/zoltan_3.6.sh
692 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " ZOLTAN_DIR is initialized to: $ZOLTAN_DIR"
695 # Load Python
696 # ~~~~~~~~~~~
697 [ -z "$PYTHON_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_PYTHON_27 ] && [ -e $WM_THIRD_PARTY_DIR/packages/Python-2.7/platforms/$WM_OPTIONS ] && {
698 _foamSource $WM_THIRD_PARTY_DIR/packages/Python-2.7/platforms/$WM_OPTIONS/etc/Python-2.7.sh
700 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " PYTHON_DIR is initialized to: $PYTHON_DIR"
702 # Load PyFoam
703 # ~~~~~~~~~~~
704 [ -z "$PYFOAM_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_PYFOAM_063 ] && [ -e $WM_THIRD_PARTY_DIR/packages/PyFoam-0.6.3/platforms/noarch ] && {
705 _foamSource $WM_THIRD_PARTY_DIR/packages/PyFoam-0.6.3/platforms/noarch/etc/PyFoam-0.6.3.sh
707 [ -z "$PYFOAM_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_PYFOAM_064 ] && [ -e $WM_THIRD_PARTY_DIR/packages/PyFoam-0.6.4/platforms/noarch ] && {
708 _foamSource $WM_THIRD_PARTY_DIR/packages/PyFoam-0.6.4/platforms/noarch/etc/PyFoam-0.6.4.sh
710 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " PYFOAM_DIR is initialized to: $PYFOAM_DIR"
712 # Make sure that there is a special directory for special PyFoam-scripts
713 [ -z "$PYFOAM_SITE_DIR" ] && export PYFOAM_SITE_DIR=$WM_THIRD_PARTY_DIR/PyFoamSiteScripts
714 if [ -d $PYFOAM_SITE_DIR/bin ]
715 then
716 _foamAddPath $PYFOAM_SITE_DIR/bin
719 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " PYFOAM_SITE_DIR is initialized to: $PYFOAM_SITE_DIR"
721 # Load hwloc
722 # ~~~~~~~~~~~
723 [ -z "$HWLOC_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_HWLOC_1101 ] && [ -e $WM_THIRD_PARTY_DIR/packages/hwloc-1.10.1/platforms/$WM_OPTIONS ] && {
724 _foamSource $WM_THIRD_PARTY_DIR/packages/hwloc-1.10.1/platforms/$WM_OPTIONS/etc/hwloc-1.10.1.sh
726 [ -z "$HWLOC_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_HWLOC_172 ] && [ -e $WM_THIRD_PARTY_DIR/packages/hwloc-1.7.2/platforms/$WM_OPTIONS ] && {
727 _foamSource $WM_THIRD_PARTY_DIR/packages/hwloc-1.7.2/platforms/$WM_OPTIONS/etc/hwloc-1.7.2.sh
729 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " HWLOC_DIR is initialized to: $HWLOC_DIR"
731 # Load QT
732 # ~~~~~~~
733 [ ! -z "$QT_THIRD_PARTY" ] && [ ! -z $WM_THIRD_PARTY_USE_QT_486 ] && [ -e $WM_THIRD_PARTY_DIR/packages/qt-everywhere-opensource-src-4.8.6/platforms/$WM_OPTIONS ] && {
734 _foamSource $WM_THIRD_PARTY_DIR/packages/qt-everywhere-opensource-src-4.8.6/platforms/$WM_OPTIONS/etc/qt-everywhere-opensource-src-4.8.6.sh
736 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " QT_DIR is initialized to: $QT_DIR"
739 # Load ParaView
740 # ~~~~~~~~~~~~~
741 [ -z "$PARAVIEW_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_PARAVIEW_431 ] && [ -e $WM_THIRD_PARTY_DIR/packages/ParaView-4.3.1/platforms/$WM_OPTIONS ] && {
742 _foamSource $WM_THIRD_PARTY_DIR/packages/ParaView-4.3.1/platforms/$WM_OPTIONS/etc/ParaView-4.3.1.sh
744 [ -z "$PARAVIEW_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_PARAVIEW_410 ] && [ -e $WM_THIRD_PARTY_DIR/packages/ParaView-4.1.0/platforms/$WM_OPTIONS ] && {
745 _foamSource $WM_THIRD_PARTY_DIR/packages/ParaView-4.1.0/platforms/$WM_OPTIONS/etc/ParaView-4.1.0.sh
747 [ -z "$PARAVIEW_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_PARAVIEW_401 ] && [ -e $WM_THIRD_PARTY_DIR/packages/ParaView-4.0.1/platforms/$WM_OPTIONS ] && {
748 _foamSource $WM_THIRD_PARTY_DIR/packages/ParaView-4.0.1/platforms/$WM_OPTIONS/etc/ParaView-4.0.1.sh
750 [ -z "$PARAVIEW_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_PARAVIEW_3141 ] && [ -e $WM_THIRD_PARTY_DIR/packages/ParaView-3.14.1/platforms/$WM_OPTIONS ] && {
751 _foamSource $WM_THIRD_PARTY_DIR/packages/ParaView-3.14.1/platforms/$WM_OPTIONS/etc/ParaView-3.14.1.sh
753 [ -z "$PARAVIEW_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_PARAVIEW_381 ] && [ -e $WM_THIRD_PARTY_DIR/packages/ParaView-3.8.1/platforms/$WM_OPTIONS ] && {
754 _foamSource $WM_THIRD_PARTY_DIR/packages/ParaView-3.8.1/platforms/$WM_OPTIONS/etc/ParaView-3.8.1.sh
756 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " PARAVIEW_DIR is initialized to: $PARAVIEW_DIR"
759 # Load llvm
760 # ~~~~~~~~~~~~~~~~~~~~~~
761 [ -z "$LLVM_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_LLVM_360 ] && [ -e $WM_THIRD_PARTY_DIR/packages/llvm-3.6.0/platforms/$WM_OPTIONS ] && {
762 _foamSource $WM_THIRD_PARTY_DIR/packages/llvm-3.6.0/platforms/$WM_OPTIONS/etc/llvm-3.6.0.sh
764 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " LLVM_DIR is initialized to: $LLVM_DIR"
766 # Load mesa
767 # ~~~~~~~~~~~~~~~~~~~~~~
768 [ -z "$MESA_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_MESA_GIT ] && [ -e $WM_THIRD_PARTY_DIR/packages/mesa-git/platforms/$WM_OPTIONS ] && {
769 _foamSource $WM_THIRD_PARTY_DIR/packages/mesa-git/platforms/$WM_OPTIONS/etc/mesa-git.sh
771 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " MESA_DIR is initialized to: $MESA_DIR"
774 # cleanup environment:
775 # ~~~~~~~~~~~~~~~~~~~~
776 unset _foamAddPath _foamAddLib minBufferSize
778 # -----------------------------------------------------------------------------