1 #----------------------------------*-sh-*--------------------------------------
3 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 #------------------------------------------------------------------------------
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
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/>.
25 # etc/config/settings.csh
28 # Startup file for OpenFOAM
29 # Sourced from OpenFOAM-<VERSION>/etc/cshrc
31 #------------------------------------------------------------------------------
34 alias _foamAddPath 'setenv PATH \!*\:${PATH}'
35 # prefix to LD_LIBRARY_PATH
36 alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}'
38 alias _foamAddMan 'setenv MANPATH \!*\:${MANPATH}'
40 #------------------------------------------------------------------------------
41 # Set environment variables according to system type
42 setenv WM_ARCH `uname -s`
53 switch ($WM_ARCH_OPTION)
55 setenv WM_COMPILER_ARCH 64
58 setenv WM_CFLAGS '-m32 -fPIC'
59 setenv WM_CXXFLAGS '-m32 -fPIC'
60 setenv WM_LDFLAGS '-m32'
64 setenv WM_ARCH linux64
65 setenv WM_COMPILER_LIB_ARCH 64
68 setenv WM_CFLAGS '-m64 -fPIC'
69 setenv WM_CXXFLAGS '-m64 -fPIC'
70 setenv WM_LDFLAGS '-m64'
74 echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32 or 64"
81 setenv WM_ARCH linuxIA64
82 setenv WM_COMPILER I64
86 setenv WM_ARCH SiCortex64
88 setenv WM_COMPILER_LIB_ARCH 64
91 setenv WM_CFLAGS '-mabi=64 -fPIC'
92 setenv WM_CXXFLAGS '-mabi=64 -fPIC'
93 setenv WM_LDFLAGS '-mabi=64 -G0'
97 setenv WM_ARCH linuxPPC64
98 setenv WM_COMPILER_LIB_ARCH 64
101 setenv WM_CFLAGS '-m64 -fPIC'
102 setenv WM_CXXFLAGS '-m64 -fPIC'
103 setenv WM_LDFLAGS '-m64'
107 echo Unknown processor type `uname -m` for Linux
114 setenv WM_ARCH SunOS64
115 setenv WM_MPLIB FJMPI
116 setenv WM_COMPILER_LIB_ARCH 64
119 setenv WM_CFLAGS '-mabi=64 -fPIC'
120 setenv WM_CXXFLAGS '-mabi=64 -fPIC'
121 setenv WM_LDFLAGS '-mabi=64 -G0'
126 echo "Your '$WM_ARCH' operating system is not supported by this release"
127 echo "of OpenFOAM. For further assistance, please contact www.OpenFOAM.org"
134 #------------------------------------------------------------------------------
136 # location of the jobControl directory
137 setenv FOAM_JOB_DIR $WM_PROJECT_INST_DIR/jobControl
139 # wmake configuration
140 setenv WM_DIR $WM_PROJECT_DIR/wmake
141 setenv WM_LINK_LANGUAGE c++
142 setenv WM_OPTIONS $WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_COMPILE_OPTION
144 # base executables/libraries
145 setenv FOAM_APPBIN $WM_PROJECT_DIR/platforms/$WM_OPTIONS/bin
146 setenv FOAM_LIBBIN $WM_PROJECT_DIR/platforms/$WM_OPTIONS/lib
148 # external (ThirdParty) libraries
149 setenv FOAM_EXT_LIBBIN $WM_THIRD_PARTY_DIR/platforms/$WM_OPTIONS/lib
151 # shared site executables/libraries
152 # similar naming convention as ~OpenFOAM expansion
153 if ( $?WM_PROJECT_SITE ) then
154 setenv FOAM_SITE_APPBIN $WM_PROJECT_SITE/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin
155 setenv FOAM_SITE_LIBBIN $WM_PROJECT_SITE/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib
157 setenv FOAM_SITE_APPBIN $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin
158 setenv FOAM_SITE_LIBBIN $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib
161 # user executables/libraries
162 setenv FOAM_USER_APPBIN $WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/bin
163 setenv FOAM_USER_LIBBIN $WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/lib
165 # dynamicCode templates
166 # - default location is the "~OpenFOAM/codeTemplates/dynamicCode" expansion
167 # setenv FOAM_CODE_TEMPLATES $WM_PROJECT_DIR/etc/codeTemplates/dynamicCode
170 setenv FOAM_APP $WM_PROJECT_DIR/applications
171 setenv FOAM_SRC $WM_PROJECT_DIR/src
172 setenv FOAM_TUTORIALS $WM_PROJECT_DIR/tutorials
173 setenv FOAM_UTILITIES $FOAM_APP/utilities
174 setenv FOAM_SOLVERS $FOAM_APP/solvers
175 setenv FOAM_RUN $WM_PROJECT_USER_DIR/run
177 # add wmake to the path - not required for runtime only environment
178 if ( -d "${WM_DIR}" ) setenv PATH ${WM_DIR}:${PATH}
179 # add OpenFOAM scripts to the path
180 setenv PATH ${WM_PROJECT_DIR}/bin:${PATH}
182 _foamAddPath ${FOAM_USER_APPBIN}:${FOAM_SITE_APPBIN}:${FOAM_APPBIN}
183 # Make sure to pick up dummy versions of external libraries last
184 _foamAddLib ${FOAM_USER_LIBBIN}:${FOAM_SITE_LIBBIN}:${FOAM_LIBBIN}:${FOAM_EXT_LIBBIN}:${FOAM_LIBBIN}/dummy
188 unset gcc_version gmp_version mpfr_version mpc_version
189 unsetenv MPFR_ARCH_PATH GMP_ARCH_PATH
192 # Location of compiler installation
193 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
194 if ( ! $?foamCompiler ) then
195 set foamCompiler=system
196 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:"
197 echo " foamCompiler not set, using '$foamCompiler'"
200 switch ("$foamCompiler")
203 switch ("$WM_COMPILER")
208 set gcc_version=gcc-4.6.1
209 set gmp_version=gmp-5.0.1
210 set mpfr_version=mpfr-2.4.2
211 set mpc_version=mpc-0.8.1
215 set gcc_version=gcc-4.5.2
216 set gmp_version=gmp-5.0.1
217 set mpfr_version=mpfr-2.4.2
218 set mpc_version=mpc-0.8.1
222 set gcc_version=gcc-4.4.3
223 set gmp_version=gmp-5.0.1
224 set mpfr_version=mpfr-2.4.2
227 set gcc_version=gcc-4.3.3
228 set gmp_version=gmp-4.2.4
229 set mpfr_version=mpfr-2.4.1
232 # using clang - not gcc
234 setenv WM_CXX 'clang++'
235 #set clang_version=llvm-2.9
236 set clang_version=llvm-svn
240 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:"
241 echo " Unknown OpenFOAM compiler type '$WM_COMPILER'"
242 echo " Please check your settings"
247 # optional configuration tweaks:
248 _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/compiler.csh`
250 if ( $?gcc_version ) then
251 set gccDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gcc_version
252 set gmpDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gmp_version
253 set mpfrDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpfr_version
254 if ( $?mpc_version ) then
255 set mpcDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpc_version
258 # Check that the compiler directory can be found
259 if ( ! -d "$gccDir" ) then
261 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:"
262 echo " Cannot find $gccDir installation."
263 echo " Please install this compiler version or if you wish to use the system compiler,"
264 echo " change the 'foamCompiler' setting to 'system'"
268 _foamAddMan $gccDir/man
269 _foamAddPath $gccDir/bin
271 # add compiler libraries to run-time environment
272 # 64-bit needs lib64, but 32-bit needs lib (not lib32)
273 if ($WM_ARCH_OPTION == 64 && $?WM_COMPILER_LIB_ARCH) then
274 _foamAddLib $gccDir/lib$WM_COMPILER_LIB_ARCH
276 _foamAddLib $gccDir/lib
279 # add gmp/mpfr libraries to run-time environment
280 _foamAddLib $gmpDir/lib
281 _foamAddLib $mpfrDir/lib
283 # add mpc libraries (not need for older gcc) to run-time environment
284 if ( $?mpc_version ) then
285 _foamAddLib $mpcDir/lib
288 # used by boost/CGAL:
289 setenv MPFR_ARCH_PATH $mpfrDir
290 setenv GMP_ARCH_PATH $gmpDir
292 unset gcc_version gccDir
293 unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir
295 if ( $?clang_version ) then
296 set clangDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$clang_version
298 # Check that the compiler directory can be found
299 if ( ! -d "$clangDir" ) then
301 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:"
302 echo " Cannot find $clangDir installation."
303 echo " Please install this compiler version or if you wish to use the system compiler,"
304 echo " change the 'foamCompiler' setting to 'system'"
308 _foamAddMan $clangDir/man
309 _foamAddPath $clangDir/bin
311 unset clang_version clangDir
316 # okay, use system compiler
320 echo "Warn: foamCompiler='$foamCompiler' is unsupported"
321 echo " treating as 'system' instead"
327 # add c++0x flags for external programs
329 if ( $?WM_CXXFLAGS ) then
330 switch ("$WM_COMPILER")
332 setenv WM_CXXFLAGS "$WM_CXXFLAGS -std=c++0x"
341 set boost_version=boost_1_45_0
342 set cgal_version=CGAL-3.8
344 setenv BOOST_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$boost_version
345 setenv CGAL_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cgal_version
347 # enabled if CGAL is available
348 if ( -d "$CGAL_ARCH_PATH" ) then
349 if ( -d "$BOOST_ARCH_PATH" ) then
350 _foamAddLib $BOOST_ARCH_PATH/lib
352 unsetenv BOOST_ARCH_PATH
354 _foamAddLib $CGAL_ARCH_PATH/lib
356 unsetenv BOOST_ARCH_PATH CGAL_ARCH_PATH MPFR_ARCH_PATH GMP_ARCH_PATH
359 unset boost_version cgal_version
362 # Communications library
363 # ~~~~~~~~~~~~~~~~~~~~~~
365 unsetenv MPI_ARCH_PATH MPI_HOME FOAM_MPI_LIBBIN
369 setenv FOAM_MPI openmpi-1.5.3
370 # optional configuration tweaks:
371 _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/openmpi.csh`
373 setenv MPI_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
375 # Tell OpenMPI where to find its install directory
376 setenv OPAL_PREFIX $MPI_ARCH_PATH
378 _foamAddPath $MPI_ARCH_PATH/bin
379 _foamAddLib $MPI_ARCH_PATH/lib
380 _foamAddMan $MPI_ARCH_PATH/man
384 # Use the system installed openmpi, get library directory via mpicc
385 setenv FOAM_MPI openmpi-system
387 # Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI
388 setenv PINC "`mpicc --showme:compile`"
389 setenv PLIBS "`mpicc --showme:link`"
390 set libDir=`echo "$PLIBS" | sed -e 's/.*-L\([^ ]*\).*/\1/'`
392 # Bit of a hack: strip off 'lib' and hope this is the path to openmpi
393 # include files and libraries.
394 setenv MPI_ARCH_PATH "${libDir:h}"
396 if ($?FOAM_VERBOSE && $?prompt) then
397 echo "Using system installed MPI:"
398 echo " compile flags : $PINC"
399 echo " link flags : $PLIBS"
400 echo " libmpi dir : $libDir"
408 setenv FOAM_MPI mpich2-1.1.1p1
409 setenv MPI_HOME $WM_THIRD_PARTY_DIR/$FOAM_MPI
410 setenv MPI_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
412 _foamAddPath $MPI_ARCH_PATH/bin
413 _foamAddLib $MPI_ARCH_PATH/lib
414 _foamAddMan $MPI_ARCH_PATH/share/man
418 setenv FOAM_MPI mpich-gm
419 setenv MPI_ARCH_PATH /opt/mpi
420 setenv MPICH_PATH $MPI_ARCH_PATH
421 setenv GM_LIB_PATH /opt/gm/lib64
423 _foamAddPath $MPI_ARCH_PATH/bin
424 _foamAddLib $MPI_ARCH_PATH/lib
425 _foamAddLib $GM_LIB_PATH
429 setenv FOAM_MPI hpmpi
430 setenv MPI_HOME /opt/hpmpi
431 setenv MPI_ARCH_PATH $MPI_HOME
433 _foamAddPath $MPI_ARCH_PATH/bin
437 _foamAddLib $MPI_ARCH_PATH/lib/linux_ia32
440 _foamAddLib $MPI_ARCH_PATH/lib/linux_amd64
443 _foamAddLib $MPI_ARCH_PATH/lib/linux_ia64
446 echo Unknown processor type `uname -m` for Linux
452 setenv FOAM_MPI gamma
453 setenv MPI_ARCH_PATH /usr
458 setenv MPI_ARCH_PATH /opt/mpi
462 setenv FOAM_MPI fjmpi
463 setenv MPI_ARCH_PATH /opt/FJSVmpi2
465 _foamAddPath $MPI_ARCH_PATH/bin
466 _foamAddLib $MPI_ARCH_PATH/lib/sparcv9
467 _foamAddLib /opt/FSUNf90/lib/sparcv9
468 _foamAddLib /opt/FJSVpnidt/lib
472 setenv FOAM_MPI qsmpi
473 setenv MPI_ARCH_PATH /usr/lib/mpi
475 _foamAddPath $MPI_ARCH_PATH/bin
476 _foamAddLib $MPI_ARCH_PATH/lib
480 if ( ! $?MPI_ROOT) setenv MPI_ROOT /dummy
482 if ( ! -d "$MPI_ROOT" ) then
483 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:"
484 echo " MPI_ROOT not a valid mpt installation directory."
485 echo " Please set MPI_ROOT to the mpt installation directory."
486 echo " (usually done by loading the mpt module)"
487 echo " MPI_ROOT currently set to '$MPI_ROOT'"
490 if ( "${MPI_ROOT:h}/" == $MPI_ROOT ) then
491 setenv MPI_ROOT ${MPI_ROOT:h}
494 setenv FOAM_MPI ${MPI_ROOT:t}
495 setenv MPI_ARCH_PATH $MPI_ROOT
498 if ($?FOAM_VERBOSE && $?prompt) then
499 echo "Using SGI MPT:"
500 echo " MPI_ROOT : $MPI_ROOT"
501 echo " FOAM_MPI : $FOAM_MPI"
505 _foamAddPath $MPI_ARCH_PATH/bin
506 _foamAddLib $MPI_ARCH_PATH/lib
510 setenv FOAM_MPI dummy
515 # add (non-dummy) MPI implementation
516 # dummy MPI already added to LD_LIBRARY_PATH and has no external libraries
517 if ( "$FOAM_MPI" != dummy ) then
518 _foamAddLib ${FOAM_LIBBIN}/${FOAM_MPI}:${FOAM_EXT_LIBBIN}/${FOAM_MPI}
523 # Set the minimum MPI buffer size (used by all platforms except SGI MPI)
524 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
525 if ( ! $?minBufferSize ) set minBufferSize=20000000
527 if ( $?MPI_BUFFER_SIZE ) then
528 if ( $MPI_BUFFER_SIZE < $minBufferSize ) then
529 setenv MPI_BUFFER_SIZE $minBufferSize
532 setenv MPI_BUFFER_SIZE $minBufferSize
536 # cleanup environment:
537 # ~~~~~~~~~~~~~~~~~~~~
538 unalias _foamAddPath _foamAddLib _foamAddMan
539 unset foamCompiler minBufferSize
541 # ----------------------------------------------------------------- end-of-file