openfoam/etc/config.sh/mpi
Henry Weller 4409a0ea5a etc/bashrc, etc/config.sh: Updates provided by Bruno Santos:
1. "foamCompiler" was changed to a more permanent "WM_COMPILER_TYPE"
    environment variable, so that it can be used by 3rd party
    installation scripts, such as "makeGcc", "makeLLVM" and so on. More
    on this will be provided in issue #1215.

 2. The script functions such as "_foamSource()" and "_foamAddPath()"
    were moved to a new file "etc/config.sh/functions". It has the
    ability to set or unset, depending on whether "WM_BASH_FUNCTIONS" is
    defined or not. This allows for these functions to be reused by
    other scripts, such as "makeGcc".

 3. The script "etc/config.sh/CGAL" relies on whether a local
    environment variable "SOURCE_CGAL_VERSIONS_ONLY" is defined or not,
    so that it will load only the version settings if it's defined. This
    is to make it easier to call this script from "makeCGAL". Although
    it still feels a bit of a clunky hack, but I didn't manage to deduce
    any other way we could do this :( I didn't add indentation within
    the if-block, to make it easier to read the changes. In addition,
    the local variable "common_path" is used to shorten the length of
    the lines and use slightly less repeated code.

 4. Added another new script "etc/config.sh/compiler", which has only
    the version numbers for the compilers taken out from the "settings"
    file. It currently depends on "WM_COMPILER_TYPE" for setting the
    variables, the same way it did with "foamCompiler". This script is
    now always sourced from the "settings" file, for the following
    reasons:

   - "makeGCC" and "makeLLVM" can now take advantage of this script file.

   - The example "compiler" script (detailed next) can rely on this
     script file and then override parameters on-demand, as well as
     allowing for system compilers to have dedicated settings, such as
     setting "WM_CC". This is similar to how the example environment
     script for "paraview" works.

 5. To the script "etc/config.sh/example/compiler" were added a few more examples:

   - It now starts with a block where it first loads the default "compiler" script.

   - Has a "WM_COMPILER=Gcc48u" case example for when we try to use GCC
     4.8 in Ubuntu 15.10. This is just to give the idea that in a
     particular system, we might have several system-wide compiler
     versions. For example, in Ubuntu 15.10, there is GCC 4.7, 4.8 and
     5.2, which could be used for testing performances or compatibility
     with some other 3rd party library.

   - Has the "WM_COMPILER=Icc" case example, related to the original bug
     report, where "WM_CC=icc" and "WM_CXX=icpc", so that the user then
     simply copies this file to their own local preferences folder.

 6. Small bug fix in "etc/config.sh/mpi", where unsetting "minBufferSize" was missing at the end of the script.

 7. Small change in "etc/config.sh/paraview", where "CMAKE_ROOT" is set
    along with "CMAKE_HOME". This is due to a rare issue that occurs on
    people's systems where they have a custom system-wide CMake version
    installed and which is used by having "CMAKE_ROOT" set on that
    environment. This can mess up OpenFOAM's custom ParaView builds,
    given that conflicting CMake versions can lead to not building
    ParaView at all.

   - For more details about "CMAKE_ROOT":
     https://cmake.org/Wiki/CMake_Useful_Variables [^]

 8. The scripts "_foamAddPath _foamAddLib _foamAddMan" were not being
    unset at the end of "settings". They are now unset at the end of
    "bashrc", through a call to the new double-use "functions" script.

Additionally all references to "foamCompiler" have been changed to
"WM_COMPILER_TYPE".

See also http://www.openfoam.org/mantisbt/view.php?id=1232
2016-03-09 09:01:09 +00:00

276 lines
7.9 KiB
Bash

#----------------------------------*-sh-*--------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
#
# OpenFOAM is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
#
# File
# etc/config.sh/mpi
#
# Description
# Startup file for communications library (MPI) for OpenFOAM
# Sourced from OpenFOAM-<VERSION>/etc/bashrc
#
#------------------------------------------------------------------------------
unset MPI_ARCH_PATH MPI_HOME FOAM_MPI_LIBBIN
case "$WM_MPLIB" in
SYSTEMOPENMPI)
# Use the system installed openmpi, get library directory via mpicc
export FOAM_MPI=openmpi-system
libDir=`mpicc --showme:link | sed -e 's/.*-L\([^ ]*\).*/\1/'`
# Bit of a hack: strip off 'lib' and hope this is the path to openmpi
# include files and libraries.
export MPI_ARCH_PATH="${libDir%/*}"
_foamAddLib $libDir
unset libDir
;;
OPENMPI)
export FOAM_MPI=openmpi-1.10.2
# Optional configuration tweaks:
_foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config.sh/openmpi`
export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
# Tell OpenMPI where to find its install directory
export OPAL_PREFIX=$MPI_ARCH_PATH
_foamAddPath $MPI_ARCH_PATH/bin
# 64-bit on OpenSuSE 12.1 uses lib64 others use lib
_foamAddLib $MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
_foamAddLib $MPI_ARCH_PATH/lib
_foamAddMan $MPI_ARCH_PATH/share/man
;;
SYSTEMMPI)
export FOAM_MPI=mpi-system
if [ -z "$MPI_ROOT" ]
then
echo 1>&2
echo "Warning in $WM_PROJECT_DIR/etc/config.sh/settings:" 1>&2
echo " Please set the environment variable MPI_ROOT to point to" \
" the base folder for the system MPI in use." 1>&2
echo " Example:" 1>&2
echo 1>&2
echo " export MPI_ROOT=/opt/mpi" 1>&2
echo 1>&2
else
export MPI_ARCH_PATH=$MPI_ROOT
if [ -z "$MPI_ARCH_FLAGS" ]
then
echo 1>&2
echo "Warning in $WM_PROJECT_DIR/etc/config.sh/settings:" 1>&2
echo " MPI_ARCH_FLAGS is not set. Example:" 1>&2
echo 1>&2
echo " export MPI_ARCH_FLAGS=\"-DOMPI_SKIP_MPICXX\"" 1>&2
echo 1>&2
fi
if [ -z "$MPI_ARCH_INC" ]
then
echo 1>&2
echo "Warning in $WM_PROJECT_DIR/etc/config.sh/settings:" 1>&2
echo " MPI_ARCH_INC is not set. Example:" 1>&2
echo 1>&2
echo " export MPI_ARCH_INC=\"-isystem \$MPI_ROOT/include\"" 1>&2
echo 1>&2
fi
if [ -z "$MPI_ARCH_LIBS" ]
then
echo 1>&2
echo "Warning in $WM_PROJECT_DIR/etc/config.sh/settings:" 1>&2
echo " MPI_ARCH_LIBS is not set. Example:" 1>&2
echo 1>&2
echo " export MPI_ARCH_LIBS=\"-L\$MPI_ROOT/lib -lmpi\"" 1>&2
echo 1>&2
fi
fi
;;
MPICH)
export FOAM_MPI=mpich2-1.1.1p1
export MPI_HOME=$WM_THIRD_PARTY_DIR/$FOAM_MPI
export MPI_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
_foamAddPath $MPI_ARCH_PATH/bin
# 64-bit on OpenSuSE 12.1 uses lib64 others use lib
_foamAddLib $MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
_foamAddLib $MPI_ARCH_PATH/lib
_foamAddMan $MPI_ARCH_PATH/share/man
;;
MPICH-GM)
export FOAM_MPI=mpich-gm
export MPI_ARCH_PATH=/opt/mpi
export MPICH_PATH=$MPI_ARCH_PATH
export GM_LIB_PATH=/opt/gm/lib64
_foamAddPath $MPI_ARCH_PATH/bin
# 64-bit on OpenSuSE 12.1 uses lib64 others use lib
_foamAddLib $MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
_foamAddLib $MPI_ARCH_PATH/lib
_foamAddLib $GM_LIB_PATH
;;
HPMPI)
export FOAM_MPI=hpmpi
export MPI_HOME=/opt/hpmpi
export MPI_ARCH_PATH=$MPI_HOME
_foamAddPath $MPI_ARCH_PATH/bin
case `uname -m` in
i686)
_foamAddLib $MPI_ARCH_PATH/lib/linux_ia32
;;
x86_64)
_foamAddLib $MPI_ARCH_PATH/lib/linux_amd64
;;
ia64)
_foamAddLib $MPI_ARCH_PATH/lib/linux_ia64
;;
*)
echo Unknown processor type `uname -m` 1>&2
;;
esac
;;
MPI)
export FOAM_MPI=mpi
export MPI_ARCH_PATH=/opt/mpi
;;
FJMPI)
export FOAM_MPI=fjmpi
export MPI_ARCH_PATH=/opt/FJSVmpi2
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib/sparcv9
_foamAddLib /opt/FSUNf90/lib/sparcv9
_foamAddLib /opt/FJSVpnidt/lib
;;
QSMPI)
export FOAM_MPI=qsmpi
export MPI_ARCH_PATH=/usr/lib/mpi
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
;;
SGIMPI)
# No trailing slash
[ "${MPI_ROOT%/}" = "${MPI_ROOT}" ] || MPI_ROOT="${MPI_ROOT%/}"
export FOAM_MPI="${MPI_ROOT##*/}"
export MPI_ARCH_PATH=$MPI_ROOT
if [ ! -d "$MPI_ROOT" -o -z "$MPI_ARCH_PATH" ]
then
echo "Warning in $WM_PROJECT_DIR/etc/config.sh/settings:" 1>&2
echo " MPI_ROOT not a valid mpt installation directory or ending" \
" in a '/'." 1>&2
echo " Please set MPI_ROOT to the mpt installation directory." 1>&2
echo " MPI_ROOT currently set to '$MPI_ROOT'" 1>&2
fi
if [ "$FOAM_VERBOSE" -a "$PS1" ]
then
echo "Using SGI MPT:" 1>&2
echo " MPI_ROOT : $MPI_ROOT" 1>&2
echo " FOAM_MPI : $FOAM_MPI" 1>&2
fi
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
;;
INTELMPI)
# No trailing slash
[ "${MPI_ROOT%/}" = "${MPI_ROOT}" ] || MPI_ROOT="${MPI_ROOT%/}"
export FOAM_MPI="${MPI_ROOT##*/}"
export MPI_ARCH_PATH=$MPI_ROOT
if [ ! -d "$MPI_ROOT" -o -z "$MPI_ARCH_PATH" ]
then
echo "Warning in $WM_PROJECT_DIR/etc/config.sh/settings:" 1>&2
echo " MPI_ROOT not a valid mpt installation directory or ending" \
" in a '/'." 1>&2
echo " Please set MPI_ROOT to the mpt installation directory." 1>&2
echo " MPI_ROOT currently set to '$MPI_ROOT'" 1>&2
fi
if [ "$FOAM_VERBOSE" -a "$PS1" ]
then
echo "Using INTEL MPI:" 1>&2
echo " MPI_ROOT : $MPI_ROOT" 1>&2
echo " FOAM_MPI : $FOAM_MPI" 1>&2
fi
_foamAddPath $MPI_ARCH_PATH/bin64
_foamAddLib $MPI_ARCH_PATH/lib64
;;
*)
export FOAM_MPI=dummy
;;
esac
# Add (non-dummy) MPI implementation
# Dummy MPI already added to LD_LIBRARY_PATH and has no external libraries
if [ "$FOAM_MPI" != dummy ]
then
_foamAddLib $FOAM_LIBBIN/$FOAM_MPI:$FOAM_EXT_LIBBIN/$FOAM_MPI
fi
# Set the minimum MPI buffer size (used by all platforms except SGI MPI)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: ${minBufferSize:=20000000}
if [ "${MPI_BUFFER_SIZE:=$minBufferSize}" -lt $minBufferSize ]
then
MPI_BUFFER_SIZE=$minBufferSize
fi
export MPI_BUFFER_SIZE
# Cleanup environment:
# ~~~~~~~~~~~~~~~~~~~~
unset minBufferSize
#------------------------------------------------------------------------------