openfoam/etc/config.csh/mpi
Mark Olesen a6ef10506d ENH: respect the I_MPI_ROOT setting for INTELMPI (issue #524)
- add note in BuildIssues about the I_MPI_CC variable, which is needed
  when building with Intel-MPI and gcc/clang.

  This additional setting is needed since the changes needed to solve
  the issue of building scotch with Intel-MPI and icc (issue #434)
  means that mpiicc is now being used as the wrapper when compiling
  scotch.

- have the FOAM_MPI short name for INTELMPI start with 'impi-' instead
  of just the version number.
  Intel-MPI is often installed as /opt/intel/impi/4.1.3.049, which
  results in 'FOAM_MPI=4.1.3.049' and the mpi flavour is lost.
  Prefix these cases with 'impi-'
2017-07-12 11:02:04 +02:00

293 lines
8.9 KiB
Bash

#----------------------------------*-sh-*--------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
#------------------------------------------------------------------------------
# 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.csh/mpi
#
# Description
# Setup file for communications library (MPI) for OpenFOAM
# Sourced from OpenFOAM-<VERSION>/etc/cshrc
#
# For USERMPI, the user is responsible for supplying an appropriate
# wmake/rules/General/mplibUSERMPI file and managing all settings
#
#------------------------------------------------------------------------------
unsetenv MPI_ARCH_PATH MPI_HOME
setenv FOAM_MPI dummy # Fallback value
switch ("$WM_MPLIB")
case SYSTEMOPENMPI:
# Use the system installed openmpi, get library directory via mpicc
setenv FOAM_MPI openmpi-system
# Bit of a hack: strip off 'lib' and assume it is the prefix for openmpi
# include files and libraries.
set libDir=`mpicc --showme:link | sed -e 's/.*-L\([^ ]*\).*/\1/'`
setenv MPI_ARCH_PATH "${libDir:h}"
_foamAddLib $libDir
unset libDir
breaksw
case OPENMPI:
setenv FOAM_MPI openmpi-1.10.4
_foamEtc config.csh/openmpi # <- Adjustments (optional)
setenv MPI_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
# Tell OpenMPI where to find its install directory
setenv OPAL_PREFIX $MPI_ARCH_PATH
if ($?FOAM_VERBOSE && $?prompt) then
echo "Using $WM_MPLIB"
echo " FOAM_MPI : $FOAM_MPI"
echo " OPAL_PREFIX : $MPI_ARCH_PATH"
endif
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
_foamAddMan $MPI_ARCH_PATH/share/man
breaksw
case USERMPI:
# Use an arbitrary, user-specified mpi implementation
setenv FOAM_MPI mpi-user
_foamEtc config.csh/mpi-user # <- Adjustments
breaksw
case SYSTEMMPI:
setenv FOAM_MPI mpi-system
_foamEtc config.csh/mpi-system # <- Adjustments (optional)
if ( ! $?MPI_ROOT ) then
echo
echo "Warning in $WM_PROJECT_DIR/etc/config.csh/mpi:"
echo " Please set the environment variable MPI_ROOT to point to" \
" the base folder for the system MPI in use."
echo " Example:"
echo
echo " setenv MPI_ROOT /opt/mpi"
echo
else
setenv MPI_ARCH_PATH $MPI_ROOT
if ( ! $?MPI_ARCH_FLAGS ) then
echo
echo "Warning in $WM_PROJECT_DIR/etc/config.csh/mpi:"
echo " MPI_ARCH_FLAGS is not set. Example:"
echo
echo ' setenv MPI_ARCH_FLAGS "-DOMPI_SKIP_MPICXX"'
echo
endif
if ( ! $?MPI_ARCH_INC ) then
echo
echo "Warning in $WM_PROJECT_DIR/etc/config.csh/mpi:"
echo " MPI_ARCH_INC is not set. Example:"
echo
echo ' setenv MPI_ARCH_INC "-isystem $MPI_ROOT/include"'
echo
endif
if ( ! $?MPI_ARCH_LIBS ) then
echo
echo "Warning in $WM_PROJECT_DIR/etc/config.csh/mpi:"
echo " MPI_ARCH_LIBS is not set. Example:"
echo
echo ' setenv MPI_ARCH_LIBS "-L$MPI_ROOT/lib -lmpi"'
echo
endif
endif
breaksw
case MPICH:
setenv FOAM_MPI mpich-3.2
setenv MPI_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
setenv MPI_HOME $MPI_ARCH_PATH
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
_foamAddMan $MPI_ARCH_PATH/share/man
breaksw
case MPICH-GM:
setenv FOAM_MPI mpich-gm
setenv MPI_ARCH_PATH /opt/mpi
setenv MPICH_PATH $MPI_ARCH_PATH
setenv GM_LIB_PATH /opt/gm/lib$WM_COMPILER_LIB_ARCH
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
_foamAddLib $GM_LIB_PATH
breaksw
case HPMPI:
setenv FOAM_MPI hpmpi
setenv MPI_HOME /opt/hpmpi
setenv MPI_ARCH_PATH $MPI_HOME
_foamAddPath $MPI_ARCH_PATH/bin
switch (`uname -m`)
case i686:
_foamAddLib $MPI_ARCH_PATH/lib/linux_ia32
breaksw
case x86_64:
_foamAddLib $MPI_ARCH_PATH/lib/linux_amd64
breaksw
case ia64:
_foamAddLib $MPI_ARCH_PATH/lib/linux_ia64
breaksw
default:
echo Unknown processor type `uname -m` for Linux
breaksw
endsw
breaksw
case MPI:
setenv FOAM_MPI mpi
setenv MPI_ARCH_PATH /opt/mpi
breaksw
case FJMPI:
setenv FOAM_MPI fjmpi
setenv 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
breaksw
case QSMPI:
setenv FOAM_MPI qsmpi
setenv MPI_ARCH_PATH /usr/lib/mpi
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
breaksw
case SGIMPI:
if ( ! $?MPI_ROOT ) setenv MPI_ROOT /dummy
if ( ! -d "$MPI_ROOT" ) then
echo "Warning in $WM_PROJECT_DIR/etc/config.csh/mpi:"
echo " Not a valid $WM_MPLIB installation directory."
echo " Please set MPI_ROOT properly (usually via the mpt module)"
echo " Currently using '$MPI_ARCH_PATH'"
endif
if ( "${MPI_ROOT:h}/" == $MPI_ROOT ) then
setenv MPI_ROOT ${MPI_ROOT:h}
endif
setenv FOAM_MPI ${MPI_ROOT:t}
setenv MPI_ARCH_PATH $MPI_ROOT
if ($?FOAM_VERBOSE && $?prompt) then
echo "Using $WM_MPLIB"
echo " FOAM_MPI : $FOAM_MPI"
echo " MPI_ROOT : $MPI_ARCH_PATH"
endif
_foamAddPath $MPI_ARCH_PATH/bin
_foamAddLib $MPI_ARCH_PATH/lib
breaksw
case INTELMPI:
if ( $?I_MPI_ROOT ) then
# I_MPI_ROOT: The Intel MPI Library installation directory
# Remove trailing slash
if ( "${I_MPI_ROOT:h}/" == $I_MPI_ROOT ) then
setenv I_MPI_ROOT ${I_MPI_ROOT:h}
endif
setenv MPI_ARCH_PATH $I_MPI_ROOT
setenv FOAM_MPI ${MPI_ARCH_PATH:t}
# If subdirectory is version number only, prefix with 'impi-'
switch ("$FOAM_MPI")
case [0-9]*:
setenv FOAM_MPI "impi-$FOAM_MPI"
breaksw
endsw
if ($?FOAM_VERBOSE && $?prompt) then
echo "Using $WM_MPLIB"
echo " FOAM_MPI : $FOAM_MPI"
echo " I_MPI_ROOT : $MPI_ARCH_PATH"
endif
else if ( $?MPI_ROOT ) then
# MPI_ROOT: General specification
# Remove trailing slash
if ( "${MPI_ROOT:h}/" == $MPI_ROOT ) then
setenv MPI_ROOT ${MPI_ROOT:h}
endif
setenv MPI_ARCH_PATH $MPI_ROOT
setenv FOAM_MPI ${MPI_ARCH_PATH:t}
# If subdirectory is version number only, prefix with 'impi-'
switch ("$FOAM_MPI")
case [0-9]*:
setenv FOAM_MPI "impi-$FOAM_MPI"
breaksw
endsw
if ($?FOAM_VERBOSE && $?prompt) then
echo "Using $WM_MPLIB"
echo " FOAM_MPI : $FOAM_MPI"
echo " MPI_ROOT : $MPI_ARCH_PATH"
endif
else
setenv MPI_ARCH_PATH /dummy
endif
if ( ! -d "$MPI_ARCH_PATH" ) then
echo "Warning in $WM_PROJECT_DIR/etc/config.csh/mpi:"
echo " Not a valid $WM_MPLIB installation directory."
echo " Please set I_MPI_ROOT or MPI_ROOT properly."
echo " Currently using '$MPI_ARCH_PATH'"
endif
_foamAddPath $MPI_ARCH_PATH/bin64
_foamAddLib $MPI_ARCH_PATH/lib64
breaksw
endsw
# Add (non-dummy) MPI implementation
# - dummy MPI already added to LD_LIBRARY_PATH and has no external libraries
if ( "$FOAM_MPI" != dummy ) then
if ( $?FOAM_EXT_LIBBIN ) then # External libraries (allowed to be unset)
_foamAddLib ${FOAM_EXT_LIBBIN}/${FOAM_MPI}
endif
_foamAddLib ${FOAM_LIBBIN}/${FOAM_MPI}
endif
# Alternative to 'mpiBufferSize' controlDict entry
#setenv MPI_BUFFER_SIZE 20000000
#------------------------------------------------------------------------------