CONFIG: improve flexibility of MPI specification

- it is now possible to include the selected mpi version in the
  top-level bashrc or prefs.sh file. For example,

      WM_MPLIB=OPENMPI-4.1.1  or  WM_MPLIB=openmpi-4.1.1

  after evaluation of the config.sh/mpi, this will define

      WM_MPLIB=OPENMPI-4.1.1  and  FOAM_MPI=openmpi-4.1.1

  During the wmake, the mpi-rules will first load the MPI 'family'
  rules (OPENMPI in this example) before trying to load
  version-specific rules if they exist.

  NOTE: the regular user-defined prefs system is unaffected by this
  change. This means it is still possible to use a file such as
  'prefs.openmpi' to define the preferred version instead or as well.
  However, it does mean inconsistent naming can be specified.
  For example, specify WM_MPLIB=OPENMPI-4.1.1 at the top-level but
  actually have FOAM_MPI=openmpi-4.0.6 in the prefs.openmpi file.
  This will make the value of WM_MPLIB misleading.

CONFIG: foamConfigurePaths support for sys-openmpi major version

CONFIG: cleanup any shadow env variables
This commit is contained in:
Mark Olesen
2021-10-26 10:08:18 +02:00
parent 36bb99da9b
commit 435be2e5ec
9 changed files with 693 additions and 293 deletions

View File

@ -25,6 +25,12 @@
# Basic sanity checks
[ -d "$FOAM_TUTORIALS" ] || echo "No OpenFOAM tutorials? : $FOAM_TUTORIALS" 1>&2
# Darwin workaround - SIP clearing DYLD_LIBRARY_PATH variable
if [ -n "$FOAM_DYLD_LIBRARY_PATH" ] && [ -z "$DYLD_LIBRARY_PATH" ]
then
export DYLD_LIBRARY_PATH="$FOAM_DYLD_LIBRARY_PATH"
fi
#------------------------------------------------------------------------------

View File

@ -7,7 +7,7 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# Copyright (C) 2011-2016 OpenFOAM Foundation
# Copyright (C) 2016-2020 OpenCFD Ltd.
# Copyright (C) 2016-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -42,11 +42,11 @@ printHelp() {
Obsolete options:
-foamInstall DIR [obsolete]
-projectName NAME [obsolete]
-sigfpe|-no-sigfpe [obsolete - now under etc/controlDict]
-archOption 32|64 [obsolete setting of 'WM_ARCH_OPTION' - edit manually]
-sigfpe|-no-sigfpe [obsolete] now under etc/controlDict
-archOption 32|64 [obsolete] now edit WM_ARCH_OPTION manually
Equivalent options:
-version -foamVersion --projectVersion
-version --projectVersion | -foamVersion
-archOption --archOption
-third -ThirdParty
-paraview --paraviewVersion | -paraviewVersion
@ -55,6 +55,8 @@ Equivalent options:
-scotch-path --scotchArchPath | -scotchArchPath
-system-compiler -system
-third-compiler -third
-sys-openmpi -openmpi-system
-openmpi -openmpi-third
HELP_COMPAT
exit 0 # A clean exit
@ -89,10 +91,9 @@ Compiler
mpc-VERSION For ThirdParty gcc (mpc-system for system library)
MPI
-mpi NAME specify 'WM_MPLIB' type (eg, INTELMPI, etc)
-openmpi VER use ThirdParty openmpi, with version for 'FOAM_MPI'
-openmpi-system use system openmpi
-openmpi-third use ThirdParty openmpi (using default version)
-mpi=NAME Specify 'WM_MPLIB' type (eg, INTELMPI, etc)
-openmpi[=VER] Use ThirdParty openmpi, with version for 'FOAM_MPI'
-sys-openmpi[=MAJ] Use system openmpi, with specified major version
Components versions (ThirdParty)
-adios VER specify 'adios2_version'
@ -120,12 +121,12 @@ Components specified by absolute path
-scotch-path DIR Path for 'SCOTCH_ARCH_PATH' (overrides -scotch)
Graphics
-paraview VER specify 'ParaView_VERSION' (eg, 5.4.1 or system)
-paraview VER specify 'ParaView_VERSION' (eg, 5.9.0 or system)
-paraview-qt VER specify 'ParaView_QT' (eg, qt-system)
-paraview-path DIR specify 'ParaView_DIR' (eg, /opt/ParaView-5.4.1)
-paraview-path DIR specify 'ParaView_DIR' (eg, /opt/ParaView-5.9.0)
-llvm VER specify 'mesa_llvm'
-mesa VER specify 'mesa_version' (eg, mesa-13.0.1)
-vtk VER specify 'vtk_version' (eg, VTK-7.1.0)
-vtk VER specify 'vtk_version' (eg, VTK-9.0.0)
-llvm-path DIR Path for 'LLVM_ARCH_PATH' (overrides -llvm)
-mesa-path DIR Path for 'MESA_ARCH_PATH' (overrides -mesa)
-vtk-path DIR Path for 'VTK_DIR' (overrides -vtk)
@ -212,12 +213,13 @@ _inlineSed()
# Local filename (for reporting)
localFile="$(echo "$file" | sed -e "s#^$projectDir/##")"
grep -q "$regexp" "$file" && sed -i -e "$cmd" "$file" || { \
if grep -q "$regexp" "$file" && sed -i -e "$cmd" "$file"
then
[ -n "$msg" ] && echo " $msg ($localFile)"
else
echo "Failed: ${msg:-replacement} in $localFile"
return 1
}
[ -n "$msg" ] && echo " $msg ($localFile)"
fi
return 0
}
@ -278,8 +280,8 @@ replaceEtc()
local file="$1"
shift
file=$(_foamEtc "$file")
replace $file "$@"
file="$(_foamEtc "$file")"
replace "$file" "$@"
}
@ -289,24 +291,36 @@ replaceEtcCsh()
local file="$1"
shift
file=$(_foamEtc "$file")
replaceCsh $file "$@"
file="$(_foamEtc "$file")"
replaceCsh "$file" "$@"
}
# Get the option's value (argument), or die on missing or empty argument
# $1 option
# $2 value
# Returns values via optValue, nOptArgs variables!!
optValue=""
nOptArgs=0 # The number of args to shift
getOptionValue()
{
local value="$2"
[ -n "$value" ] || die "'$1' option requires an argument"
optValue="${1#*=}"
if [ "$optValue" = "$1" ]
then
# Eg, -option value
optValue="$2"
[ -n "$optValue" ] || die "'$1' option requires an argument"
nOptArgs=1
else
# Eg, -option=value
nOptArgs=0
fi
# Remove any surrounding double quotes
value="${value%\"}"
value="${value#\"}"
echo "$value"
optValue="${optValue%\"}"
optValue="${optValue#\"}"
}
@ -366,7 +380,7 @@ removeCshMagic()
#------------------------------------------------------------------------------
unset adjusted optMpi
unset adjusted
# Parse options
while [ "$#" -gt 0 ]
do
@ -421,26 +435,37 @@ CONFIG_CSH
[ -n "$FOAM_CONFIG_ETC" ] || unset FOAM_CONFIG_ETC
;;
-project-path)
-project-path=* | -project-path)
# Replace WM_PROJECT_DIR=...
optionValue=$(getOptionValue "$@")
replaceEtc bashrc WM_PROJECT_DIR "\"$optionValue\""
replaceEtcCsh cshrc WM_PROJECT_DIR "\"$optionValue\""
getOptionValue "$@"
shift "${nOptArgs:-0}"
removeBashMagic $(_foamEtc bashrc)
removeCshMagic $(_foamEtc cshrc)
if [ -n "$optValue" ]
then
replaceEtc bashrc WM_PROJECT_DIR "\"$optValue\""
replaceEtcCsh cshrc WM_PROJECT_DIR "\"$optValue\""
adjusted=true
shift
removeBashMagic "$(_foamEtc bashrc)"
removeCshMagic "$(_foamEtc cshrc)"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-version | -foamVersion | --projectVersion)
-version=* | -version | -foamVersion | --projectVersion)
# Replace WM_PROJECT_VERSION=...
optionValue=$(getOptionValue "$@")
replaceEtc bashrc WM_PROJECT_VERSION "$optionValue"
replaceEtcCsh cshrc WM_PROJECT_VERSION "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc bashrc WM_PROJECT_VERSION "$optValue"
replaceEtcCsh cshrc WM_PROJECT_VERSION "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-sp | -SP | -float32)
@ -466,131 +491,168 @@ CONFIG_CSH
-int32 | -int64)
# Replace WM_LABEL_SIZE=...
optionValue="${1#-int}"
replaceEtc bashrc WM_LABEL_SIZE "$optionValue"
replaceEtcCsh cshrc WM_LABEL_SIZE "$optionValue"
optValue="${1#-int}"
replaceEtc bashrc WM_LABEL_SIZE "$optValue"
replaceEtcCsh cshrc WM_LABEL_SIZE "$optValue"
adjusted=true
;;
## Compiler ##
-clang)
-clang=* | -clang)
# Replace default_clang_version=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/compiler default_clang_version "$optionValue"
replaceEtc config.csh/compiler default_clang_version "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/compiler default_clang_version "$optValue"
replaceEtc config.csh/compiler default_clang_version "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-gcc)
-gcc=* | -gcc)
# Replace default_gcc_version=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/compiler default_gcc_version "$optionValue"
replaceEtc config.csh/compiler default_gcc_version "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/compiler default_gcc_version "$optValue"
replaceEtc config.csh/compiler default_gcc_version "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-system-compiler | -system)
# Replace WM_COMPILER_TYPE=... and WM_COMPILER=...
optionValue=$(getOptionValue "$@")
replaceEtc bashrc \
WM_COMPILER_TYPE system \
WM_COMPILER "$optionValue"
replaceEtcCsh cshrc \
WM_COMPILER_TYPE system \
WM_COMPILER "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc bashrc \
WM_COMPILER_TYPE system \
WM_COMPILER "$optValue"
replaceEtcCsh cshrc \
WM_COMPILER_TYPE system \
WM_COMPILER "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-third-compiler | -third | -ThirdParty)
# Replace WM_COMPILER_TYPE=... and WM_COMPILER=...
optionValue=$(getOptionValue "$@")
replaceEtc bashrc \
WM_COMPILER_TYPE ThirdParty \
WM_COMPILER "$optionValue"
replaceEtcCsh cshrc \
WM_COMPILER_TYPE ThirdParty \
WM_COMPILER "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc bashrc \
WM_COMPILER_TYPE ThirdParty \
WM_COMPILER "$optValue"
replaceEtcCsh cshrc \
WM_COMPILER_TYPE ThirdParty \
WM_COMPILER "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
gmp-[4-9]* | gmp-system)
# gcc-related package
replaceEtc config.sh/compiler default_gmp_version "$1"
replaceEtc config.csh/compiler default_gmp_version "$1"
optValue="${1#-}"
replaceEtc config.sh/compiler default_gmp_version "$optValue"
replaceEtc config.csh/compiler default_gmp_version "$optValue"
adjusted=true
;;
mpfr-[2-9]* | mpfr-system)
# gcc-related package
replaceEtc config.sh/compiler default_mpfr_version "$1"
replaceEtc config.csh/compiler default_mpfr_version "$1"
optValue="${1#-}"
replaceEtc config.sh/compiler default_mpfr_version "$optValue"
replaceEtc config.csh/compiler default_mpfr_version "$optValue"
adjusted=true
;;
mpc-[0-9]* | mpc-system)
# gcc-related package
replaceEtc config.sh/compiler default_mpc_version "$1"
replaceEtc config.csh/compiler default_mpc_version "$1"
optValue="${1#-}"
replaceEtc config.sh/compiler default_mpc_version "$optValue"
replaceEtc config.csh/compiler default_mpc_version "$optValue"
adjusted=true
;;
## MPI ##
-mpi)
-mpi=* | -mpi)
# Explicitly set WM_MPLIB=...
optionValue=$(getOptionValue "$@")
replaceEtc bashrc WM_MPLIB "$optionValue"
replaceEtcCsh cshrc WM_MPLIB "$optionValue"
optMpi=system
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc bashrc WM_MPLIB "$optValue"
replaceEtcCsh cshrc WM_MPLIB "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-openmpi)
# Replace FOAM_MPI=openmpi-<digits>.. and set to use third-party
# The edit is slightly fragile, but works
expected="openmpi-[1-9][.0-9]*"
optMpi=$(getOptionValue "$@")
_matches "$optMpi" "$expected" || \
die "'$1' has bad value: '$optMpi'"
_inlineSed $(_foamEtc config.sh/mpi) \
"FOAM_MPI=$expected" \
"FOAM_MPI=$optMpi" \
"Replaced 'FOAM_MPI=$expected' by 'FOAM_MPI=$optMpi'"
_inlineSed $(_foamEtc config.csh/mpi) \
"FOAM_MPI $expected" \
"FOAM_MPI $optMpi" \
"Replaced 'FOAM_MPI $expected' by 'FOAM_MPI $optMpi'"
replaceEtc bashrc WM_MPLIB OPENMPI
replaceEtcCsh cshrc WM_MPLIB OPENMPI
adjusted=true
shift
;;
-openmpi-system)
-sys-openmpi=* | -sys-openmpi | -openmpi-system)
optValue="$(echo "$1" | sed -ne 's/^.*mpi=\([1-9][0-9]*\).*/\1/p')"
# Explicitly set WM_MPLIB=SYSTEMOPENMPI
replaceEtc bashrc WM_MPLIB SYSTEMOPENMPI
replaceEtcCsh cshrc WM_MPLIB SYSTEMOPENMPI
optMpi=system
adjusted=true
if [ -n "$optValue" ]
then
replaceEtc bashrc WM_MPLIB SYSTEMOPENMPI"$optValue"
replaceEtcCsh cshrc WM_MPLIB SYSTEMOPENMPI"$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-openmpi-third)
# Explicitly set WM_MPLIB=OPENMPI, using default setting for openmpi
-openmpi=* | -openmpi | -openmpi-third)
# Explicitly set WM_MPLIB=OPENMPI
# - use default setting for openmpi, or
# replace FOAM_MPI=openmpi-<digits>..
# The edit is slightly fragile, but works
expected="openmpi-[1-9][.0-9]*"
optValue="$(echo "$1" | sed -ne 's/^.*mpi=//p')"
if [ -n "$optValue" ]
then
if [ "${optValue#openmpi-}" = "$optValue" ]
then
optValue="openmpi-$optValue"
fi
_matches "$optValue" "$expected" || \
die "'${1%=*}' has bad value: '$optValue'"
_inlineSed "$(_foamEtc config.sh/mpi)" \
"FOAM_MPI=$expected" \
"FOAM_MPI=$optValue" \
"Replaced 'FOAM_MPI=$expected' by 'FOAM_MPI=$optValue'"
_inlineSed "$(_foamEtc config.csh/mpi)" \
"FOAM_MPI=$expected" \
"FOAM_MPI=$optValue" \
"Replaced 'FOAM_MPI $expected' by 'FOAM_MPI $optValue'"
fi
replaceEtc bashrc WM_MPLIB OPENMPI
replaceEtcCsh cshrc WM_MPLIB OPENMPI
optMpi=third
adjusted=true
;;
@ -599,146 +661,242 @@ CONFIG_CSH
-adios | -adios2)
# Replace adios2_version=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/adios2 adios2_version "$optionValue"
replaceEtc config.csh/adios2 adios2_version "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/adios2 adios2_version "$optValue"
replaceEtc config.csh/adios2 adios2_version "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-adios-path | -adios2-path)
# Replace ADIOS2_ARCH_PATH=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/adios2 ADIOS2_ARCH_PATH "\"$optionValue\""
replaceEtcCsh config.csh/adios2 ADIOS2_ARCH_PATH "\"$optionValue\""
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/adios2 ADIOS2_ARCH_PATH "\"$optValue\""
replaceEtcCsh config.csh/adios2 ADIOS2_ARCH_PATH "\"$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-boost)
# Replace boost_version=... (config is cgal or CGAL)
optionValue=$(getOptionValue "$@")
getOptionValue "$@"
shift "${nOptArgs:-0}"
cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL
replaceEtc config.sh/"$cfgName" boost_version "$optionValue"
replaceEtc config.csh/"$cfgName" boost_version "$optionValue"
adjusted=true
shift
if [ -n "$optValue" ]
then
replaceEtc config.sh/"$cfgName" boost_version "$optValue"
replaceEtc config.csh/"$cfgName" boost_version "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-boost-path)
# Replace BOOST_ARCH_PATH=... (config is cgal or CGAL)
optionValue=$(getOptionValue "$@")
getOptionValue "$@"
shift "${nOptArgs:-0}"
cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL
replaceEtc config.sh/"$cfgName" BOOST_ARCH_PATH "\"$optionValue\""
replaceEtc config.csh/"$cfgName" BOOST_ARCH_PATH "\"$optionValue\""
adjusted=true
shift
if [ -n "$optValue" ]
then
replaceEtc config.sh/"$cfgName" BOOST_ARCH_PATH "\"$optValue\""
replaceEtc config.csh/"$cfgName" BOOST_ARCH_PATH "\"$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-cgal)
# Replace cgal_version=... (config is cgal or CGAL)
optionValue=$(getOptionValue "$@")
getOptionValue "$@"
shift "${nOptArgs:-0}"
cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL
replaceEtc config.sh/"$cfgName" cgal_version "$optionValue"
replaceEtc config.csh/"$cfgName" cgal_version "$optionValue"
adjusted=true
shift
if [ -n "$optValue" ]
then
replaceEtc config.sh/"$cfgName" cgal_version "$optValue"
replaceEtc config.csh/"$cfgName" cgal_version "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-cgal-path)
# Replace CGAL_ARCH_PATH=... (config is cgal or CGAL)
optionValue=$(getOptionValue "$@")
getOptionValue "$@"
shift "${nOptArgs:-0}"
cfgName=cgal; _foamEtc -q config.sh/"$cfgName" || cfgName=CGAL
replaceEtc config.sh/"$cfgName" CGAL_ARCH_PATH "$optionValue"
replaceEtcCsh config.csh/"$cfgName" CGAL_ARCH_PATH "$optionValue"
adjusted=true
shift
if [ -n "$optValue" ]
then
replaceEtc config.sh/"$cfgName" CGAL_ARCH_PATH "$optValue"
replaceEtcCsh config.csh/"$cfgName" CGAL_ARCH_PATH "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-fftw)
# Replace fftw_version=...
optionValue=$(getOptionValue "$@")
getOptionValue "$@"
shift "${nOptArgs:-0}"
# config.sh/fftw or config.sh/FFTW
cfgName=fftw; _foamEtc -q config.sh/"$cfgName" || cfgName=FFTW
replaceEtc config.sh/"$cfgName" fftw_version "$optionValue"
replaceEtc config.csh/"$cfgName" fftw_version "$optionValue"
adjusted=true
shift
if [ -n "$optValue" ]
then
replaceEtc config.sh/"$cfgName" fftw_version "$optValue"
replaceEtc config.csh/"$cfgName" fftw_version "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-fftw-path)
# Replace FFTW_ARCH_PATH=...
optionValue=$(getOptionValue "$@")
getOptionValue "$@"
shift "${nOptArgs:-0}"
# config.sh/fftw or config.sh/FFTW
cfgName=fftw; _foamEtc -q config.sh/"$cfgName" || cfgName=FFTW
replaceEtc config.sh/"$cfgName" FFTW_ARCH_PATH "\"$optionValue\""
replaceEtcCsh config.csh/"$cfgName" FFTW_ARCH_PATH "\"$optionValue\""
adjusted=true
shift
if [ -n "$optValue" ]
then
replaceEtc config.sh/"$cfgName" FFTW_ARCH_PATH "\"$optValue\""
replaceEtcCsh config.csh/"$cfgName" FFTW_ARCH_PATH "\"$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-cmake)
# Replace cmake_version=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/cmake cmake_version "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/cmake cmake_version "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-cmake-path)
# Replace CMAKE_ARCH_PATH=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/cmake CMAKE_ARCH_PATH "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/cmake CMAKE_ARCH_PATH "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-kahip)
# Replace KAHIP_VERSION=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/kahip KAHIP_VERSION "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/kahip KAHIP_VERSION "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-kahip-path)
# Replace KAHIP_ARCH_PATH=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/kahip KAHIP_ARCH_PATH "\"$optionValue\""
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/kahip KAHIP_ARCH_PATH "\"$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-metis)
# Replace METIS_VERSION=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/metis METIS_VERSION "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/metis METIS_VERSION "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-metis-path)
# Replace METIS_ARCH_PATH=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/metis METIS_ARCH_PATH "\"$optionValue\""
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/metis METIS_ARCH_PATH "\"$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-scotch | -scotchVersion | --scotchVersion)
# Replace SCOTCH_VERSION=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/scotch SCOTCH_VERSION "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/scotch SCOTCH_VERSION "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-scotch-path | -scotchArchPath | --scotchArchPath)
# Replace SCOTCH_ARCH_PATH=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/scotch SCOTCH_ARCH_PATH "\"$optionValue\""
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/scotch SCOTCH_ARCH_PATH "\"$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
@ -747,107 +905,156 @@ CONFIG_CSH
-paraview | -paraviewVersion | --paraviewVersion)
# Replace ParaView_VERSION=...
expected="[5-9][.0-9]*" # but also accept system
optionValue=$(getOptionValue "$@")
_matches "$optionValue" "$expected" || \
[ "$optionValue" != "${optionValue%system}" ] || \
die "'$1' has bad value: '$optionValue'"
replaceEtc config.sh/paraview ParaView_VERSION "$optionValue"
replaceEtc config.csh/paraview ParaView_VERSION "$optionValue"
adjusted=true
shift
getOptionValue "$@"
_matches "$optValue" "$expected" || \
[ "$optValue" != "${optValue%system}" ] || \
die "'${1%=*}' has bad value: '$optValue'"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/paraview ParaView_VERSION "$optValue"
replaceEtc config.csh/paraview ParaView_VERSION "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-paraview-qt)
# Replace ParaView_QT=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/paraview ParaView_QT "$optionValue"
replaceEtc config.csh/paraview ParaView_QT "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/paraview ParaView_QT "$optValue"
replaceEtc config.csh/paraview ParaView_QT "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-paraview-path | -paraviewInstall | --paraviewInstall)
# Replace ParaView_DIR=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/paraview ParaView_DIR \""$optionValue\""
replaceEtcCsh config.csh/paraview ParaView_DIR \""$optionValue\""
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/paraview ParaView_DIR \""$optValue\""
replaceEtcCsh config.csh/paraview ParaView_DIR \""$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-llvm)
# Replace mesa_llvm=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/vtk mesa_llvm "$optionValue"
replaceEtc config.csh/vtk mesa_llvm "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/vtk mesa_llvm "$optValue"
replaceEtc config.csh/vtk mesa_llvm "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-mesa)
# Replace mesa_version=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/vtk mesa_version "$optionValue"
replaceEtc config.csh/vtk mesa_version "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/vtk mesa_version "$optValue"
replaceEtc config.csh/vtk mesa_version "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-vtk)
# Replace vtk_version=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/vtk vtk_version "$optionValue"
replaceEtc config.csh/vtk vtk_version "$optionValue"
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/vtk vtk_version "$optValue"
replaceEtc config.csh/vtk vtk_version "$optValue"
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-llvm-path)
# Replace LLVM_ARCH_PATH=...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/vtk LLVM_ARCH_PATH \""$optionValue\""
replaceEtcCsh config.csh/vtk LLVM_ARCH_PATH \""$optionValue\""
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/vtk LLVM_ARCH_PATH \""$optValue\""
replaceEtcCsh config.csh/vtk LLVM_ARCH_PATH \""$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-mesa-path)
# Replace MESA_ARCH_PATH...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/vtk MESA_ARCH_PATH \""$optionValue\""
replaceEtcCsh config.csh/vtk MESA_ARCH_PATH \""$optionValue\""
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/vtk MESA_ARCH_PATH \""$optValue\""
replaceEtcCsh config.csh/vtk MESA_ARCH_PATH \""$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
-vtk-path)
# Replace VTK_DIR...
optionValue=$(getOptionValue "$@")
replaceEtc config.sh/vtk VTK_DIR \""$optionValue\""
replaceEtcCsh config.csh/vtk VTK_DIR \""$optionValue\""
adjusted=true
shift
getOptionValue "$@"
shift "${nOptArgs:-0}"
if [ -n "$optValue" ]
then
replaceEtc config.sh/vtk VTK_DIR \""$optValue\""
replaceEtcCsh config.csh/vtk VTK_DIR \""$optValue\""
adjusted=true
else
: "${adjusted:=empty}"
fi
;;
## Misc ##
# Obsolete flags
-sigfpe | -no-sigfpe)
echo "Enable/disable FOAM_SIGFPE now via controlDict" 1>&2
;;
-archOption | --archOption)
# Replace WM_ARCH_OPTION=...
optionValue=$(getOptionValue "$@")
echo "Ignoring $1 option: no longer supported" 1>&2
shift
;;
# Obsolete options
-archOption | --archOption | \
-foamInstall | --foamInstall | -projectName | --projectName)
# Removed for 1812
optionValue=$(getOptionValue "$@")
echo "Ignoring $1 option: obsolete" 1>&2
shift
echo "Ignoring obsolete option: $1" 1>&2
getOptionValue "$@"
shift "${nOptArgs:-0}"
;;
*)

View File

@ -27,7 +27,7 @@
# _foamClean : eval call to foamCleanPath for specific shell
# _foamEcho : silent/non-silent echo
# _foamEtc : resolve etc files (silent or verbose)
# _foamAddPath : prepend to MANPATH
# _foamAddPath : prepend to PATH
# _foamAddMan : prepend to MANPATH
# _foamAddLib : prepend to [DY]LD_LIBRARY_PATH
# _foamAddLibAuto: call to lib-dir for lib64/lib resolved name

View File

@ -49,7 +49,7 @@
unsetenv MPI_HOME
setenv FOAM_MPI dummy # Fallback value
setenv MPI_ARCH_PATH # Empty, but defined
set _foamMpiVersion # Track mpi (major) version as required
set _foamMpiVersion # Track mpi version as required
# Location for ThirdParty installations
set _foamMpiPrefixDir="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER"
@ -59,18 +59,28 @@ set _foamMpiWarning="openfoam (etc/config.csh/mpi) => " # Prefix for warnings
switch ("$WM_MPLIB")
# The system openmpi, discover locations via <mpicc>
# ----
# The system openmpi, discover locations by orte-info, mpicc or orterun
# Preserve major or full version for the naming
case sys-openmpi[1-9]:
case sys-openmpi-[1-9]*:
case SYSTEMOPENMPI[1-9]:
# Preserve major version for the naming
set _foamMpiVersion=`echo "$WM_MPLIB" | sed -e 's#^.*MPI##'`
#[fallthrough]
case SYSTEMOPENMPI-[1-9]*:
# Preserve version or full version for the naming
set _foamMpiVersion=`echo "$WM_MPLIB" | sed -e 's#^.*MPI##i'`
#[[fallthrough]]
case sys-openmpi:
case SYSTEMOPENMPI:
setenv FOAM_MPI "sys-openmpi${_foamMpiVersion}"
setenv WM_MPLIB "SYSTEMOPENMPI${_foamMpiVersion}"
# Undefine OPAL_PREFIX if set to one of the paths on foamOldDirs?
_foamEtc -config prefs.sys-openmpi ## Optional adjustments
# MPI_ARCH_PATH (prefs) if a valid dir, or discover via <mpicc>
# MPI_ARCH_PATH (prefs) if a valid dir, or need to discover
if ( -d "$MPI_ARCH_PATH" ) then
_foamAddPath "$MPI_ARCH_PATH"/bin
_foamAddLibAuto "$MPI_ARCH_PATH"
else
setenv MPI_ARCH_PATH
@ -139,8 +149,21 @@ case SYSTEMOPENMPI:
breaksw
# ----
case openmpi:
case openmpi-[1-9]*:
case OPENMPI:
case OPENMPI-[1-9]*:
setenv FOAM_MPI openmpi-4.0.3
## Add version embedded in the naming
set _foamMpiVersion=`echo "$WM_MPLIB" | sed -e 's#[^-]*-##'`
if ( "$_foamMpiVersion" != "$WM_MPLIB" ) then
setenv FOAM_MPI "openmpi-${_foamMpiVersion}"
setenv WM_MPLIB "OPENMPI-${_foamMpiVersion}"
else
setenv WM_MPLIB OPENMPI
endif
_foamEtc -config prefs.openmpi ## Optional adjustments
# MPI_ARCH_PATH (prefs) if a valid dir, or ThirdParty location
@ -159,6 +182,7 @@ case OPENMPI:
breaksw
# ----
# Arbitrary, user-specified mpi implementation
# - used by spack, which populates appropriate wmake rules
case USERMPI:
@ -167,14 +191,18 @@ case USERMPI:
breaksw
# ----
# EasyBuild handles everything via <mpicc>
case EASYBUILDMPI:
setenv FOAM_MPI eb-mpi
breaksw
# ----
case sys-mpi:
case SYSTEMMPI:
setenv FOAM_MPI sys-mpi
setenv WM_MPLIB SYSTEMMPI
_foamEtc -config prefs.sys-mpi ## Optional adjustments
# MPI_ARCH_PATH (prefs) or MPI_ROOT (inherited), in that order
@ -215,8 +243,21 @@ case SYSTEMMPI:
breaksw
# ----
case mpich:
case mpich-[1-9]*:
case MPICH:
case MPICH-[1-9]*:
setenv FOAM_MPI mpich-3.3
## Add version embedded in the naming
set _foamMpiVersion=`echo "$WM_MPLIB" | sed -e 's#[^-]*-##'`
if ( "$_foamMpiVersion" != "$WM_MPLIB" ) then
setenv FOAM_MPI "mpich-${_foamMpiVersion}"
setenv WM_MPLIB "MPICH-${_foamMpiVersion}"
else
setenv WM_MPLIB MPICH
endif
_foamEtc -config prefs.mpich ## Optional adjustments
# MPI_ARCH_PATH (prefs) if a valid dir, or use ThirdParty location
@ -233,6 +274,7 @@ case MPICH:
breaksw
# ----
case MPICH-GM:
setenv FOAM_MPI mpich-gm
_foamEtc -config prefs.mpich-gm ## Optional adjustments
@ -253,9 +295,22 @@ case MPICH-GM:
breaksw
# ----
# MVAPICH2, renamed to contain 'MPI' in its name
case mvapich2:
case mvapich2-[1-9]*:
case MVA2MPI:
case MVA2MPI-[1-9]*:
setenv FOAM_MPI mvapich2-2.3
## Add version embedded in the naming
set _foamMpiVersion=`echo "$WM_MPLIB" | sed -e 's#[^-]*-##'`
if ( "$_foamMpiVersion" != "$WM_MPLIB" ) then
setenv FOAM_MPI "mvapich2-${_foamMpiVersion}"
setenv WM_MPLIB "MVA2MPI-${_foamMpiVersion}"
else
setenv WM_MPLIB MVA2MPI
endif
_foamEtc -config prefs.mvapich2 ## Optional adjustments
# MPI_ARCH_PATH (prefs) if a valid dir, or ThirdParty location
@ -271,6 +326,7 @@ case MVA2MPI:
breaksw
# ----
case CRAY-MPICH:
setenv FOAM_MPI cray-mpich
if ( ! $?MPICH_DIR ) setenv MPICH_DIR /dummy
@ -289,6 +345,7 @@ case CRAY-MPICH:
breaksw
# ----
case HPMPI:
setenv FOAM_MPI hpmpi
setenv MPI_HOME /opt/hpmpi
@ -317,12 +374,14 @@ case HPMPI:
breaksw
# ----
case MPI:
setenv FOAM_MPI mpi
setenv MPI_ARCH_PATH /opt/mpi
breaksw
# ----
case FJMPI:
setenv FOAM_MPI fjmpi
_foamEtc -config prefs.fjmpi ## Optional adjustments
@ -346,6 +405,7 @@ case FJMPI:
breaksw
# ----
case QSMPI:
setenv FOAM_MPI qsmpi
setenv MPI_ARCH_PATH /usr/lib/mpi
@ -355,6 +415,7 @@ case QSMPI:
breaksw
# ----
case SGIMPI:
if ( ! $?MPI_ROOT ) setenv MPI_ROOT /dummy
if ( "${MPI_ROOT:h}/" == "$MPI_ROOT" ) then
@ -375,8 +436,22 @@ case SGIMPI:
breaksw
case INTELMPI*:
# ----
case intelmpi:
case intelmpi-[1-9]*:
case INTELMPI:
case INTELMPI-[1-9]*:
setenv FOAM_MPI intelmpi
## Add version embedded in the naming
set _foamMpiVersion=`echo "$WM_MPLIB" | sed -e 's#[^-]*-##'`
if ( "$_foamMpiVersion" != "$WM_MPLIB" ) then
setenv FOAM_MPI "intelmpi-${_foamMpiVersion}"
setenv WM_MPLIB "INTELMPI-${_foamMpiVersion}"
else
setenv WM_MPLIB INTELMPI
set _foamMpiVersion=latest ## Fallback value
endif
_foamEtc -config prefs.intelmpi ## Optional adjustments
if ( $?I_MPI_ROOT ) then
@ -389,10 +464,14 @@ case INTELMPI*:
# MPI_ARCH_PATH: Set I_MPI_ROOT accordingly
setenv I_MPI_ROOT "$MPI_ARCH_PATH"
else
# Final effort - check ThirdParty opt/intel locations for 'latest'
# Final effort - check ThirdParty opt/intel locations,
# default is 'latest' unless otherwise specified
if ( "$_foamMpiVersion" == "" ) set _foamMpiVersion=latest
foreach _foamFoundDir (\
"$WM_THIRD_PARTY_DIR/opt/intel/oneapi/mpi/latest" \
"$WM_THIRD_PARTY_DIR/opt/intel/mpi/latest" \
"$WM_THIRD_PARTY_DIR/opt/intel/oneapi/mpi/$_foamMpiVersion" \
"$WM_THIRD_PARTY_DIR/opt/intel/mpi/$_foamMpiVersion" \
)
if ( -d "$_foamFoundDir" ) then
setenv MPI_ARCH_PATH "$_foamFoundDir"
@ -444,8 +523,21 @@ case INTELMPI*:
breaksw
# ----
case msmpi:
case msmpi-[1-9]*:
case MSMPI:
case MSMPI-[1-9]*:
setenv FOAM_MPI msmpi
## Add version embedded in the naming
set _foamMpiVersion=`echo "$WM_MPLIB" | sed -e 's#[^-]*-##'`
if ( "$_foamMpiVersion" != "$WM_MPLIB" ) then
setenv FOAM_MPI "msmpi-${_foamMpiVersion}"
setenv WM_MPLIB "MSMPI-${_foamMpiVersion}"
else
setenv WM_MPLIB MSMPI
endif
_foamEtc -config prefs.msmpi ## Optional adjustments
# MPI_ARCH_PATH (prefs) if a valid dir, or ThirdParty location
@ -473,13 +565,21 @@ endsw
#------------------------------------------------------------------------------
# Final
# Define fallback value for no MPI
if ( ! $?FOAM_MPI ) then
setenv FOAM_MPI dummy
else if ( "$FOAM_MPI" == "" ) then
setenv FOAM_MPI dummy
endif
# Report
if ($?FOAM_VERBOSE && $?prompt) then
echo "Using mpi type : $WM_MPLIB"
echo " FOAM_MPI : $FOAM_MPI"
if ( "${MPI_ARCH_PATH}" == "" ) then
echo " prefix : unset"
echo " prefix : []"
else
echo " prefix : $MPI_ARCH_PATH"
endif

View File

@ -116,7 +116,14 @@ unsetenv FOAM_INST_DIR
unsetenv MPI_ARCH_PATH
unsetenv MPI_BUFFER_SIZE
unsetenv OPAL_PREFIX
# Cleanup mpi prefix values if set to one of the paths on foamOldDirs
if ( $?foamClean ) then
# openmpi:
if ( "`$foamClean -env=OPAL_PREFIX $foamOldDirs`" == "" ) unsetenv OPAL_PREFIX
# intelmpi:
if ( "`$foamClean -env=I_MPI_ROOT $foamOldDirs`" == "" ) unsetenv I_MPI_ROOT
endif
#------------------------------------------------------------------------------
@ -175,6 +182,8 @@ if ($?DYLD_LIBRARY_PATH) then
if ("${DYLD_LIBRARY_PATH}" == "") unsetenv DYLD_LIBRARY_PATH
endif
# Remove any shadow env variables
unsetenv FOAM_DYLD_LIBRARY_PATH
#------------------------------------------------------------------------------
# Cleanup aliases
@ -221,6 +230,6 @@ endif
#------------------------------------------------------------------------------
# Intermediate variables (do as last for a clean exit code)
unset cleaned foamClean foamOldDirs
unset cleaned foamClean foamOldDirs _foamFoundDir
#------------------------------------------------------------------------------

View File

@ -29,7 +29,7 @@
# _foamClean : eval call to foamCleanPath for specific shell
# _foamEcho : silent/non-silent echo
# _foamEtc : resolve etc files (silent or verbose)
# _foamAddPath : prepend to MANPATH
# _foamAddPath : prepend to PATH
# _foamAddMan : prepend to MANPATH
# _foamAddLib : prepend to [DY]LD_LIBRARY_PATH
# _foamAddLibAuto: prepend to lib64/lib resolved name

View File

@ -46,29 +46,49 @@
#------------------------------------------------------------------------------
unset MPI_ARCH_PATH MPI_HOME
export FOAM_MPI=dummy # Fallback value
unset _foamMpiVersion # Track mpi (major) version as required
unset _foamMpiVersion # Track mpi version as required
# Location for ThirdParty installations
_foamMpiPrefixDir="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER"
_foamMpiWarning="openfoam (etc/config.sh/mpi) => " # Prefix for warnings
# Version embedded in the naming
# $1 = mpi family (eg, openmpi, mpich, ...)
# Eg, _foamMpiEmbedVersion openmpi OPENMPI
unset -f _foamMpiEmbedVersion 2>/dev/null
_foamMpiEmbedVersion()
{
# Version embedded in the naming. Eg, OPENMPI-4.0.3
_foamMpiVersion="${WM_MPLIB#*-}"
if [ -n "$_foamMpiVersion" ] && [ "$_foamMpiVersion" != "$WM_MPLIB" ]
then
[ -n "$1" ] && FOAM_MPI="${1}-${_foamMpiVersion}"
[ -n "$2" ] && WM_MPLIB="${2}-${_foamMpiVersion}"
else
[ -n "$2" ] && WM_MPLIB="${2}"
unset _foamMpiVersion # Extra safety
fi
}
#------------------------------------------------------------------------------
case "$WM_MPLIB" in
# The system openmpi, discover locations via <mpicc>
# Preserve major version for the naming
SYSTEMOPENMPI | SYSTEMOPENMPI[1-9])
# Preserve major version for the naming
# ----
# The system openmpi, discover locations by orte-info, mpicc or orterun
# Preserve major or full version for the naming
sys-openmpi | sys-openmpi[1-9] | sys-openmpi-[1-9]* |\
SYSTEMOPENMPI | SYSTEMOPENMPI[1-9] | SYSTEMOPENMPI-[1-9]*)
# Preserve version or full version for the naming
_foamMpiVersion="${WM_MPLIB##*MPI}"
_foamMpiVersion="${_foamMpiVersion##*mpi}"
export FOAM_MPI="sys-openmpi${_foamMpiVersion}"
export WM_MPLIB="SYSTEMOPENMPI${_foamMpiVersion}"
# Undefine OPAL_PREFIX if set to one of the paths on foamOldDirs
if [ -z "$($foamClean -env=OPAL_PREFIX "$foamOldDirs")" ]
then
unset OPAL_PREFIX
fi
[ -z "$($foamClean -env=OPAL_PREFIX "$foamOldDirs")" ] && unset OPAL_PREFIX
_foamEtc -config prefs.sys-openmpi ## Optional adjustments
unset _foamFoundCmd
@ -76,6 +96,7 @@ SYSTEMOPENMPI | SYSTEMOPENMPI[1-9])
# MPI_ARCH_PATH (prefs) if a valid dir, or need to discover
if [ -d "$MPI_ARCH_PATH" ]
then
_foamAddPath "$MPI_ARCH_PATH"/bin
_foamAddLibAuto "$MPI_ARCH_PATH"
else
unset MPI_ARCH_PATH
@ -145,8 +166,12 @@ SYSTEMOPENMPI | SYSTEMOPENMPI[1-9])
;;
OPENMPI)
# ----
openmpi | openmpi-[1-9]* |\
OPENMPI | OPENMPI-[1-9]* )
export FOAM_MPI=openmpi-4.0.3
_foamMpiEmbedVersion openmpi OPENMPI
_foamEtc -config prefs.openmpi ## Optional adjustments
# MPI_ARCH_PATH (prefs) if a valid dir, or ThirdParty location
@ -168,6 +193,7 @@ OPENMPI)
;;
# ----
# Arbitrary, user-specified mpi implementation
# - used by spack, which populates appropriate wmake rules
USERMPI)
@ -176,14 +202,19 @@ USERMPI)
;;
# ----
# EasyBuild handles everything via <mpicc>
EASYBUILDMPI)
export FOAM_MPI=eb-mpi
;;
# ----
sys-mpi |\
SYSTEMMPI)
export FOAM_MPI=sys-mpi
export WM_MPLIB=SYSTEMMPI
_foamEtc -config prefs.sys-mpi ## Optional adjustments
# MPI_ARCH_PATH (prefs) or MPI_ROOT (inherited), in that order
@ -230,8 +261,12 @@ SYSTEMMPI)
;;
MPICH)
# ----
mpich | mpich-[1-9]* |\
MPICH | MPICH-[1-9]* )
export FOAM_MPI=mpich-3.3
_foamMpiEmbedVersion mpich MPICH
_foamEtc -config prefs.mpich ## Optional adjustments
# MPI_ARCH_PATH (prefs) if a valid dir, or use ThirdParty location
@ -252,6 +287,7 @@ MPICH)
;;
# ----
MPICH-GM)
export FOAM_MPI=mpich-gm
_foamEtc -config prefs.mpich-gm ## Optional adjustments
@ -274,9 +310,13 @@ MPICH-GM)
;;
# ----
# MVAPICH2, renamed to contain 'MPI' in its name
MVA2MPI)
mvapich2 | mvapich2-[1-9]* |\
MVA2MPI | MVA2MPI-[1-9]* )
export FOAM_MPI=mvapich2-2.3
_foamMpiEmbedVersion mvapich2 MVA2MPI
_foamEtc -config prefs.mvapich2 ## Optional adjustments
# MPI_ARCH_PATH (prefs) if a valid dir, or ThirdParty location
@ -295,6 +335,7 @@ MVA2MPI)
;;
# ----
CRAY-MPICH)
export FOAM_MPI=cray-mpich
export MPI_ARCH_PATH="$MPICH_DIR"
@ -313,6 +354,7 @@ CRAY-MPICH)
;;
# ----
HPMPI)
export FOAM_MPI=hpmpi
export MPI_HOME=/opt/hpmpi
@ -336,12 +378,14 @@ HPMPI)
;;
# ----
MPI)
export FOAM_MPI=mpi
export MPI_ARCH_PATH=/opt/mpi
;;
# ----
FJMPI)
export FOAM_MPI=fjmpi
_foamEtc -config prefs.fjmpi ## Optional adjustments
@ -368,6 +412,7 @@ FJMPI)
;;
# ----
QSMPI)
export FOAM_MPI=qsmpi
export MPI_ARCH_PATH=/usr/lib/mpi
@ -377,6 +422,7 @@ QSMPI)
;;
# ----
SGIMPI)
: "${MPI_ROOT:=/dummy}"
MPI_ROOT="${MPI_ROOT%/}" # Remove trailing slash
@ -395,8 +441,15 @@ SGIMPI)
;;
INTELMPI*)
# ----
intelmpi | intelmpi-[1-9]* |\
INTELMPI | INTELMPI-[1-9]* )
export FOAM_MPI=intelmpi
_foamMpiEmbedVersion intelmpi INTELMPI
# Undefine I_MPI_ROOT if set to one of the paths on foamOldDirs
[ -z "$($foamClean -env=I_MPI_ROOT "$foamOldDirs")" ] && unset I_MPI_ROOT
_foamEtc -config prefs.intelmpi ## Optional adjustments
if [ -n "$I_MPI_ROOT" ]
@ -415,10 +468,14 @@ INTELMPI*)
export I_MPI_ROOT="$MPI_ARCH_PATH"
else
# Final effort - check ThirdParty opt/intel locations for 'latest'
# Final effort - check ThirdParty opt/intel locations,
# default is 'latest' unless otherwise specified
[ -n "${_foamMpiVersion}" ] || _foamMpiVersion=latest
for _foamFoundDir in \
"$WM_THIRD_PARTY_DIR/opt/intel/oneapi/mpi/latest" \
"$WM_THIRD_PARTY_DIR/opt/intel/mpi/latest" \
"$WM_THIRD_PARTY_DIR/opt/intel/oneapi/mpi/$_foamMpiVersion" \
"$WM_THIRD_PARTY_DIR/opt/intel/mpi/$_foamMpiVersion" \
;
do
if [ -d "$_foamFoundDir" ]
@ -478,8 +535,12 @@ INTELMPI*)
;;
MSMPI)
# ----
msmpi | msmpi-[1-9]* |\
MSMPI | MSMPI-[1-9]* )
export FOAM_MPI=msmpi
_foamMpiEmbedVersion msmpi MSMPI
_foamEtc -config prefs.msmpi ## Optional adjustments
# MPI_ARCH_PATH (prefs) if a valid dir, or ThirdParty location
@ -513,6 +574,9 @@ esac
#------------------------------------------------------------------------------
# Final
: "${FOAM_MPI:=dummy}" # Fallback value for no MPI
export FOAM_MPI
# Ensure MPI_ARCH_PATH is marked for export
[ -n "$MPI_ARCH_PATH" ] && export MPI_ARCH_PATH
@ -521,10 +585,11 @@ if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
then
echo "Using mpi type : $WM_MPLIB" 1>&2
echo " FOAM_MPI : $FOAM_MPI" 1>&2
echo " prefix : ${MPI_ARCH_PATH:-[unset]}" 1>&2
echo " prefix : ${MPI_ARCH_PATH:-[]}" 1>&2
fi
# Cleanup
unset _foamMpiPrefixDir _foamMpiVersion _foamMpiWarning
unset -f _foamMpiEmbedVersion 2>/dev/null
#------------------------------------------------------------------------------

View File

@ -106,10 +106,13 @@ unset FOAM_INST_DIR
unset MPI_ARCH_PATH
unset MPI_BUFFER_SIZE
# Undefine OPAL_PREFIX if set to one of the paths on foamOldDirs
if [ -n "$foamClean" ] && [ -z "$($foamClean -env=OPAL_PREFIX $foamOldDirs)" ]
# Cleanup mpi prefix values if set to one of the paths on foamOldDirs
if [ -n "$foamClean" ]
then
unset OPAL_PREFIX
# openmpi:
[ -z "$($foamClean -env=OPAL_PREFIX $foamOldDirs)" ] && unset OPAL_PREFIX
# intelmpi:
[ -z "$($foamClean -env=I_MPI_ROOT $foamOldDirs)" ] && unset I_MPI_ROOT
fi
#------------------------------------------------------------------------------
@ -163,6 +166,9 @@ fi
[ -n "$LD_LIBRARY_PATH" ] || unset LD_LIBRARY_PATH
[ -n "$DYLD_LIBRARY_PATH" ] || unset DYLD_LIBRARY_PATH
# Remove any shadow env variables
unset FOAM_DYLD_LIBRARY_PATH
#------------------------------------------------------------------------------
# Cleanup aliases and functions
@ -220,6 +226,6 @@ unset _of_complete_cache_
#------------------------------------------------------------------------------
# Intermediate variables (do as last for a clean exit code)
unset cleaned foamClean foamOldDirs
unset cleaned foamClean foamOldDirs _foamFoundDir
#------------------------------------------------------------------------------

View File

@ -5,20 +5,27 @@ PFLAGS =
PINC =
PLIBS =
# The stem name. Eg, SYSTEMOPENMPI4 -> SYSTEMOPENMPI
MPLIB_STEMNAME = $(shell echo "$(WM_MPLIB)" | sed -e 's/[-.0-9]*$$//')
# Extract the family name. For example,
# SYSTEMOPENMPI4 -> SYSTEMOPENMPI
# OPENMPI-4.0.6 -> OPENMPI
#
MPLIB_FAMILY = $(shell echo "$(WM_MPLIB)" | sed -e 's/[-+.0-9~].*//')
ifneq ("$(MPLIB_STEMNAME)","$(WM_MPLIB)")
sinclude $(GENERAL_RULES)/mplib$(MPLIB_STEMNAME)
sinclude $(DEFAULT_RULES)/mplib$(MPLIB_STEMNAME)
# Base rules
ifneq ("$(MPLIB_FAMILY)","$(WM_MPLIB)")
sinclude $(GENERAL_RULES)/mplib$(MPLIB_FAMILY)
sinclude $(DEFAULT_RULES)/mplib$(MPLIB_FAMILY)
# system-specific
ifneq ("$(RULES)","$(DEFAULT_RULES)")
sinclude $(RULES)/mplib$(MPLIB_STEMNAME)
sinclude $(RULES)/mplib$(MPLIB_FAMILY)
endif
endif
# Specific rules
ifneq ("","$(WM_MPLIB)")
sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB)
sinclude $(DEFAULT_RULES)/mplib$(WM_MPLIB)
# system-specific
ifneq ("$(RULES)","$(DEFAULT_RULES)")
sinclude $(RULES)/mplib$(WM_MPLIB)
endif