Introducing the FOAM_SITE_DIR environment variable.
[foam-extend-3.2.git] / etc / settings.sh
blob90bce6e96b4e5860d67e83c3de721965b432bd05
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_DIR=$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION
94 export FOAM_SITE_APPBIN=$FOAM_SITE_DIR/bin/$WM_OPTIONS
95 export FOAM_SITE_LIBBIN=$FOAM_SITE_DIR/lib/$WM_OPTIONS
97 # user configuration
98 export FOAM_USER_APPBIN=$WM_PROJECT_USER_DIR/applications/bin/$WM_OPTIONS
99 export FOAM_USER_LIBBIN=$WM_PROJECT_USER_DIR/lib/$WM_OPTIONS
101 # convenience
102 export FOAM_TUTORIALS=$WM_PROJECT_DIR/tutorials
103 export FOAM_UTILITIES=$FOAM_APP/utilities
104 export FOAM_SOLVERS=$FOAM_APP/solvers
105 export FOAM_RUN=$WM_PROJECT_USER_DIR/run
107 # add FOAM scripts and wmake to the path
108 export PATH=$WM_DIR:$WM_PROJECT_DIR/bin:$PATH
110 _foamAddPath $FOAM_APPBIN $FOAM_SITE_APPBIN $FOAM_USER_APPBIN
111 _foamAddLib $FOAM_LIBBIN $FOAM_SITE_LIBBIN $FOAM_USER_LIBBIN
114 # Compiler settings
115 # ~~~~~~~~~~~~~~~~~
116 unset compilerBin compilerLib
118 # Select compiler installation
119 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
120 # compilerInstall = FOAM | System
122 # We can override the value of compilerInstall from prefs.sh
123 : ${compilerInstall:=System}
125 # Or we can force it right here
126 #compilerInstall=FOAM
127 #compilerInstall=System
129 case "${compilerInstall}" in
130 FOAM)
131 case "$WM_COMPILER" in
132 Gcc)
133 export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/packages/gcc-4.6.4/platforms/$WM_OPTIONS
134 _foamSource $WM_THIRD_PARTY_DIR/packages/gmp-5.1.2/platforms/$WM_OPTIONS/etc/gmp-5.1.2.sh
135 _foamSource $WM_THIRD_PARTY_DIR/packages/mpfr-3.1.2/platforms/$WM_OPTIONS/etc/mpfr-3.1.2.sh
136 _foamSource $WM_THIRD_PARTY_DIR/packages/mpc-1.0.1/platforms/$WM_OPTIONS/etc/mpc-1.0.1.sh
137 _foamSource $WM_THIRD_PARTY_DIR/packages/gcc-4.6.4/platforms/$WM_OPTIONS/etc/gcc-4.6.4.sh
139 Gcc49)
140 export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/packages/gcc-4.9.2/platforms/$WM_OPTIONS
141 _foamSource $WM_THIRD_PARTY_DIR/packages/gcc-4.9.2/platforms/$WM_OPTIONS/etc/gcc-4.9.2.sh
143 Gcc48)
144 export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/packages/gcc-4.8.4/platforms/$WM_OPTIONS
145 _foamSource $WM_THIRD_PARTY_DIR/packages/gcc-4.8.4/platforms/$WM_OPTIONS/etc/gcc-4.8.4.sh
147 Gcc47)
148 export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/packages/gcc-4.7.4/platforms/$WM_OPTIONS
149 _foamSource $WM_THIRD_PARTY_DIR/packages/gmp-5.1.2/platforms/$WM_OPTIONS/etc/gmp-5.1.2.sh
150 _foamSource $WM_THIRD_PARTY_DIR/packages/mpfr-3.1.2/platforms/$WM_OPTIONS/etc/mpfr-3.1.2.sh
151 _foamSource $WM_THIRD_PARTY_DIR/packages/mpc-1.0.1/platforms/$WM_OPTIONS/etc/mpc-1.0.1.sh
152 _foamSource $WM_THIRD_PARTY_DIR/packages/gcc-4.7.4/platforms/$WM_OPTIONS/etc/gcc-4.7.4.sh
154 Gcc45)
155 export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/packages/gcc-4.5.1/platforms/$WM_OPTIONS
156 _foamSource $WM_THIRD_PARTY_DIR/packages/gmp-5.0.1/platforms/$WM_OPTIONS/etc/gmp-5.0.1.sh
157 _foamSource $WM_THIRD_PARTY_DIR/packages/mpfr-3.0.1/platforms/$WM_OPTIONS/etc/mpfr-3.0.1.sh
158 _foamSource $WM_THIRD_PARTY_DIR/packages/mpc-0.8.2/platforms/$WM_OPTIONS/etc/mpc-0.8.2.sh
159 _foamSource $WM_THIRD_PARTY_DIR/packages/gcc-4.5.1/platforms/$WM_OPTIONS/etc/gcc-4.5.1.sh
161 Gcc44)
162 export WM_COMPILER_DIR=$WM_THIRD_PARTY_DIR/packages/gcc-4.4.5/platforms/$WM_OPTIONS
163 _foamSource $WM_THIRD_PARTY_DIR/packages/gmp-5.0.1/platforms/$WM_OPTIONS/etc/gmp-5.0.1.sh
164 _foamSource $WM_THIRD_PARTY_DIR/packages/mpfr-3.0.1/platforms/$WM_OPTIONS/etc/mpfr-3.0.1.sh
165 _foamSource $WM_THIRD_PARTY_DIR/packages/gcc-4.4.5/platforms/$WM_OPTIONS/etc/gcc-4.4.5.sh
167 esac
169 # Check that the compiler directory can be found
170 if [ ! -d "$WM_COMPILER_DIR" ]
171 then
172 echo
173 echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:"
174 echo " Cannot find $WM_COMPILER_DIR installation."
175 echo " Please install this compiler version or if you wish to use the system compiler,"
176 echo " change the 'compilerInstall' setting to 'System' in this file"
177 echo
180 compilerBin=$WM_COMPILER_DIR/bin
181 compilerLib=$WM_COMPILER_DIR/lib$WM_COMPILER_LIB_ARCH:$WM_COMPILER_DIR/lib
183 esac
185 if [ -d "$compilerBin" ]
186 then
187 _foamAddPath $compilerBin
188 _foamAddLib $compilerLib
191 unset compilerBin compilerLib compilerInstall
194 if [ -z "$WM_CC" ]
195 then
196 case "$WM_COMPILER" in
197 Gcc*)
198 export WM_CC='gcc'
199 export WM_CXX='g++'
201 Icc)
202 export WM_CC='icc'
203 export WM_CXX='icpc'
205 esac
208 # Communications library
209 # ~~~~~~~~~~~~~~~~~~~~~~
211 unset MPI_ARCH_PATH
212 mpi_version=unknown
213 case "$WM_MPLIB" in
214 OPENMPI)
215 if [ ! -z $WM_THIRD_PARTY_USE_OPENMPI_188 ] && [ -e $WM_THIRD_PARTY_DIR/packages/openmpi-1.8.8/platforms/$WM_OPTIONS ]
216 then
217 mpi_version=openmpi-1.8.8
218 if [ "$FOAM_VERBOSE" -a "$PS1" ]
219 then
220 echo "Using openmpi-1.8.8 from the ThirdParty package: $WM_THIRD_PARTY_DIR/packages/$mpi_version"
222 _foamSource $WM_THIRD_PARTY_DIR/packages/$mpi_version/platforms/$WM_OPTIONS/etc/$mpi_version.sh
224 elif [ ! -z $WM_THIRD_PARTY_USE_OPENMPI_165 ] && [ -e $WM_THIRD_PARTY_DIR/packages/openmpi-1.6.5/platforms/$WM_OPTIONS ]
225 then
226 mpi_version=openmpi-1.6.5
227 if [ "$FOAM_VERBOSE" -a "$PS1" ]
228 then
229 echo "Using openmpi-1.6.5 from the ThirdParty package: $WM_THIRD_PARTY_DIR/packages/$mpi_version"
231 _foamSource $WM_THIRD_PARTY_DIR/packages/$mpi_version/platforms/$WM_OPTIONS/etc/$mpi_version.sh
233 elif [ ! -z $WM_THIRD_PARTY_USE_OPENMPI_143 ] && [ -e $WM_THIRD_PARTY_DIR/packages/openmpi-1.4.3/platforms/$WM_OPTIONS ]
234 then
235 mpi_version=openmpi-1.4.3
236 if [ "$FOAM_VERBOSE" -a "$PS1" ]
237 then
238 echo "Using openmpi-1.4.3 from the ThirdParty package: $WM_THIRD_PARTY_DIR/packages/$mpi_version"
240 _foamSource $WM_THIRD_PARTY_DIR/packages/$mpi_version/platforms/$WM_OPTIONS/etc/$mpi_version.sh
242 elif [ ! -z $WM_THIRD_PARTY_USE_OPENMPI_15 ] && [ -e $WM_THIRD_PARTY_DIR/packages/openmpi-1.5/platforms/$WM_OPTIONS ]
243 then
244 mpi_version=openmpi-1.5
245 if [ "$FOAM_VERBOSE" -a "$PS1" ]
246 then
247 echo "Using openmpi-1.5 from the ThirdParty package: $WM_THIRD_PARTY_DIR/packages/$mpi_version"
249 _foamSource $WM_THIRD_PARTY_DIR/packages/$mpi_version/platforms/$WM_OPTIONS/etc/$mpi_version.sh
252 # On Windows set mpi_version from value defined in bashrc.mingw:
253 if [ "$WM_ARCH_BASE" == "mingw" ]
254 then
255 mpi_version=$MPI_VERSION_MINGW
258 unset mpi_version
261 MACPORTOPENMPI)
262 unset OPAL_PREFIX
264 export FOAM_MPI=openmpi-macport-$WM_MACPORT_MPI_VERSION
266 # Currently not correctly working on MacPorts
267 # libDir=`mpicc-openmpi-$WM_MACPORT_MPI_VERSION --showme:libdirs`
268 libDir=/opt/local/lib/openmpi-$WM_MACPORT_MPI_VERSION
270 _foamAddLib $libDir
271 unset libDir
273 which mpirun >/dev/null
274 if [ $? -ne 0 ]
275 then
276 export WM_MPIRUN_PROG=mpirun-openmpi-$WM_MACPORT_MPI_VERSION
280 MACPORTMPICH)
281 export FOAM_MPI=mpich-macports-$WM_MACPORT_MPI_VERSION
282 export MPI_HOME=$WM_THIRD_PARTY_DIR/$FOAM_MPI
284 libDir=/opt/local/lib/mpich-$WM_MACPORT_MPI_VERSION
286 _foamAddLib $libDir
287 unset libDir
289 which mpirun >/dev/null
290 if [ $? -ne 0 ]
291 then
292 export WM_MPIRUN_PROG=mpirun-mpich-$WM_MACPORT_MPI_VERSION
296 SYSTEMOPENMPI)
297 mpi_version=openmpi-system
299 # make sure not the "old" mpi is used
300 # Not sure if this is necessary anymore.
301 # export OPAL_PREFIX=
303 # Make sure OPENMPI_BIN_DIR is set and valid
304 if [ -n "${OPENMPI_BIN_DIR}" ] && [ -d "${OPENMPI_BIN_DIR}" ]
305 then
306 # User defined value specified for OPENMPI_BIN_DIR
308 # WARNING:
309 # We assume this path specified by $OPENMPI_BIN_DIR is valid
310 # We assume the command mpicc is located somewhere under this path
311 # We assume the file mpi.h is located somewhere under this path
313 # Otherwise, please double check your openmpi installation, you are
314 # probably missing the openmpi runtime and/or development packages
315 # available for your system.
317 _foamAddPath $OPENMPI_BIN_DIR
318 else
319 # Here, we assume your environment is already set for running
320 # and developping with openmpi.
322 # Initialize OPENMPI_BIN_DIR using the path to mpicc
323 export OPENMPI_BIN_DIR=$(dirname `which mpicc`)
326 # Make sure OPENMPI_LIB_DIR is set
327 if [ ! -n "${OPENMPI_LIB_DIR}" ]
328 then
329 # Initialize OPENMPI_LIB_DIR using the path to mpicc
330 export OPENMPI_LIB_DIR="`mpicc --showme:libdirs`"
333 # Make sure the dynamic libraries are accessible
334 [ -n "${OPENMPI_LIB_DIR}" ] && _foamAddLib $OPENMPI_LIB_DIR
336 export MPI_HOME=`dirname $OPENMPI_BIN_DIR`
337 export MPI_ARCH_PATH=$MPI_HOME
338 export OPAL_PREFIX=$MPI_ARCH_PATH
340 # We initialize the rest of the environment using mpicc --showme:
341 [ ! -n "${OPENMPI_INCLUDE_DIR}" ] && export OPENMPI_INCLUDE_DIR="`mpicc --showme:incdirs`"
342 [ ! -n "${OPENMPI_COMPILE_FLAGS}" ] && export OPENMPI_COMPILE_FLAGS="`mpicc --showme:compile`"
343 [ ! -n "${OPENMPI_LINK_FLAGS}" ] && export OPENMPI_LINK_FLAGS="`mpicc --showme:link`"
346 # WARNING: We assume the file mpi.h will be available under the directories identified
347 # by the variable $OPENMPI_INCLUDE_DIR. Otherwise, please double check your
348 # system openmpi installation.
350 # Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI
351 export PINC="${OPENMPI_COMPILE_FLAGS}"
352 export PLIBS="${OPENMPI_LINK_FLAGS}"
354 # No longer needed, but we keep this as a reference, just in case...
355 #libDir=`echo "$PLIBS" | sed -e 's/.*-L\([^ ]*\).*/\1/'`
356 #_foamAddLib $libDir
358 if [ "$FOAM_VERBOSE" -a "$PS1" ]
359 then
360 echo " Environment variables defined for OpenMPI:"
361 echo " OPENMPI_BIN_DIR : $OPENMPI_BIN_DIR"
362 echo " OPENMPI_LIB_DIR : $OPENMPI_LIB_DIR"
363 echo " OPENMPI_INCLUDE_DIR : $OPENMPI_INCLUDE_DIR"
364 echo " OPENMPI_COMPILE_FLAGS : $OPENMPI_COMPILE_FLAGS"
365 echo " OPENMPI_LINK_FLAGS : $OPENMPI_LINK_FLAGS"
366 echo ""
367 echo " MPI_HOME : $MPI_HOME"
368 echo " MPI_ARCH_PATH : $MPI_ARCH_PATH"
369 echo " OPAL_PREFIX : $OPAL_PREFIX"
370 echo " PINC : $PINC"
371 echo " PLIBS : $PLIBS"
374 unset mpi_version
377 MVAPICH2)
378 mpi_version=mvapich2
380 if [ -n "${MVAPICH2_BIN_DIR}" ] && [ -d "${MVAPICH2_BIN_DIR}" ]
381 then
382 _foamAddPath $MVAPICH2_BIN_DIR
383 else
384 MVAPICH2_BIN_DIR=$(dirname `which mpicc`)
387 if which mpicc >/dev/null
388 then
389 mpicc -v 2>/dev/null | grep -q "mpicc for MVAPICH2" ||
390 echo "Warning: `which mpicc` does not appear to be for MVAPICH2"
391 else
392 echo "Warning: mpicc not available"
395 export MPI_HOME=`dirname $MVAPICH2_BIN_DIR`
396 export MPI_ARCH_PATH=$MPI_HOME
398 export PINC="`mpicc -show -cc= -nativelinking`"
399 export PLIBS="`mpicc -show -cc= | sed "s%$PINC%%"`"
401 if [ "$FOAM_VERBOSE" -a "$PS1" ]
402 then
403 echo " Environment variables defined for MVAPICH2:"
404 echo " MPI_ARCH_PATH : $MPI_ARCH_PATH"
405 echo " PINC : $PINC"
406 echo " PLIBS : $PLIBS"
409 unset mpi_version
412 MPICH)
413 mpi_version=mpich-1.2.4
414 export MPI_HOME=$WM_THIRD_PARTY_DIR/$mpi_version
415 export MPI_ARCH_PATH=$MPI_HOME/platforms/$WM_OPTIONS
416 export MPICH_ROOT=$MPI_ARCH_PATH
418 _foamAddPath $MPI_ARCH_PATH/bin
419 _foamAddLib $MPI_ARCH_PATH/lib
421 unset mpi_version
424 MPICH-GM)
425 export MPI_ARCH_PATH=/opt/mpi
426 export MPICH_PATH=$MPI_ARCH_PATH
427 export MPICH_ROOT=$MPI_ARCH_PATH
428 export GM_LIB_PATH=/opt/gm/lib64
430 _foamAddPath $MPI_ARCH_PATH/bin
431 _foamAddLib $MPI_ARCH_PATH/lib
432 _foamAddLib $GM_LIB_PATH
436 HPMPI)
437 export MPI_HOME=/opt/hpmpi
438 export MPI_ARCH_PATH=$MPI_HOME
439 export MPICH_ROOT=$MPI_ARCH_PATH
441 _foamAddPath $MPI_ARCH_PATH/bin
443 case `uname -m` in
444 i686)
445 _foamAddLib $MPI_ARCH_PATH/lib/linux_ia32
448 x86_64)
449 _foamAddLib $MPI_ARCH_PATH/lib/linux_amd64
451 ia64)
452 _foamAddLib $MPI_ARCH_PATH/lib/linux_ia64
455 echo Unknown processor type `uname -m` for Linux
457 esac
461 GAMMA)
462 export MPI_ARCH_PATH=/usr
465 MPI)
466 export MPI_ARCH_PATH=/opt/mpi
469 FJMPI)
470 export MPI_ARCH_PATH=/opt/FJSVmpi2
472 _foamAddPath $MPI_ARCH_PATH/bin
473 _foamAddLib $MPI_ARCH_PATH/lib/sparcv9
474 _foamAddLib /opt/FSUNf90/lib/sparcv9
475 _foamAddLib /opt/FJSVpnidt/lib
478 QSMPI)
479 export MPI_ARCH_PATH=/usr/lib/mpi
481 _foamAddPath $MPI_ARCH_PATH/bin
482 _foamAddLib $MPI_ARCH_PATH/lib
485 SGIMPI)
486 # no trailing slash
487 [ "${MPI_ROOT%/}" = "${MPI_ROOT}" ] || MPI_ROOT="${MPI_ROOT%/}"
489 export FOAM_MPI="${MPI_ROOT##*/}"
490 export MPI_ARCH_PATH=$MPI_ROOT
492 if [ ! -d "$MPI_ROOT" -o -z "$MPI_ARCH_PATH" ]
493 then
494 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
495 echo " MPI_ROOT not a valid mpt installation directory or ending" \
496 " in a '/'." 1>&2
497 echo " Please set MPI_ROOT to the mpt installation directory." 1>&2
498 echo " MPI_ROOT currently set to '$MPI_ROOT'" 1>&2
501 if [ "$FOAM_VERBOSE" -a "$PS1" ]
502 then
503 echo "Using SGI MPT:" 1>&2
504 echo " MPI_ROOT : $MPI_ROOT" 1>&2
505 echo " FOAM_MPI : $FOAM_MPI" 1>&2
508 _foamAddPath $MPI_ARCH_PATH/bin
509 _foamAddLib $MPI_ARCH_PATH/lib
511 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/sgimpi
514 INTELMPI)
515 # no trailing slash
516 [ "${MPI_ROOT%/}" = "${MPI_ROOT}" ] || MPI_ROOT="${MPI_ROOT%/}"
518 export FOAM_MPI="${MPI_ROOT##*/}"
519 export MPI_ARCH_PATH=$MPI_ROOT
521 if [ ! -d "$MPI_ROOT" -o -z "$MPI_ARCH_PATH" ]
522 then
523 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
524 echo " MPI_ROOT not a valid mpt installation directory or ending" \
525 " in a '/'." 1>&2
526 echo " Please set MPI_ROOT to the mpt installation directory." 1>&2
527 echo " MPI_ROOT currently set to '$MPI_ROOT'" 1>&2
530 if [ "$FOAM_VERBOSE" -a "$PS1" ]
531 then
532 echo "Using INTEL MPI:" 1>&2
533 echo " MPI_ROOT : $MPI_ROOT" 1>&2
534 echo " FOAM_MPI : $FOAM_MPI" 1>&2
537 _foamAddPath $MPI_ARCH_PATH/intel64/bin
538 _foamAddLib $MPI_ARCH_PATH/intel64/lib
540 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/intelmpi
545 esac
547 # Removed $FOAM_MPI_LIBBIN. HJ, 8/Aug/2015
550 # Set the minimum MPI buffer size (used by all platforms except SGI MPI)
551 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
552 minBufferSize=20000000
554 if [ "${MPI_BUFFER_SIZE:=$minBufferSize}" -lt $minBufferSize ]
555 then
556 MPI_BUFFER_SIZE=$minBufferSize
558 export MPI_BUFFER_SIZE
561 # CUDA if available
562 # ~~~~~~~~~~~~~~~~~
563 [ -z "$CUDA_SYSTEM" ] && [ -e /usr/local/cuda-5.5/bin/nvcc ] && {
564 export CUDA_DIR=/usr/local/cuda-5.5
565 export CUDA_BIN_DIR=$CUDA_DIR/bin
566 export CUDA_LIB_DIR=$CUDA_DIR/lib64
567 export CUDA_INCLUDE_DIR=$CUDA_DIR/include
570 [ -d "$CUDA_LIB_DIR" ] && _foamAddPath $CUDA_BIN_DIR && _foamAddLib $CUDA_LIB_DIR
573 # CGAL library if available
574 # ~~~~~~~~~~~~~~~~~~~~~~~~~
575 [ -d "$CGAL_LIB_DIR" ] && _foamAddLib $CGAL_LIB_DIR
578 # Switch on the hoard memory allocator if available
579 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
580 #if [ -f $FOAM_LIBBIN/libhoard.so ]
581 #then
582 # export LD_PRELOAD=$FOAM_LIBBIN/libhoard.so:$LD_PRELOAD
585 # HOARD seems to crash Paraview on Mac OS X 10.6
586 #if [ -f $FOAM_LIBBIN/libhoard.dylib ]
587 #then
588 # if [ -z "$DYLD_INSERT_LIBRARIES" ]
589 # then
590 # export DYLD_INSERT_LIBRARIES=$FOAM_LIBBIN/libhoard.dylib
591 # else
592 # export DYLD_INSERT_LIBRARIES=$FOAM_LIBBIN/libhoard.dylib:$DYLD_INSERT_LIBRARIES
593 # fi
597 # Third party packages
599 # In order to use a pre-installed version of the ThirdParty packages, just set the
600 # appropriate XXX_SYSTEM environment variable for a given package in your prefs.sh
601 # file in order to disable the activation of the ThirdParty version of the same package.
603 # Load Mesquite library
604 # ~~~~~~~~~~~~~~~~~~~~~~
605 [ -z "$MESQUITE_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_MESQUITE_212 ] && [ -e $WM_THIRD_PARTY_DIR/packages/mesquite-2.1.2/platforms/$WM_OPTIONS ] && {
606 _foamSource $WM_THIRD_PARTY_DIR/packages/mesquite-2.1.2/platforms/$WM_OPTIONS/etc/mesquite-2.1.2.sh
608 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " MESQUITE_DIR is initialized to: $MESQUITE_DIR"
611 # Load Metis library
612 # ~~~~~~~~~~~~~~~~~~
613 [ -z "$METIS_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_METIS_510 ] && [ -e $WM_THIRD_PARTY_DIR/packages/metis-5.1.0/platforms/$WM_OPTIONS ] && {
614 _foamSource $WM_THIRD_PARTY_DIR/packages/metis-5.1.0/platforms/$WM_OPTIONS/etc/metis-5.1.0.sh
616 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " METIS_DIR is initialized to: $METIS_DIR"
619 # Load ParMetis library
620 # ~~~~~~~~~~~~~~~~~~~~~
621 [ -z "$PARMETIS_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_PARMETIS_403 ] && [ -e $WM_THIRD_PARTY_DIR/packages/parmetis-4.0.3/platforms/$WM_OPTIONS ] && {
622 _foamSource $WM_THIRD_PARTY_DIR/packages/parmetis-4.0.3/platforms/$WM_OPTIONS/etc/parmetis-4.0.3.sh
624 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " PARMETIS_DIR is initialized to: $PARMETIS_DIR"
627 # Load ParMGridGen library
628 # ~~~~~~~~~~~~~~~~~~~~~~~~~
629 [ -z "$PARMGRIDGEN_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_PARMGRIDGEN_10 ] && [ -e $WM_THIRD_PARTY_DIR/packages/ParMGridGen-1.0/platforms/$WM_OPTIONS ] && {
630 _foamSource $WM_THIRD_PARTY_DIR/packages/ParMGridGen-1.0/platforms/$WM_OPTIONS/etc/ParMGridGen-1.0.sh
632 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " PARMGRIDGEN_DIR is initialized to: $PARMGRIDGEN_DIR"
635 # Load Libccmio library
636 # ~~~~~~~~~~~~~~~~~~~~~
637 [ -z "$LIBCCMIO_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_LIBCCMIO_261 ] && [ -e $WM_THIRD_PARTY_DIR/packages/libccmio-2.6.1/platforms/$WM_OPTIONS ] && {
638 _foamSource $WM_THIRD_PARTY_DIR/packages/libccmio-2.6.1/platforms/$WM_OPTIONS/etc/libccmio-2.6.1.sh
640 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " LIBCCMIO_DIR is initialized to: $LIBCCMIO_DIR"
643 # Load Scotch library
644 # ~~~~~~~~~~~~~~~~~~~
645 [ -z "$SCOTCH_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_SCOTCH_604 ] && [ -e $WM_THIRD_PARTY_DIR/packages/scotch-6.0.4/platforms/$WM_OPTIONS ] && {
646 _foamSource $WM_THIRD_PARTY_DIR/packages/scotch-6.0.4/platforms/$WM_OPTIONS/etc/scotch-6.0.4.sh
648 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " SCOTCH_DIR is initialized to: $SCOTCH_DIR"
650 [ -z "$SCOTCH_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_SCOTCH_600 ] && [ -e $WM_THIRD_PARTY_DIR/packages/scotch-6.0.0/platforms/$WM_OPTIONS ] && {
651 _foamSource $WM_THIRD_PARTY_DIR/packages/scotch-6.0.0/platforms/$WM_OPTIONS/etc/scotch-6.0.0.sh
653 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " SCOTCH_DIR is initialized to: $SCOTCH_DIR"
656 # Load cmake
657 # ~~~~~~~~~~
658 [ -z "$CMAKE_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_CMAKE_322 ] && [ -e $WM_THIRD_PARTY_DIR/packages/cmake-3.2.2/platforms/$WM_OPTIONS ] && {
659 _foamSource $WM_THIRD_PARTY_DIR/packages/cmake-3.2.2/platforms/$WM_OPTIONS/etc/cmake-3.2.2.sh
661 [ -z "$CMAKE_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_CMAKE_2812 ] && [ -e $WM_THIRD_PARTY_DIR/packages/cmake-2.8.12/platforms/$WM_OPTIONS ] && {
662 _foamSource $WM_THIRD_PARTY_DIR/packages/cmake-2.8.12/platforms/$WM_OPTIONS/etc/cmake-2.8.12.sh
664 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " CMAKE_DIR is initialized to: $CMAKE_DIR"
666 # Load m4
667 # ~~~~~~~~~~
668 [ -z "$M4_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_M4_1416 ] && [ -e $WM_THIRD_PARTY_DIR/packages/m4-1.4.16/platforms/$WM_OPTIONS ] && {
669 _foamSource $WM_THIRD_PARTY_DIR/packages/m4-1.4.16/platforms/$WM_OPTIONS/etc/m4-1.4.16.sh
671 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " M4_DIR is initialized to: $M4_DIR"
673 # Load bison
674 # ~~~~~~~~~~
675 [ -z "$BISON_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_BISON_27 ] && [ -e $WM_THIRD_PARTY_DIR/packages/bison-2.7/platforms/$WM_OPTIONS ] && {
676 _foamSource $WM_THIRD_PARTY_DIR/packages/bison-2.7/platforms/$WM_OPTIONS/etc/bison-2.7.sh
678 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " BISON_DIR is initialized to: $BISON_DIR"
680 # Load flex
681 # ~~~~~~~~~~
682 [ -z "$FLEX_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_FLEX_2535 ] && [ -e $WM_THIRD_PARTY_DIR/packages/flex-2.5.35/platforms/$WM_OPTIONS ] && {
683 _foamSource $WM_THIRD_PARTY_DIR/packages/flex-2.5.35/platforms/$WM_OPTIONS/etc/flex-2.5.35.sh
685 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " FLEX_DIR is initialized to: $FLEX_DIR"
688 # Load zoltan
689 # ~~~~~~~~~~
690 [ -z "$ZOLTAN_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_ZOLTAN_36 ] && [ -e $WM_THIRD_PARTY_DIR/packages/zoltan_3.6 ] && {
691 _foamSource $WM_THIRD_PARTY_DIR/packages/zoltan_3.6/platforms/$WM_OPTIONS/etc/zoltan_3.6.sh
693 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " ZOLTAN_DIR is initialized to: $ZOLTAN_DIR"
696 # Load Python
697 # ~~~~~~~~~~~
698 [ -z "$PYTHON_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_PYTHON_27 ] && [ -e $WM_THIRD_PARTY_DIR/packages/Python-2.7/platforms/$WM_OPTIONS ] && {
699 _foamSource $WM_THIRD_PARTY_DIR/packages/Python-2.7/platforms/$WM_OPTIONS/etc/Python-2.7.sh
701 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " PYTHON_DIR is initialized to: $PYTHON_DIR"
703 # Load PyFoam
704 # ~~~~~~~~~~~
705 [ -z "$PYFOAM_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_PYFOAM_063 ] && [ -e $WM_THIRD_PARTY_DIR/packages/PyFoam-0.6.3/platforms/noarch ] && {
706 _foamSource $WM_THIRD_PARTY_DIR/packages/PyFoam-0.6.3/platforms/noarch/etc/PyFoam-0.6.3.sh
708 [ -z "$PYFOAM_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_PYFOAM_064 ] && [ -e $WM_THIRD_PARTY_DIR/packages/PyFoam-0.6.4/platforms/noarch ] && {
709 _foamSource $WM_THIRD_PARTY_DIR/packages/PyFoam-0.6.4/platforms/noarch/etc/PyFoam-0.6.4.sh
711 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " PYFOAM_DIR is initialized to: $PYFOAM_DIR"
713 # Make sure that there is a special directory for special PyFoam-scripts
714 [ -z "$PYFOAM_SITE_DIR" ] && export PYFOAM_SITE_DIR=$WM_THIRD_PARTY_DIR/PyFoamSiteScripts
715 if [ -d $PYFOAM_SITE_DIR/bin ]
716 then
717 _foamAddPath $PYFOAM_SITE_DIR/bin
720 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " PYFOAM_SITE_DIR is initialized to: $PYFOAM_SITE_DIR"
722 # Load hwloc
723 # ~~~~~~~~~~~
724 [ -z "$HWLOC_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_HWLOC_1101 ] && [ -e $WM_THIRD_PARTY_DIR/packages/hwloc-1.10.1/platforms/$WM_OPTIONS ] && {
725 _foamSource $WM_THIRD_PARTY_DIR/packages/hwloc-1.10.1/platforms/$WM_OPTIONS/etc/hwloc-1.10.1.sh
727 [ -z "$HWLOC_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_HWLOC_172 ] && [ -e $WM_THIRD_PARTY_DIR/packages/hwloc-1.7.2/platforms/$WM_OPTIONS ] && {
728 _foamSource $WM_THIRD_PARTY_DIR/packages/hwloc-1.7.2/platforms/$WM_OPTIONS/etc/hwloc-1.7.2.sh
730 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " HWLOC_DIR is initialized to: $HWLOC_DIR"
732 # Load QT
733 # ~~~~~~~
734 [ ! -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 ] && {
735 _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
737 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " QT_DIR is initialized to: $QT_DIR"
740 # Load ParaView
741 # ~~~~~~~~~~~~~
742 [ -z "$PARAVIEW_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_PARAVIEW_431 ] && [ -e $WM_THIRD_PARTY_DIR/packages/ParaView-4.3.1/platforms/$WM_OPTIONS ] && {
743 _foamSource $WM_THIRD_PARTY_DIR/packages/ParaView-4.3.1/platforms/$WM_OPTIONS/etc/ParaView-4.3.1.sh
745 [ -z "$PARAVIEW_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_PARAVIEW_410 ] && [ -e $WM_THIRD_PARTY_DIR/packages/ParaView-4.1.0/platforms/$WM_OPTIONS ] && {
746 _foamSource $WM_THIRD_PARTY_DIR/packages/ParaView-4.1.0/platforms/$WM_OPTIONS/etc/ParaView-4.1.0.sh
748 [ -z "$PARAVIEW_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_PARAVIEW_401 ] && [ -e $WM_THIRD_PARTY_DIR/packages/ParaView-4.0.1/platforms/$WM_OPTIONS ] && {
749 _foamSource $WM_THIRD_PARTY_DIR/packages/ParaView-4.0.1/platforms/$WM_OPTIONS/etc/ParaView-4.0.1.sh
751 [ -z "$PARAVIEW_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_PARAVIEW_3141 ] && [ -e $WM_THIRD_PARTY_DIR/packages/ParaView-3.14.1/platforms/$WM_OPTIONS ] && {
752 _foamSource $WM_THIRD_PARTY_DIR/packages/ParaView-3.14.1/platforms/$WM_OPTIONS/etc/ParaView-3.14.1.sh
754 [ -z "$PARAVIEW_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_PARAVIEW_381 ] && [ -e $WM_THIRD_PARTY_DIR/packages/ParaView-3.8.1/platforms/$WM_OPTIONS ] && {
755 _foamSource $WM_THIRD_PARTY_DIR/packages/ParaView-3.8.1/platforms/$WM_OPTIONS/etc/ParaView-3.8.1.sh
757 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " PARAVIEW_DIR is initialized to: $PARAVIEW_DIR"
760 # Load llvm
761 # ~~~~~~~~~~~~~~~~~~~~~~
762 [ -z "$LLVM_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_LLVM_360 ] && [ -e $WM_THIRD_PARTY_DIR/packages/llvm-3.6.0/platforms/$WM_OPTIONS ] && {
763 _foamSource $WM_THIRD_PARTY_DIR/packages/llvm-3.6.0/platforms/$WM_OPTIONS/etc/llvm-3.6.0.sh
765 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " LLVM_DIR is initialized to: $LLVM_DIR"
767 # Load mesa
768 # ~~~~~~~~~~~~~~~~~~~~~~
769 [ -z "$MESA_SYSTEM" ] && [ ! -z $WM_THIRD_PARTY_USE_MESA_GIT ] && [ -e $WM_THIRD_PARTY_DIR/packages/mesa-git/platforms/$WM_OPTIONS ] && {
770 _foamSource $WM_THIRD_PARTY_DIR/packages/mesa-git/platforms/$WM_OPTIONS/etc/mesa-git.sh
772 [ "$FOAM_VERBOSE" -a "$PS1" ] && echo " MESA_DIR is initialized to: $MESA_DIR"
775 # cleanup environment:
776 # ~~~~~~~~~~~~~~~~~~~~
777 unset _foamAddPath _foamAddLib minBufferSize
779 # -----------------------------------------------------------------------------