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

View File

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

View File

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

View File

@ -116,7 +116,14 @@ unsetenv FOAM_INST_DIR
unsetenv MPI_ARCH_PATH unsetenv MPI_ARCH_PATH
unsetenv MPI_BUFFER_SIZE 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 if ("${DYLD_LIBRARY_PATH}" == "") unsetenv DYLD_LIBRARY_PATH
endif endif
# Remove any shadow env variables
unsetenv FOAM_DYLD_LIBRARY_PATH
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Cleanup aliases # Cleanup aliases
@ -221,6 +230,6 @@ endif
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Intermediate variables (do as last for a clean exit code) # 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 # _foamClean : eval call to foamCleanPath for specific shell
# _foamEcho : silent/non-silent echo # _foamEcho : silent/non-silent echo
# _foamEtc : resolve etc files (silent or verbose) # _foamEtc : resolve etc files (silent or verbose)
# _foamAddPath : prepend to MANPATH # _foamAddPath : prepend to PATH
# _foamAddMan : prepend to MANPATH # _foamAddMan : prepend to MANPATH
# _foamAddLib : prepend to [DY]LD_LIBRARY_PATH # _foamAddLib : prepend to [DY]LD_LIBRARY_PATH
# _foamAddLibAuto: prepend to lib64/lib resolved name # _foamAddLibAuto: prepend to lib64/lib resolved name

View File

@ -46,29 +46,49 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
unset MPI_ARCH_PATH MPI_HOME unset MPI_ARCH_PATH MPI_HOME
export FOAM_MPI=dummy # Fallback value 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 # Location for ThirdParty installations
_foamMpiPrefixDir="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER" _foamMpiPrefixDir="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER"
_foamMpiWarning="openfoam (etc/config.sh/mpi) => " # Prefix for warnings _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 case "$WM_MPLIB" in
# The system openmpi, discover locations via <mpicc> # ----
# Preserve major version for the naming # The system openmpi, discover locations by orte-info, mpicc or orterun
SYSTEMOPENMPI | SYSTEMOPENMPI[1-9]) # Preserve major or full version for the naming
# Preserve major 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="${WM_MPLIB##*MPI}"
_foamMpiVersion="${_foamMpiVersion##*mpi}"
export FOAM_MPI="sys-openmpi${_foamMpiVersion}" export FOAM_MPI="sys-openmpi${_foamMpiVersion}"
export WM_MPLIB="SYSTEMOPENMPI${_foamMpiVersion}"
# Undefine OPAL_PREFIX if set to one of the paths on foamOldDirs # Undefine OPAL_PREFIX if set to one of the paths on foamOldDirs
if [ -z "$($foamClean -env=OPAL_PREFIX "$foamOldDirs")" ] [ -z "$($foamClean -env=OPAL_PREFIX "$foamOldDirs")" ] && unset OPAL_PREFIX
then
unset OPAL_PREFIX
fi
_foamEtc -config prefs.sys-openmpi ## Optional adjustments _foamEtc -config prefs.sys-openmpi ## Optional adjustments
unset _foamFoundCmd unset _foamFoundCmd
@ -76,6 +96,7 @@ SYSTEMOPENMPI | SYSTEMOPENMPI[1-9])
# MPI_ARCH_PATH (prefs) if a valid dir, or need to discover # MPI_ARCH_PATH (prefs) if a valid dir, or need to discover
if [ -d "$MPI_ARCH_PATH" ] if [ -d "$MPI_ARCH_PATH" ]
then then
_foamAddPath "$MPI_ARCH_PATH"/bin
_foamAddLibAuto "$MPI_ARCH_PATH" _foamAddLibAuto "$MPI_ARCH_PATH"
else else
unset MPI_ARCH_PATH 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 export FOAM_MPI=openmpi-4.0.3
_foamMpiEmbedVersion openmpi OPENMPI
_foamEtc -config prefs.openmpi ## Optional adjustments _foamEtc -config prefs.openmpi ## Optional adjustments
# MPI_ARCH_PATH (prefs) if a valid dir, or ThirdParty location # MPI_ARCH_PATH (prefs) if a valid dir, or ThirdParty location
@ -168,6 +193,7 @@ OPENMPI)
;; ;;
# ----
# Arbitrary, user-specified mpi implementation # Arbitrary, user-specified mpi implementation
# - used by spack, which populates appropriate wmake rules # - used by spack, which populates appropriate wmake rules
USERMPI) USERMPI)
@ -176,14 +202,19 @@ USERMPI)
;; ;;
# ----
# EasyBuild handles everything via <mpicc> # EasyBuild handles everything via <mpicc>
EASYBUILDMPI) EASYBUILDMPI)
export FOAM_MPI=eb-mpi export FOAM_MPI=eb-mpi
;; ;;
# ----
sys-mpi |\
SYSTEMMPI) SYSTEMMPI)
export FOAM_MPI=sys-mpi export FOAM_MPI=sys-mpi
export WM_MPLIB=SYSTEMMPI
_foamEtc -config prefs.sys-mpi ## Optional adjustments _foamEtc -config prefs.sys-mpi ## Optional adjustments
# MPI_ARCH_PATH (prefs) or MPI_ROOT (inherited), in that order # 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 export FOAM_MPI=mpich-3.3
_foamMpiEmbedVersion mpich MPICH
_foamEtc -config prefs.mpich ## Optional adjustments _foamEtc -config prefs.mpich ## Optional adjustments
# MPI_ARCH_PATH (prefs) if a valid dir, or use ThirdParty location # MPI_ARCH_PATH (prefs) if a valid dir, or use ThirdParty location
@ -252,6 +287,7 @@ MPICH)
;; ;;
# ----
MPICH-GM) MPICH-GM)
export FOAM_MPI=mpich-gm export FOAM_MPI=mpich-gm
_foamEtc -config prefs.mpich-gm ## Optional adjustments _foamEtc -config prefs.mpich-gm ## Optional adjustments
@ -274,9 +310,13 @@ MPICH-GM)
;; ;;
# ----
# MVAPICH2, renamed to contain 'MPI' in its name # MVAPICH2, renamed to contain 'MPI' in its name
MVA2MPI) mvapich2 | mvapich2-[1-9]* |\
MVA2MPI | MVA2MPI-[1-9]* )
export FOAM_MPI=mvapich2-2.3 export FOAM_MPI=mvapich2-2.3
_foamMpiEmbedVersion mvapich2 MVA2MPI
_foamEtc -config prefs.mvapich2 ## Optional adjustments _foamEtc -config prefs.mvapich2 ## Optional adjustments
# MPI_ARCH_PATH (prefs) if a valid dir, or ThirdParty location # MPI_ARCH_PATH (prefs) if a valid dir, or ThirdParty location
@ -295,6 +335,7 @@ MVA2MPI)
;; ;;
# ----
CRAY-MPICH) CRAY-MPICH)
export FOAM_MPI=cray-mpich export FOAM_MPI=cray-mpich
export MPI_ARCH_PATH="$MPICH_DIR" export MPI_ARCH_PATH="$MPICH_DIR"
@ -313,6 +354,7 @@ CRAY-MPICH)
;; ;;
# ----
HPMPI) HPMPI)
export FOAM_MPI=hpmpi export FOAM_MPI=hpmpi
export MPI_HOME=/opt/hpmpi export MPI_HOME=/opt/hpmpi
@ -336,12 +378,14 @@ HPMPI)
;; ;;
# ----
MPI) MPI)
export FOAM_MPI=mpi export FOAM_MPI=mpi
export MPI_ARCH_PATH=/opt/mpi export MPI_ARCH_PATH=/opt/mpi
;; ;;
# ----
FJMPI) FJMPI)
export FOAM_MPI=fjmpi export FOAM_MPI=fjmpi
_foamEtc -config prefs.fjmpi ## Optional adjustments _foamEtc -config prefs.fjmpi ## Optional adjustments
@ -368,6 +412,7 @@ FJMPI)
;; ;;
# ----
QSMPI) QSMPI)
export FOAM_MPI=qsmpi export FOAM_MPI=qsmpi
export MPI_ARCH_PATH=/usr/lib/mpi export MPI_ARCH_PATH=/usr/lib/mpi
@ -377,6 +422,7 @@ QSMPI)
;; ;;
# ----
SGIMPI) SGIMPI)
: "${MPI_ROOT:=/dummy}" : "${MPI_ROOT:=/dummy}"
MPI_ROOT="${MPI_ROOT%/}" # Remove trailing slash 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 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 _foamEtc -config prefs.intelmpi ## Optional adjustments
if [ -n "$I_MPI_ROOT" ] if [ -n "$I_MPI_ROOT" ]
@ -415,10 +468,14 @@ INTELMPI*)
export I_MPI_ROOT="$MPI_ARCH_PATH" export I_MPI_ROOT="$MPI_ARCH_PATH"
else 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 \ for _foamFoundDir in \
"$WM_THIRD_PARTY_DIR/opt/intel/oneapi/mpi/latest" \ "$WM_THIRD_PARTY_DIR/opt/intel/oneapi/mpi/$_foamMpiVersion" \
"$WM_THIRD_PARTY_DIR/opt/intel/mpi/latest" \ "$WM_THIRD_PARTY_DIR/opt/intel/mpi/$_foamMpiVersion" \
; ;
do do
if [ -d "$_foamFoundDir" ] if [ -d "$_foamFoundDir" ]
@ -478,8 +535,12 @@ INTELMPI*)
;; ;;
MSMPI) # ----
msmpi | msmpi-[1-9]* |\
MSMPI | MSMPI-[1-9]* )
export FOAM_MPI=msmpi export FOAM_MPI=msmpi
_foamMpiEmbedVersion msmpi MSMPI
_foamEtc -config prefs.msmpi ## Optional adjustments _foamEtc -config prefs.msmpi ## Optional adjustments
# MPI_ARCH_PATH (prefs) if a valid dir, or ThirdParty location # MPI_ARCH_PATH (prefs) if a valid dir, or ThirdParty location
@ -513,6 +574,9 @@ esac
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Final # Final
: "${FOAM_MPI:=dummy}" # Fallback value for no MPI
export FOAM_MPI
# Ensure MPI_ARCH_PATH is marked for export # Ensure MPI_ARCH_PATH is marked for export
[ -n "$MPI_ARCH_PATH" ] && export MPI_ARCH_PATH [ -n "$MPI_ARCH_PATH" ] && export MPI_ARCH_PATH
@ -521,10 +585,11 @@ if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
then then
echo "Using mpi type : $WM_MPLIB" 1>&2 echo "Using mpi type : $WM_MPLIB" 1>&2
echo " FOAM_MPI : $FOAM_MPI" 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 fi
# Cleanup # Cleanup
unset _foamMpiPrefixDir _foamMpiVersion _foamMpiWarning 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_ARCH_PATH
unset MPI_BUFFER_SIZE unset MPI_BUFFER_SIZE
# Undefine OPAL_PREFIX if set to one of the paths on foamOldDirs # Cleanup mpi prefix values if set to one of the paths on foamOldDirs
if [ -n "$foamClean" ] && [ -z "$($foamClean -env=OPAL_PREFIX $foamOldDirs)" ] if [ -n "$foamClean" ]
then 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 fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@ -163,6 +166,9 @@ fi
[ -n "$LD_LIBRARY_PATH" ] || unset LD_LIBRARY_PATH [ -n "$LD_LIBRARY_PATH" ] || unset LD_LIBRARY_PATH
[ -n "$DYLD_LIBRARY_PATH" ] || unset DYLD_LIBRARY_PATH [ -n "$DYLD_LIBRARY_PATH" ] || unset DYLD_LIBRARY_PATH
# Remove any shadow env variables
unset FOAM_DYLD_LIBRARY_PATH
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Cleanup aliases and functions # Cleanup aliases and functions
@ -220,6 +226,6 @@ unset _of_complete_cache_
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Intermediate variables (do as last for a clean exit code) # 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 = PINC =
PLIBS = PLIBS =
# The stem name. Eg, SYSTEMOPENMPI4 -> SYSTEMOPENMPI # Extract the family name. For example,
MPLIB_STEMNAME = $(shell echo "$(WM_MPLIB)" | sed -e 's/[-.0-9]*$$//') # SYSTEMOPENMPI4 -> SYSTEMOPENMPI
# OPENMPI-4.0.6 -> OPENMPI
#
MPLIB_FAMILY = $(shell echo "$(WM_MPLIB)" | sed -e 's/[-+.0-9~].*//')
ifneq ("$(MPLIB_STEMNAME)","$(WM_MPLIB)") # Base rules
sinclude $(GENERAL_RULES)/mplib$(MPLIB_STEMNAME) ifneq ("$(MPLIB_FAMILY)","$(WM_MPLIB)")
sinclude $(DEFAULT_RULES)/mplib$(MPLIB_STEMNAME) sinclude $(GENERAL_RULES)/mplib$(MPLIB_FAMILY)
sinclude $(DEFAULT_RULES)/mplib$(MPLIB_FAMILY)
# system-specific
ifneq ("$(RULES)","$(DEFAULT_RULES)") ifneq ("$(RULES)","$(DEFAULT_RULES)")
sinclude $(RULES)/mplib$(MPLIB_STEMNAME) sinclude $(RULES)/mplib$(MPLIB_FAMILY)
endif endif
endif endif
# Specific rules
ifneq ("","$(WM_MPLIB)") ifneq ("","$(WM_MPLIB)")
sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB) sinclude $(GENERAL_RULES)/mplib$(WM_MPLIB)
sinclude $(DEFAULT_RULES)/mplib$(WM_MPLIB) sinclude $(DEFAULT_RULES)/mplib$(WM_MPLIB)
# system-specific
ifneq ("$(RULES)","$(DEFAULT_RULES)") ifneq ("$(RULES)","$(DEFAULT_RULES)")
sinclude $(RULES)/mplib$(WM_MPLIB) sinclude $(RULES)/mplib$(WM_MPLIB)
endif endif