Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 596 lines (493 sloc) 16.593 kb
a3c0017 Initial commit for version 2.2.x
OpenFOAM-admin authored
1 #----------------------------------*-sh-*--------------------------------------
2 # ========= |
3 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 # \\ / O peration |
5 # \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
6 # \\/ M anipulation |
7 #------------------------------------------------------------------------------
8 # License
9 # This file is part of OpenFOAM.
10 #
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.
15 #
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.
20 #
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/>.
23 #
24 # File
25 # etc/config/settings.sh
26 #
27 # Description
28 # Startup file for OpenFOAM
29 # Sourced from OpenFOAM-<VERSION>/etc/bashrc
30 #
31 #------------------------------------------------------------------------------
32
33 # prefix to PATH
34 _foamAddPath()
35 {
36 while [ $# -ge 1 ]
37 do
38 export PATH=$1:$PATH
39 shift
40 done
41 }
42
43 # prefix to LD_LIBRARY_PATH
44 _foamAddLib()
45 {
46 while [ $# -ge 1 ]
47 do
48 export LD_LIBRARY_PATH=$1:$LD_LIBRARY_PATH
49 shift
50 done
51 }
52
53 # prefix to MANPATH
54 _foamAddMan()
55 {
56 while [ $# -ge 1 ]
57 do
58 export MANPATH=$1:$MANPATH
59 shift
60 done
61 }
62
63 #------------------------------------------------------------------------------
64 # Set environment variables according to system type
65 export WM_ARCH=`uname -s`
66
67 case "$WM_ARCH" in
68 Linux)
69 WM_ARCH=linux
70
71 # compiler specifics
72 case `uname -m` in
73 i686)
74 ;;
75
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'
85 ;;
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'
94 ;;
95 *)
96 echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32 or 64" 1>&2
97 ;;
98 esac
99 ;;
100
101 ia64)
102 WM_ARCH=linuxIA64
103 export WM_COMPILER=I64
104 ;;
105
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'
115 ;;
116
117 armv7l)
118 WM_ARCH=linuxARM7
119 export WM_COMPILER_LIB_ARCH=32
120 export WM_CC='gcc'
121 export WM_CXX='g++'
122 export WM_CFLAGS='-fPIC'
123 export WM_CXXFLAGS='-fPIC'
124 export WM_LDFLAGS=
125 ;;
126
127 ppc64)
128 WM_ARCH=linuxPPC64
129 export WM_COMPILER_LIB_ARCH=64
130 export WM_CC='gcc'
131 export WM_CXX='g++'
132 export WM_CFLAGS='-m64 -fPIC'
133 export WM_CXXFLAGS='-m64 -fPIC'
134 export WM_LDFLAGS='-m64'
135 ;;
136
137 *)
138 echo Unknown processor type `uname -m` for Linux 1>&2
139 ;;
140 esac
141 ;;
142
143 SunOS)
144 WM_ARCH=SunOS64
145 WM_MPLIB=FJMPI
146 export WM_COMPILER_LIB_ARCH=64
147 export WM_CC='gcc'
148 export WM_CXX='g++'
149 export WM_CFLAGS='-mabi=64 -fPIC'
150 export WM_CXXFLAGS='-mabi=64 -fPIC'
151 export WM_LDFLAGS='-mabi=64 -G0'
152 ;;
153
154 *) # an unsupported operating system
155 /bin/cat <<USAGE 1>&2
156
157 Your "$WM_ARCH" operating system is not supported by this release
158 of OpenFOAM. For further assistance, please contact www.OpenFOAM.org
159
160 USAGE
161 ;;
162 esac
163
164
165 #------------------------------------------------------------------------------
166
167 # location of the jobControl directory
168 export FOAM_JOB_DIR=$WM_PROJECT_INST_DIR/jobControl
169
170 # wmake configuration
171 export WM_DIR=$WM_PROJECT_DIR/wmake
172 export WM_LINK_LANGUAGE=c++
173 export WM_OPTIONS=$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_COMPILE_OPTION
174
175 # base executables/libraries
176 export FOAM_APPBIN=$WM_PROJECT_DIR/platforms/$WM_OPTIONS/bin
177 export FOAM_LIBBIN=$WM_PROJECT_DIR/platforms/$WM_OPTIONS/lib
178
179 # external (ThirdParty) libraries
180 export FOAM_EXT_LIBBIN=$WM_THIRD_PARTY_DIR/platforms/$WM_OPTIONS/lib
181
182 # site-specific directory
183 siteDir="${WM_PROJECT_SITE:-$WM_PROJECT_INST_DIR/site}"
184
185 # shared site executables/libraries
186 # similar naming convention as ~OpenFOAM expansion
187 export FOAM_SITE_APPBIN=$siteDir/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin
188 export FOAM_SITE_LIBBIN=$siteDir/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib
189
190 # user executables/libraries
191 export FOAM_USER_APPBIN=$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/bin
192 export FOAM_USER_LIBBIN=$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/lib
193
194 # dynamicCode templates
195 # - default location is the "~OpenFOAM/codeTemplates/dynamicCode" expansion
196 # export FOAM_CODE_TEMPLATES=$WM_PROJECT_DIR/etc/codeTemplates/dynamicCode
197
198 # convenience
199 export FOAM_APP=$WM_PROJECT_DIR/applications
200 export FOAM_SRC=$WM_PROJECT_DIR/src
201 export FOAM_TUTORIALS=$WM_PROJECT_DIR/tutorials
202 export FOAM_UTILITIES=$FOAM_APP/utilities
203 export FOAM_SOLVERS=$FOAM_APP/solvers
204 export FOAM_RUN=$WM_PROJECT_USER_DIR/run
205
206 # add wmake to the path - not required for runtime only environment
207 [ -d "$WM_DIR" ] && PATH=$WM_DIR:$PATH
208 # add OpenFOAM scripts to the path
209 export PATH=$WM_PROJECT_DIR/bin:$PATH
210
211 # add site-specific scripts to path - only if they exist
212 if [ -d "$siteDir/bin" ] # generic
213 then
214 _foamAddPath "$siteDir/bin"
215 fi
216 if [ -d "$siteDir/$WM_PROJECT_VERSION/bin" ] # version-specific
217 then
218 _foamAddPath "$siteDir/$WM_PROJECT_VERSION/bin"
219 fi
220 unset siteDir
221
222 _foamAddPath $FOAM_USER_APPBIN:$FOAM_SITE_APPBIN:$FOAM_APPBIN
223 # Make sure to pick up dummy versions of external libraries last
224 _foamAddLib $FOAM_USER_LIBBIN:$FOAM_SITE_LIBBIN:$FOAM_LIBBIN:$FOAM_EXT_LIBBIN:$FOAM_LIBBIN/dummy
225
226 # Compiler settings
227 # ~~~~~~~~~~~~~~~~~
228 unset gcc_version gmp_version mpfr_version mpc_version
229 unset MPFR_ARCH_PATH GMP_ARCH_PATH
230
231 # Location of compiler installation
232 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
233 if [ -z "$foamCompiler" ]
234 then
235 foamCompiler=system
236 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
237 echo " foamCompiler not set, using '$foamCompiler'" 1>&2
238 fi
239
240 case "${foamCompiler}" in
241 OpenFOAM | ThirdParty)
242 case "$WM_COMPILER" in
243 Gcc | Gcc++0x | Gcc46 | Gcc46++0x)
244 gcc_version=gcc-4.6.1
245 gmp_version=gmp-5.0.4
246 mpfr_version=mpfr-3.1.0
247 mpc_version=mpc-0.9
248 ;;
249 Gcc47 | Gcc47++0x)
a9d0f04 ENH: Merging some updates from the internal development line
andy authored
250 gcc_version=gcc-4.7.2
a3c0017 Initial commit for version 2.2.x
OpenFOAM-admin authored
251 gmp_version=gmp-5.0.4
252 mpfr_version=mpfr-3.1.0
253 mpc_version=mpc-0.9
254 ;;
255 Gcc45 | Gcc45++0x)
256 gcc_version=gcc-4.5.2
257 gmp_version=gmp-5.0.1
258 mpfr_version=mpfr-2.4.2
259 mpc_version=mpc-0.8.1
260 ;;
261 Clang)
262 # using clang - not gcc
263 export WM_CC='clang'
264 export WM_CXX='clang++'
265 clang_version=llvm-3.1
266 #clang_version=llvm-svn
267 ;;
268 *)
269 echo 1>&2
270 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
271 echo " Unknown OpenFOAM compiler type '$WM_COMPILER'" 1>&2
272 echo " Please check your settings" 1>&2
273 echo 1>&2
274 ;;
275 esac
276
277 # optional configuration tweaks:
278 _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/compiler.sh`
279
280 if [ -n "$gcc_version" ]
281 then
282 gccDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gcc_version
283 gmpDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gmp_version
284 mpfrDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpfr_version
285 mpcDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpc_version
286
287 # Check that the compiler directory can be found
288 [ -d "$gccDir" ] || {
289 echo 1>&2
290 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
291 echo " Cannot find $gccDir installation." 1>&2
292 echo " Please install this compiler version or if you wish to use the system compiler," 1>&2
293 echo " change the 'foamCompiler' setting to 'system'" 1>&2
294 echo
295 }
296
297 _foamAddMan $gccDir/man
298 _foamAddPath $gccDir/bin
299
300 # add compiler libraries to run-time environment
301 _foamAddLib $gccDir/lib$WM_COMPILER_LIB_ARCH
302
303 # add gmp/mpfr libraries to run-time environment
304 _foamAddLib $gmpDir/lib
305 _foamAddLib $mpfrDir/lib
306
307 # add mpc libraries (not need for older gcc) to run-time environment
308 if [ -n "$mpc_version" ]
309 then
310 _foamAddLib $mpcDir/lib
311 fi
312
313 # used by boost/CGAL:
314 export MPFR_ARCH_PATH=$mpfrDir
315 export GMP_ARCH_PATH=$gmpDir
316 fi
317 unset gcc_version gccDir
318 unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir
319
320 if [ -n "$clang_version" ]
321 then
322 clangDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$clang_version
323
324 # Check that the compiler directory can be found
325 [ -d "$clangDir" ] || {
326 echo 1>&2
327 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
328 echo " Cannot find $clangDir installation." 1>&2
329 echo " Please install this compiler version or if you wish to use the system compiler," 1>&2
330 echo " change the 'foamCompiler' setting to 'system'" 1>&2
331 echo 1>&2
332 }
333
334 _foamAddMan $clangDir/share/man
335 _foamAddPath $clangDir/bin
336 fi
337 unset clang_version clangDir
338 ;;
339 system)
340 # okay, use system compiler
341 ;;
342 *)
343 echo "Warn: foamCompiler='$foamCompiler' is unsupported" 1>&2
344 echo " treating as 'system' instead" 1>&2
345 ;;
346 esac
347
348
349 #
350 # add c++0x flags for external programs
351 #
352 if [ -n "$WM_CXXFLAGS" ]
353 then
354 case "$WM_COMPILER" in
355 Gcc*++0x)
356 WM_CXXFLAGS="$WM_CXXFLAGS -std=c++0x"
357 ;;
358 esac
359 fi
360
361
362 # boost and CGAL
363 # ~~~~~~~~~~~~~~
364
365 boost_version=boost_1_45_0
366 cgal_version=CGAL-4.0
367
368 export BOOST_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$boost_version
369 export CGAL_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cgal_version
370
371 # enabled if CGAL is available
372 if [ "$FOAM_VERBOSE" -a "$PS1" ]
373 then
374 echo "Checking for"
375 echo " $cgal_version at $CGAL_ARCH_PATH"
376 echo " $boost_version at $BOOST_ARCH_PATH"
377 fi
378
379 if [ -d "$CGAL_ARCH_PATH" ]
380 then
381 if [ -d "$BOOST_ARCH_PATH" ]
382 then
383 _foamAddLib $BOOST_ARCH_PATH/lib
384 else
385 unset BOOST_ARCH_PATH
386 fi
387 _foamAddLib $CGAL_ARCH_PATH/lib
388 else
389 unset BOOST_ARCH_PATH CGAL_ARCH_PATH MPFR_ARCH_PATH GMP_ARCH_PATH
390 fi
391
392 unset boost_version cgal_version
393
394
395 # Communications library
396 # ~~~~~~~~~~~~~~~~~~~~~~
397
398 unset MPI_ARCH_PATH MPI_HOME FOAM_MPI_LIBBIN
399
400 case "$WM_MPLIB" in
401 SYSTEMOPENMPI)
402 # Use the system installed openmpi, get library directory via mpicc
403 export FOAM_MPI=openmpi-system
404
405 libDir=`mpicc --showme:link | sed -e 's/.*-L\([^ ]*\).*/\1/'`
406
407 # Bit of a hack: strip off 'lib' and hope this is the path to openmpi
408 # include files and libraries.
409 export MPI_ARCH_PATH="${libDir%/*}"
410
411 _foamAddLib $libDir
412 unset libDir
413 ;;
414
415 OPENMPI)
416 export FOAM_MPI=openmpi-1.6.3
417 # optional configuration tweaks:
418 _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/openmpi.sh`
419
420 export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
421
422 # Tell OpenMPI where to find its install directory
423 export OPAL_PREFIX=$MPI_ARCH_PATH
424
425 _foamAddPath $MPI_ARCH_PATH/bin
426
427 # 64-bit on OpenSuSE 12.1 uses lib64 others use lib
428 _foamAddLib $MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
429 _foamAddLib $MPI_ARCH_PATH/lib
430
431 _foamAddMan $MPI_ARCH_PATH/share/man
432 ;;
433
434 MPICH)
435 export FOAM_MPI=mpich2-1.1.1p1
436 export MPI_HOME=$WM_THIRD_PARTY_DIR/$FOAM_MPI
437 export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
438
439 _foamAddPath $MPI_ARCH_PATH/bin
440
441 # 64-bit on OpenSuSE 12.1 uses lib64 others use lib
442 _foamAddLib $MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
443 _foamAddLib $MPI_ARCH_PATH/lib
444
445 _foamAddMan $MPI_ARCH_PATH/share/man
446 ;;
447
448 MPICH-GM)
449 export FOAM_MPI=mpich-gm
450 export MPI_ARCH_PATH=/opt/mpi
451 export MPICH_PATH=$MPI_ARCH_PATH
452 export GM_LIB_PATH=/opt/gm/lib64
453
454 _foamAddPath $MPI_ARCH_PATH/bin
455
456 # 64-bit on OpenSuSE 12.1 uses lib64 others use lib
457 _foamAddLib $MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
458 _foamAddLib $MPI_ARCH_PATH/lib
459
460 _foamAddLib $GM_LIB_PATH
461 ;;
462
463 HPMPI)
464 export FOAM_MPI=hpmpi
465 export MPI_HOME=/opt/hpmpi
466 export MPI_ARCH_PATH=$MPI_HOME
467
468 _foamAddPath $MPI_ARCH_PATH/bin
469
470 case `uname -m` in
471 i686)
472 _foamAddLib $MPI_ARCH_PATH/lib/linux_ia32
473 ;;
474
475 x86_64)
476 _foamAddLib $MPI_ARCH_PATH/lib/linux_amd64
477 ;;
478 ia64)
479 _foamAddLib $MPI_ARCH_PATH/lib/linux_ia64
480 ;;
481 *)
482 echo Unknown processor type `uname -m` 1>&2
483 ;;
484 esac
485 ;;
486
487 GAMMA)
488 export FOAM_MPI=gamma
489 export MPI_ARCH_PATH=/usr
490 ;;
491
492 MPI)
493 export FOAM_MPI=mpi
494 export MPI_ARCH_PATH=/opt/mpi
495 ;;
496
497 FJMPI)
498 export FOAM_MPI=fjmpi
499 export MPI_ARCH_PATH=/opt/FJSVmpi2
500
501 _foamAddPath $MPI_ARCH_PATH/bin
502 _foamAddLib $MPI_ARCH_PATH/lib/sparcv9
503 _foamAddLib /opt/FSUNf90/lib/sparcv9
504 _foamAddLib /opt/FJSVpnidt/lib
505 ;;
506
507 QSMPI)
508 export FOAM_MPI=qsmpi
509 export MPI_ARCH_PATH=/usr/lib/mpi
510
511 _foamAddPath $MPI_ARCH_PATH/bin
512 _foamAddLib $MPI_ARCH_PATH/lib
513 ;;
514
515 SGIMPI)
516 # no trailing slash
517 [ "${MPI_ROOT%/}" = "${MPI_ROOT}" ] || MPI_ROOT="${MPI_ROOT%/}"
518
519 export FOAM_MPI="${MPI_ROOT##*/}"
520 export MPI_ARCH_PATH=$MPI_ROOT
521
522 if [ ! -d "$MPI_ROOT" -o -z "$MPI_ARCH_PATH" ]
523 then
524 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
525 echo " MPI_ROOT not a valid mpt installation directory or ending 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
528 fi
529
530 if [ "$FOAM_VERBOSE" -a "$PS1" ]
531 then
532 echo "Using SGI MPT:" 1>&2
533 echo " MPI_ROOT : $MPI_ROOT" 1>&2
534 echo " FOAM_MPI : $FOAM_MPI" 1>&2
535 fi
536
537 _foamAddPath $MPI_ARCH_PATH/bin
538 _foamAddLib $MPI_ARCH_PATH/lib
539 ;;
540
541 INTELMPI)
542 # no trailing slash
543 [ "${MPI_ROOT%/}" = "${MPI_ROOT}" ] || MPI_ROOT="${MPI_ROOT%/}"
544
545 export FOAM_MPI="${MPI_ROOT##*/}"
546 export MPI_ARCH_PATH=$MPI_ROOT
547
548 if [ ! -d "$MPI_ROOT" -o -z "$MPI_ARCH_PATH" ]
549 then
550 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.sh:" 1>&2
551 echo " MPI_ROOT not a valid mpt installation directory or ending in a '/'." 1>&2
552 echo " Please set MPI_ROOT to the mpt installation directory." 1>&2
553 echo " MPI_ROOT currently set to '$MPI_ROOT'" 1>&2
554 fi
555
556 if [ "$FOAM_VERBOSE" -a "$PS1" ]
557 then
558 echo "Using INTEL MPI:" 1>&2
559 echo " MPI_ROOT : $MPI_ROOT" 1>&2
560 echo " FOAM_MPI : $FOAM_MPI" 1>&2
561 fi
562
563 _foamAddPath $MPI_ARCH_PATH/bin64
564 _foamAddLib $MPI_ARCH_PATH/lib64
565 ;;
566 *)
567 export FOAM_MPI=dummy
568 ;;
569 esac
570
571 # add (non-dummy) MPI implementation
572 # dummy MPI already added to LD_LIBRARY_PATH and has no external libraries
573 if [ "$FOAM_MPI" != dummy ]
574 then
575 _foamAddLib $FOAM_LIBBIN/$FOAM_MPI:$FOAM_EXT_LIBBIN/$FOAM_MPI
576 fi
577
578
579
580 # Set the minimum MPI buffer size (used by all platforms except SGI MPI)
581 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
582 : ${minBufferSize:=20000000}
583
584 if [ "${MPI_BUFFER_SIZE:=$minBufferSize}" -lt $minBufferSize ]
585 then
586 MPI_BUFFER_SIZE=$minBufferSize
587 fi
588 export MPI_BUFFER_SIZE
589
590
591 # cleanup environment:
592 # ~~~~~~~~~~~~~~~~~~~~
593 unset _foamAddPath _foamAddLib _foamAddMan foamCompiler minBufferSize
594
595 # ----------------------------------------------------------------- end-of-file
Something went wrong with that request. Please try again.