Merge branch 'master' of github.com:OpenCFD/OpenFOAM-1.7.x
[OpenFOAM-1.7.x.git] / etc / settings.sh
blob52b30443dbba4dd124f933287669fd4bdc048a3c
1 #----------------------------------*-sh-*--------------------------------------
2 # ========= |
3 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 # \\ / O peration |
5 # \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6 # \\/ M anipulation |
7 #------------------------------------------------------------------------------
8 # License
9 # This file is part of OpenFOAM.
11 # OpenFOAM is free software: you can redistribute it and/or modify it
12 # under the terms of the GNU General Public License as published by
13 # the Free Software Foundation, either version 3 of the License, or
14 # (at your option) any later version.
16 # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 # for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 # File
25 # etc/settings.sh
27 # Description
28 # Startup file for OpenFOAM
29 # Sourced from OpenFOAM-??/etc/bashrc
31 #------------------------------------------------------------------------------
33 # prefix to PATH
34 _foamAddPath()
36 while [ $# -ge 1 ]
38 export PATH=$1:$PATH
39 shift
40 done
43 # prefix to LD_LIBRARY_PATH
44 _foamAddLib()
46 while [ $# -ge 1 ]
48 export LD_LIBRARY_PATH=$1:$LD_LIBRARY_PATH
49 shift
50 done
53 # prefix to MANPATH
54 _foamAddMan()
56 while [ $# -ge 1 ]
58 export MANPATH=$1:$MANPATH
59 shift
60 done
64 # location of the jobControl directory
65 export FOAM_JOB_DIR=$WM_PROJECT_INST_DIR/jobControl
67 # wmake configuration
68 export WM_DIR=$WM_PROJECT_DIR/wmake
69 export WM_LINK_LANGUAGE=c++
70 export WM_OPTIONS=$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_COMPILE_OPTION
72 # base configuration
73 export FOAM_APP=$WM_PROJECT_DIR/applications
74 export FOAM_APPBIN=$WM_PROJECT_DIR/applications/bin/$WM_OPTIONS
75 export FOAM_LIB=$WM_PROJECT_DIR/lib
76 export FOAM_LIBBIN=$WM_PROJECT_DIR/lib/$WM_OPTIONS
77 export FOAM_SRC=$WM_PROJECT_DIR/src
79 # shared site configuration - similar naming convention as ~OpenFOAM expansion
80 export FOAM_SITE_APPBIN=$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/bin/$WM_OPTIONS
81 export FOAM_SITE_LIBBIN=$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/lib/$WM_OPTIONS
83 # user configuration
84 export FOAM_USER_APPBIN=$WM_PROJECT_USER_DIR/applications/bin/$WM_OPTIONS
85 export FOAM_USER_LIBBIN=$WM_PROJECT_USER_DIR/lib/$WM_OPTIONS
87 # convenience
88 export FOAM_TUTORIALS=$WM_PROJECT_DIR/tutorials
89 export FOAM_UTILITIES=$FOAM_APP/utilities
90 export FOAM_SOLVERS=$FOAM_APP/solvers
91 export FOAM_RUN=$WM_PROJECT_USER_DIR/run
93 # add OpenFOAM scripts and wmake to the path
94 export PATH=$WM_DIR:$WM_PROJECT_DIR/bin:$PATH
96 _foamAddPath $FOAM_USER_APPBIN:$FOAM_SITE_APPBIN:$FOAM_APPBIN
97 # Make sure to pick up dummy versions of external libraries last
98 _foamAddLib $FOAM_USER_LIBBIN:$FOAM_SITE_LIBBIN:$FOAM_LIBBIN:$FOAM_LIBBIN/dummy
100 # Compiler settings
101 # ~~~~~~~~~~~~~~~~~
102 unset gcc_version gmp_version mpfr_version mpc_version
103 unset MPFR_ARCH_PATH
105 # Select compiler installation
106 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
107 # compilerInstall = OpenFOAM | system
108 : ${compilerInstall:=system}
110 case "${compilerInstall:-OpenFOAM}" in
111 OpenFOAM)
112 case "$WM_COMPILER" in
113 Gcc)
114 gcc_version=gcc-4.4.3
115 gmp_version=gmp-5.0.1
116 mpfr_version=mpfr-2.4.2
118 Gcc45)
119 gcc_version=gcc-4.5.0
120 gmp_version=gmp-5.0.1
121 mpfr_version=mpfr-2.4.2
122 mpc_version=mpc-0.8.1
124 Gcc44)
125 gcc_version=gcc-4.4.3
126 gmp_version=gmp-5.0.1
127 mpfr_version=mpfr-2.4.2
129 Gcc43)
130 gcc_version=gcc-4.3.3
131 gmp_version=gmp-4.2.4
132 mpfr_version=mpfr-2.4.1
135 echo
136 echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:"
137 echo " Unknown OpenFOAM compiler type '$WM_COMPILER'"
138 echo " Please check your settings"
139 echo
141 esac
143 if [ -n "$gcc_version" ]
144 then
145 gccDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gcc_version
146 gmpDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gmp_version
147 mpfrDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpfr_version
148 mpcDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpc_version
150 # Check that the compiler directory can be found
151 [ -d "$gccDir" ] || {
152 echo
153 echo "Warning in $WM_PROJECT_DIR/etc/settings.sh:"
154 echo " Cannot find $gccDir installation."
155 echo " Please install this compiler version or if you wish to use the system compiler,"
156 echo " change the 'compilerInstall' setting to 'system' in this file"
157 echo
160 _foamAddMan $gccDir/man
161 _foamAddPath $gccDir/bin
163 # 64-bit needs lib64, but 32-bit needs lib (not lib32)
164 if [ "$WM_ARCH_OPTION" = 64 ]
165 then
166 _foamAddLib $gccDir/lib$WM_COMPILER_LIB_ARCH
167 else
168 _foamAddLib $gccDir/lib
171 # add in gmp/mpfr libraries
172 _foamAddLib $gmpDir/lib
173 _foamAddLib $mpfrDir/lib
175 # add in mpc libraries (not need for older gcc)
176 if [ -n "$mpc_version" ]
177 then
178 _foamAddLib $mpcDir/lib
181 # used by boost/CGAL:
182 export MPFR_ARCH_PATH=$mpfrDir
184 unset gcc_version gccDir
185 unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir
187 esac
190 # boost and CGAL
191 # ~~~~~~~~~~~~~~
193 boost_version=boost_1_42_0
194 cgal_version=CGAL-3.5.1
196 export BOOST_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$boost_version
197 export CGAL_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cgal_version
199 # enabled if CGAL is available
200 if [ -d "$CGAL_ARCH_PATH" ]
201 then
202 if [ -d "$BOOST_ARCH_PATH" ]
203 then
204 _foamAddLib $BOOST_ARCH_PATH/lib
205 else
206 unset BOOST_ARCH_PATH
208 _foamAddLib $CGAL_ARCH_PATH/lib
209 else
210 unset BOOST_ARCH_PATH CGAL_ARCH_PATH MPFR_ARCH_PATH
213 unset boost_version cgal_version
216 # Communications library
217 # ~~~~~~~~~~~~~~~~~~~~~~
219 unset MPI_ARCH_PATH MPI_HOME
221 case "$WM_MPLIB" in
222 OPENMPI)
223 mpi_version=openmpi-1.4.1
224 export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$mpi_version
226 # Tell OpenMPI where to find its install directory
227 export OPAL_PREFIX=$MPI_ARCH_PATH
229 _foamAddPath $MPI_ARCH_PATH/bin
230 _foamAddLib $MPI_ARCH_PATH/lib
231 _foamAddMan $MPI_ARCH_PATH/man
233 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version
234 unset mpi_version
237 SYSTEMOPENMPI)
238 # use the system installed openmpi, get library directory via mpicc
239 mpi_version=openmpi-system
241 # Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI
242 export PINC="`mpicc --showme:compile`"
243 export PLIBS="`mpicc --showme:link`"
244 libDir=`echo "$PLIBS" | sed -e 's/.*-L\([^ ]*\).*/\1/'`
246 if [ "$FOAM_VERBOSE" -a "$PS1" ]
247 then
248 echo "Using system installed MPI:"
249 echo " compile flags : $PINC"
250 echo " link flags : $PLIBS"
251 echo " libmpi dir : $libDir"
254 _foamAddLib $libDir
256 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version
257 unset mpi_version libDir
260 MPICH)
261 mpi_version=mpich2-1.1.1p1
262 export MPI_HOME=$WM_THIRD_PARTY_DIR/$mpi_version
263 export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$mpi_version
265 _foamAddPath $MPI_ARCH_PATH/bin
266 _foamAddLib $MPI_ARCH_PATH/lib
267 _foamAddMan $MPI_ARCH_PATH/share/man
269 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/$mpi_version
270 unset mpi_version
273 MPICH-GM)
274 export MPI_ARCH_PATH=/opt/mpi
275 export MPICH_PATH=$MPI_ARCH_PATH
276 export GM_LIB_PATH=/opt/gm/lib64
278 _foamAddPath $MPI_ARCH_PATH/bin
279 _foamAddLib $MPI_ARCH_PATH/lib
280 _foamAddLib $GM_LIB_PATH
282 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/mpich-gm
285 HPMPI)
286 export MPI_HOME=/opt/hpmpi
287 export MPI_ARCH_PATH=$MPI_HOME
289 _foamAddPath $MPI_ARCH_PATH/bin
291 case `uname -m` in
292 i686)
293 _foamAddLib $MPI_ARCH_PATH/lib/linux_ia32
296 x86_64)
297 _foamAddLib $MPI_ARCH_PATH/lib/linux_amd64
299 ia64)
300 _foamAddLib $MPI_ARCH_PATH/lib/linux_ia64
303 echo Unknown processor type `uname -m` for Linux
305 esac
307 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/hpmpi
310 MPI)
311 export MPI_ARCH_PATH=/opt/mpi
312 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/mpi
315 FJMPI)
316 export MPI_ARCH_PATH=/opt/FJSVmpi2
317 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/mpi
319 _foamAddPath $MPI_ARCH_PATH/bin
320 _foamAddLib $MPI_ARCH_PATH/lib/sparcv9
321 _foamAddLib /opt/FSUNf90/lib/sparcv9
322 _foamAddLib /opt/FJSVpnidt/lib
325 QSMPI)
326 export MPI_ARCH_PATH=/usr/lib/mpi
327 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/qsmpi
329 _foamAddPath $MPI_ARCH_PATH/bin
330 _foamAddLib $MPI_ARCH_PATH/lib
335 export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/dummy
337 esac
339 _foamAddLib $FOAM_MPI_LIBBIN
342 # Set the minimum MPI buffer size (used by all platforms except SGI MPI)
343 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
344 : ${minBufferSize:=20000000}
346 if [ "${MPI_BUFFER_SIZE:=$minBufferSize}" -lt $minBufferSize ]
347 then
348 MPI_BUFFER_SIZE=$minBufferSize
350 export MPI_BUFFER_SIZE
353 # Enable the hoard memory allocator if available
354 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
355 #if [ -f $FOAM_LIBBIN/libhoard.so ]
356 #then
357 # export LD_PRELOAD=$FOAM_LIBBIN/libhoard.so:$LD_PRELOAD
361 # cleanup environment:
362 # ~~~~~~~~~~~~~~~~~~~~
363 unset _foamAddPath _foamAddLib _foamAddMan compilerInstall minBufferSize
365 # ----------------------------------------------------------------- end-of-file