BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / etc / config / settings.sh
blob139e12f6dfccc8cc9dc8893d2af0f4737683a08b
1 #----------------------------------*-sh-*--------------------------------------
2 # ========= |
3 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 # \\ / O peration |
5 # \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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/config/settings.sh
27 # Description
28 # Startup file for OpenFOAM
29 # Sourced from OpenFOAM-<VERSION>/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
63 #------------------------------------------------------------------------------
64 # Set environment variables according to system type
65 export WM_ARCH=`uname -s`
67 case "$WM_ARCH" in
68 Linux)
69 WM_ARCH=linux
71 # compiler specifics
72 case `uname -m` in
73 i686)
76 x86_64)
77 case "$WM_ARCH_OPTION" in
78 32)
79 export WM_COMPILER_ARCH=64
80 export WM_CC='gcc'
81 export WM_CXX='g++'
82 export WM_CFLAGS='-m32 -fPIC'
83 export WM_CXXFLAGS='-m32 -fPIC'
84 export WM_LDFLAGS='-m32'
86 64)
87 WM_ARCH=linux64
88 export WM_COMPILER_LIB_ARCH=64
89 export WM_CC='gcc'
90 export WM_CXX='g++'
91 export WM_CFLAGS='-m64 -fPIC'
92 export WM_CXXFLAGS='-m64 -fPIC'
93 export WM_LDFLAGS='-m64'
96 echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32 or 64"
98 esac
101 ia64)
102 WM_ARCH=linuxIA64
103 export WM_COMPILER=I64
106 mips64)
107 WM_ARCH=SiCortex64
108 WM_MPLIB=MPI
109 export WM_COMPILER_LIB_ARCH=64
110 export WM_CC='gcc'
111 export WM_CXX='g++'
112 export WM_CFLAGS='-mabi=64 -fPIC'
113 export WM_CXXFLAGS='-mabi=64 -fPIC'
114 export WM_LDFLAGS='-mabi=64 -G0'
117 ppc64)
118 WM_ARCH=linuxPPC64
119 export WM_COMPILER_LIB_ARCH=64
120 export WM_CC='gcc'
121 export WM_CXX='g++'
122 export WM_CFLAGS='-m64 -fPIC'
123 export WM_CXXFLAGS='-m64 -fPIC'
124 export WM_LDFLAGS='-m64'
128 echo Unknown processor type `uname -m` for Linux
130 esac
133 SunOS)
134 WM_ARCH=SunOS64
135 WM_MPLIB=FJMPI
136 export WM_COMPILER_LIB_ARCH=64
137 export WM_CC='gcc'
138 export WM_CXX='g++'
139 export WM_CFLAGS='-mabi=64 -fPIC'
140 export WM_CXXFLAGS='-mabi=64 -fPIC'
141 export WM_LDFLAGS='-mabi=64 -G0'
144 *) # an unsupported operating system
145 cat <<USAGE
147 Your "$WM_ARCH" operating system is not supported by this release
148 of OpenFOAM. For further assistance, please contact www.OpenFOAM.org
150 USAGE
152 esac
155 #------------------------------------------------------------------------------
157 # location of the jobControl directory
158 export FOAM_JOB_DIR=$WM_PROJECT_INST_DIR/jobControl
160 # wmake configuration
161 export WM_DIR=$WM_PROJECT_DIR/wmake
162 export WM_LINK_LANGUAGE=c++
163 export WM_OPTIONS=$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_COMPILE_OPTION
165 # base executables/libraries
166 export FOAM_APPBIN=$WM_PROJECT_DIR/platforms/$WM_OPTIONS/bin
167 export FOAM_LIBBIN=$WM_PROJECT_DIR/platforms/$WM_OPTIONS/lib
169 # external (ThirdParty) libraries
170 export FOAM_EXT_LIBBIN=$WM_THIRD_PARTY_DIR/platforms/$WM_OPTIONS/lib
172 # shared site executables/libraries
173 # similar naming convention as ~OpenFOAM expansion
174 if [ -n "$WM_PROJECT_SITE" ]
175 then
176 export FOAM_SITE_APPBIN=$WM_PROJECT_SITE/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin
177 export FOAM_SITE_LIBBIN=$WM_PROJECT_SITE/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib
178 else
179 export FOAM_SITE_APPBIN=$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin
180 export FOAM_SITE_LIBBIN=$WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib
183 # user executables/libraries
184 export FOAM_USER_APPBIN=$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/bin
185 export FOAM_USER_LIBBIN=$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/lib
187 # dynamicCode templates
188 # - default location is the "~OpenFOAM/codeTemplates/dynamicCode" expansion
189 # export FOAM_CODE_TEMPLATES=$WM_PROJECT_DIR/etc/codeTemplates/dynamicCode
191 # convenience
192 export FOAM_APP=$WM_PROJECT_DIR/applications
193 export FOAM_SRC=$WM_PROJECT_DIR/src
194 export FOAM_TUTORIALS=$WM_PROJECT_DIR/tutorials
195 export FOAM_UTILITIES=$FOAM_APP/utilities
196 export FOAM_SOLVERS=$FOAM_APP/solvers
197 export FOAM_RUN=$WM_PROJECT_USER_DIR/run
199 # add wmake to the path - not required for runtime only environment
200 [ -d "$WM_DIR" ] && PATH=$WM_DIR:$PATH
201 # add OpenFOAM scripts to the path
202 export PATH=$WM_PROJECT_DIR/bin:$PATH
204 _foamAddPath $FOAM_USER_APPBIN:$FOAM_SITE_APPBIN:$FOAM_APPBIN
205 # Make sure to pick up dummy versions of external libraries last
206 _foamAddLib $FOAM_USER_LIBBIN:$FOAM_SITE_LIBBIN:$FOAM_LIBBIN:$FOAM_EXT_LIBBIN:$FOAM_LIBBIN/dummy
208 # Compiler settings
209 # ~~~~~~~~~~~~~~~~~
210 unset gcc_version gmp_version mpfr_version mpc_version
211 unset MPFR_ARCH_PATH GMP_ARCH_PATH
213 # Location of compiler installation
214 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
215 if [ -z "$foamCompiler" ]
216 then
217 foamCompiler=system
218 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
219 echo " foamCompiler not set, using '$foamCompiler'" 1>&2
222 case "${foamCompiler}" in
223 OpenFOAM | ThirdParty)
224 case "$WM_COMPILER" in
225 Gcc | Gcc++0x | Gcc46 | Gcc46++0x)
226 gcc_version=gcc-4.6.1
227 gmp_version=gmp-5.0.1
228 mpfr_version=mpfr-2.4.2
229 mpc_version=mpc-0.8.1
231 Gcc45 | Gcc45++0x)
232 gcc_version=gcc-4.5.2
233 gmp_version=gmp-5.0.1
234 mpfr_version=mpfr-2.4.2
235 mpc_version=mpc-0.8.1
237 Gcc44 | Gcc44++0x)
238 gcc_version=gcc-4.4.3
239 gmp_version=gmp-5.0.1
240 mpfr_version=mpfr-2.4.2
242 Gcc43)
243 gcc_version=gcc-4.3.3
244 gmp_version=gmp-4.2.4
245 mpfr_version=mpfr-2.4.1
247 Clang)
248 # using clang - not gcc
249 export WM_CC='clang'
250 export WM_CXX='clang++'
251 #clang_version=llvm-2.9
252 clang_version=llvm-svn
255 echo
256 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:"
257 echo " Unknown OpenFOAM compiler type '$WM_COMPILER'"
258 echo " Please check your settings"
259 echo
261 esac
263 # optional configuration tweaks:
264 _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/compiler.sh`
266 if [ -n "$gcc_version" ]
267 then
268 gccDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gcc_version
269 gmpDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gmp_version
270 mpfrDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpfr_version
271 mpcDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpc_version
273 # Check that the compiler directory can be found
274 [ -d "$gccDir" ] || {
275 echo
276 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:"
277 echo " Cannot find $gccDir installation."
278 echo " Please install this compiler version or if you wish to use the system compiler,"
279 echo " change the 'foamCompiler' setting to 'system'"
280 echo
283 _foamAddMan $gccDir/man
284 _foamAddPath $gccDir/bin
286 # add compiler libraries to run-time environment
287 # 64-bit needs lib64, but 32-bit needs lib (not lib32)
288 if [ "$WM_ARCH_OPTION" = 64 ]
289 then
290 _foamAddLib $gccDir/lib$WM_COMPILER_LIB_ARCH
291 else
292 _foamAddLib $gccDir/lib
296 # add gmp/mpfr libraries to run-time environment
297 _foamAddLib $gmpDir/lib
298 _foamAddLib $mpfrDir/lib
300 # add mpc libraries (not need for older gcc) to run-time environment
301 if [ -n "$mpc_version" ]
302 then
303 _foamAddLib $mpcDir/lib
306 # used by boost/CGAL:
307 export MPFR_ARCH_PATH=$mpfrDir
308 export GMP_ARCH_PATH=$gmpDir
310 unset gcc_version gccDir
311 unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir
313 if [ -n "$clang_version" ]
314 then
315 clangDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$clang_version
317 # Check that the compiler directory can be found
318 [ -d "$clangDir" ] || {
319 echo
320 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:"
321 echo " Cannot find $clangDir installation."
322 echo " Please install this compiler version or if you wish to use the system compiler,"
323 echo " change the 'foamCompiler' setting to 'system'"
324 echo
327 _foamAddMan $clangDir/share/man
328 _foamAddPath $clangDir/bin
330 unset clang_version clangDir
332 system)
333 # okay, use system compiler
336 echo "Warn: foamCompiler='$foamCompiler' is unsupported" 1>&2
337 echo " treating as 'system' instead" 1>&2
339 esac
343 # add c++0x flags for external programs
345 if [ -n "$WM_CXXFLAGS" ]
346 then
347 case "$WM_COMPILER" in
348 Gcc*++0x)
349 WM_CXXFLAGS="$WM_CXXFLAGS -std=c++0x"
351 esac
355 # boost and CGAL
356 # ~~~~~~~~~~~~~~
358 boost_version=boost_1_45_0
359 cgal_version=CGAL-3.8
361 export BOOST_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$boost_version
362 export CGAL_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cgal_version
364 # enabled if CGAL is available
365 if [ -d "$CGAL_ARCH_PATH" ]
366 then
367 if [ -d "$BOOST_ARCH_PATH" ]
368 then
369 _foamAddLib $BOOST_ARCH_PATH/lib
370 else
371 unset BOOST_ARCH_PATH
373 _foamAddLib $CGAL_ARCH_PATH/lib
374 else
375 unset BOOST_ARCH_PATH CGAL_ARCH_PATH MPFR_ARCH_PATH GMP_ARCH_PATH
378 unset boost_version cgal_version
381 # Communications library
382 # ~~~~~~~~~~~~~~~~~~~~~~
384 unset MPI_ARCH_PATH MPI_HOME FOAM_MPI_LIBBIN
386 case "$WM_MPLIB" in
387 OPENMPI)
388 export FOAM_MPI=openmpi-1.5.3
389 # optional configuration tweaks:
390 _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/openmpi.sh`
392 export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
394 # Tell OpenMPI where to find its install directory
395 export OPAL_PREFIX=$MPI_ARCH_PATH
397 _foamAddPath $MPI_ARCH_PATH/bin
398 _foamAddLib $MPI_ARCH_PATH/lib
399 _foamAddMan $MPI_ARCH_PATH/man
402 SYSTEMOPENMPI)
403 # Use the system installed openmpi, get library directory via mpicc
404 export FOAM_MPI=openmpi-system
406 # Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI
407 export PINC="`mpicc --showme:compile`"
408 export PLIBS="`mpicc --showme:link`"
409 libDir=`echo "$PLIBS" | sed -e 's/.*-L\([^ ]*\).*/\1/'`
411 # Bit of a hack: strip off 'lib' and hope this is the path to openmpi
412 # include files and libraries.
413 export MPI_ARCH_PATH="${libDir%/*}"
415 if [ "$FOAM_VERBOSE" -a "$PS1" ]
416 then
417 echo "Using system installed MPI:"
418 echo " compile flags : $PINC"
419 echo " link flags : $PLIBS"
420 echo " libmpi dir : $libDir"
423 _foamAddLib $libDir
424 unset libDir
427 MPICH)
428 export FOAM_MPI=mpich2-1.1.1p1
429 export MPI_HOME=$WM_THIRD_PARTY_DIR/$FOAM_MPI
430 export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
432 _foamAddPath $MPI_ARCH_PATH/bin
433 _foamAddLib $MPI_ARCH_PATH/lib
434 _foamAddMan $MPI_ARCH_PATH/share/man
437 MPICH-GM)
438 export FOAM_MPI=mpich-gm
439 export MPI_ARCH_PATH=/opt/mpi
440 export MPICH_PATH=$MPI_ARCH_PATH
441 export GM_LIB_PATH=/opt/gm/lib64
443 _foamAddPath $MPI_ARCH_PATH/bin
444 _foamAddLib $MPI_ARCH_PATH/lib
445 _foamAddLib $GM_LIB_PATH
448 HPMPI)
449 export FOAM_MPI=hpmpi
450 export MPI_HOME=/opt/hpmpi
451 export MPI_ARCH_PATH=$MPI_HOME
453 _foamAddPath $MPI_ARCH_PATH/bin
455 case `uname -m` in
456 i686)
457 _foamAddLib $MPI_ARCH_PATH/lib/linux_ia32
460 x86_64)
461 _foamAddLib $MPI_ARCH_PATH/lib/linux_amd64
463 ia64)
464 _foamAddLib $MPI_ARCH_PATH/lib/linux_ia64
467 echo Unknown processor type `uname -m` for Linux
469 esac
472 GAMMA)
473 export FOAM_MPI=gamma
474 export MPI_ARCH_PATH=/usr
477 MPI)
478 export FOAM_MPI=mpi
479 export MPI_ARCH_PATH=/opt/mpi
482 FJMPI)
483 export FOAM_MPI=fjmpi
484 export MPI_ARCH_PATH=/opt/FJSVmpi2
486 _foamAddPath $MPI_ARCH_PATH/bin
487 _foamAddLib $MPI_ARCH_PATH/lib/sparcv9
488 _foamAddLib /opt/FSUNf90/lib/sparcv9
489 _foamAddLib /opt/FJSVpnidt/lib
492 QSMPI)
493 export FOAM_MPI=qsmpi
494 export MPI_ARCH_PATH=/usr/lib/mpi
496 _foamAddPath $MPI_ARCH_PATH/bin
497 _foamAddLib $MPI_ARCH_PATH/lib
500 SGIMPI)
501 lastCharID=$(( ${#MPI_ROOT} - 1 ))
502 if [ "${MPI_ROOT:$lastCharID:1}" == '/' ]
503 then
504 MPI_ROOT=${MPI_ROOT:0:$lastCharID}
507 export FOAM_MPI=${MPI_ROOT##*/}
508 export MPI_ARCH_PATH=$MPI_ROOT
510 if [ ! -d "$MPI_ROOT" -o -z "$MPI_ARCH_PATH" ]
511 then
512 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
513 echo " MPI_ROOT not a valid mpt installation directory or ending in a '/'." 1>&2
514 echo " Please set MPI_ROOT to the mpt installation directory." 1>&2
515 echo " MPI_ROOT currently set to '$MPI_ROOT'" 1>&2
518 if [ "$FOAM_VERBOSE" -a "$PS1" ]
519 then
520 echo "Using SGI MPT:"
521 echo " MPI_ROOT : $MPI_ROOT"
522 echo " FOAM_MPI : $FOAM_MPI"
525 _foamAddPath $MPI_ARCH_PATH/bin
526 _foamAddLib $MPI_ARCH_PATH/lib
530 export FOAM_MPI=dummy
532 esac
534 # add (non-dummy) MPI implementation
535 # dummy MPI already added to LD_LIBRARY_PATH and has no external libraries
536 if [ "$FOAM_MPI" != dummy ]
537 then
538 _foamAddLib $FOAM_LIBBIN/$FOAM_MPI:$FOAM_EXT_LIBBIN/$FOAM_MPI
543 # Set the minimum MPI buffer size (used by all platforms except SGI MPI)
544 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
545 : ${minBufferSize:=20000000}
547 if [ "${MPI_BUFFER_SIZE:=$minBufferSize}" -lt $minBufferSize ]
548 then
549 MPI_BUFFER_SIZE=$minBufferSize
551 export MPI_BUFFER_SIZE
554 # cleanup environment:
555 # ~~~~~~~~~~~~~~~~~~~~
556 unset _foamAddPath _foamAddLib _foamAddMan foamCompiler minBufferSize
558 # ----------------------------------------------------------------- end-of-file