diff --git a/etc/config.csh/FFTW b/etc/config.csh/FFTW
index 5afe82d226..50d617511a 100644
--- a/etc/config.csh/FFTW
+++ b/etc/config.csh/FFTW
@@ -8,8 +8,7 @@
# Copyright (C) 2016-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
-# This file is part of OpenFOAM, licensed under GNU General Public License
-# .
+# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.csh/FFTW
diff --git a/etc/config.csh/complete-wrapper b/etc/config.csh/complete-wrapper
index c418f5020a..b080ae6727 100644
--- a/etc/config.csh/complete-wrapper
+++ b/etc/config.csh/complete-wrapper
@@ -9,8 +9,7 @@
# Copyright (C) 2017 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
-# This file is part of OpenFOAM, licensed under GNU General Public License
-# .
+# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.csh/complete-wrapper
@@ -38,14 +37,14 @@ then
fi
# Preload completion cache
-if [ -f $WM_PROJECT_DIR/etc/config.sh/completion_cache ]
-then . $WM_PROJECT_DIR/etc/config.sh/completion_cache
+if [ -f "$WM_PROJECT_DIR"/etc/config.sh/completion_cache ]
+then . "$WM_PROJECT_DIR"/etc/config.sh/completion_cache
fi
# Use the bash completion function, but retain cache etc.
_of_complete_tcsh=true
-if [ -f $WM_PROJECT_DIR/etc/config.sh/bash_completion ]
-then . $WM_PROJECT_DIR/etc/config.sh/bash_completion
+if [ -f "$WM_PROJECT_DIR"/etc/config.sh/bash_completion ]
+then . "$WM_PROJECT_DIR"/etc/config.sh/bash_completion
else
# Could warn about missing file, or treat silently
echo
diff --git a/etc/config.csh/example/prefs.csh b/etc/config.csh/example/prefs.csh
index d4504c70b4..10d13da677 100644
--- a/etc/config.csh/example/prefs.csh
+++ b/etc/config.csh/example/prefs.csh
@@ -8,8 +8,7 @@
# Copyright (C) 2011-2016 OpenFOAM Foundation
#------------------------------------------------------------------------------
# License
-# This file is part of OpenFOAM, licensed under GNU General Public License
-# .
+# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# config.csh/example/prefs.csh
diff --git a/etc/config.csh/mpi b/etc/config.csh/mpi
index 48126fde7a..e8bd71b0d4 100644
--- a/etc/config.csh/mpi
+++ b/etc/config.csh/mpi
@@ -40,7 +40,7 @@
#
# Environment
# I_MPI_CC, I_MPI_CXX environment variables define the compiler
-# to be used the Intel mpicc/mpicxx wrappers
+# to be used by Intel mpiicc/mpiicpc wrappers
#
# MPI_BUFFER_SIZE overrides 'mpiBufferSize' (controlDict entry).
# Eg, setenv MPI_BUFFER_SIZE 20000000
@@ -73,14 +73,57 @@ case SYSTEMOPENMPI:
if ( -d "$MPI_ARCH_PATH" ) then
_foamAddLibAuto "$MPI_ARCH_PATH"
else
- # Slight hack: strip off 'lib' to get prefix directory
- set libDir=`mpicc --showme:link | sed -e 's/.*-L\([^ ]*\).*/\1/'`
-
- setenv MPI_ARCH_PATH "${libDir:h}" # prefix from libdir
- _foamAddLib "$libDir"
- unset libDir
+ setenv MPI_ARCH_PATH
endif
+ # Use (openmpi only command) to query configuration
+ if ( "$MPI_ARCH_PATH" == "" ) then
+ set _foamFoundCmd=`which orte-info`
+ if ($status == 0) then
+ # prefix
+ set _foamFoundDir=`orte-info --path prefix --parsable | sed -e 's/^.*:prefix://'`
+ if ( -d "$_foamFoundDir" ) then
+ setenv MPI_ARCH_PATH "${_foamFoundDir}"
+
+ # libdir
+ set _foamFoundDir=`orte-info --path libdir --parsable | sed -e 's/^.*:libdir://'`
+ if ( -d "$_foamFoundDir" ) then
+ _foamAddLib "$_foamFoundDir"
+ else if ( "$MPI_ARCH_PATH" != "/usr" ) then
+ _foamAddLibAuto "$MPI_ARCH_PATH"
+ endif
+ endif
+ endif
+ endif
+
+ # Use to get the link information and (slight hack)
+ # strip off 'lib' to get the prefix directory
+ if ( "$MPI_ARCH_PATH" == "" ) then
+ set _foamFoundCmd=`which mpicc`
+ if ($status == 0) then
+ set _foamFoundDir=`mpicc --showme:link | sed -e 's/.*-L\([^ ]*\).*/\1/'`
+ setenv MPI_ARCH_PATH "${_foamFoundDir:h}" # Prefix from libdir
+ _foamAddLib "$_foamFoundDir"
+ endif
+ endif
+
+ # Last resort (worse hack):
+ # Use to get ../path/bin/orterun and infer prefix, libdir
+ if ( "$MPI_ARCH_PATH" == "" ) then
+ set _foamFoundCmd=`which orterun`
+ if ($status == 0) then
+ set _foamFoundDir="${_foamFoundCmd:h}" # The bin dir
+ setenv MPI_ARCH_PATH "${_foamFoundDir:h}" # The prefix dir
+
+ _foamAddLibAuto "$MPI_ARCH_PATH"
+ endif
+ endif
+
+ if ( "$MPI_ARCH_PATH" == "" ) then
+ echo "Warn: could not determine prefix for system-openmpi"
+ endif
+ unset _foamFoundCmd _foamFoundDir
+
#-
# TBD: extra (major) version qualifier on name?
#-
@@ -107,9 +150,11 @@ case OPENMPI:
# Inform openmpi where to find its install directory
setenv OPAL_PREFIX "$MPI_ARCH_PATH"
- _foamAddPath "$MPI_ARCH_PATH"/bin
- _foamAddMan "$MPI_ARCH_PATH"/share/man
- _foamAddLibAuto "$MPI_ARCH_PATH" "lib$WM_COMPILER_LIB_ARCH"
+ if ( "$MPI_ARCH_PATH" != "" ) then
+ _foamAddPath "$MPI_ARCH_PATH"/bin
+ _foamAddMan "$MPI_ARCH_PATH"/share/man
+ _foamAddLibAuto "$MPI_ARCH_PATH" "lib$WM_COMPILER_LIB_ARCH"
+ endif
breaksw
@@ -179,10 +224,11 @@ case MPICH:
endif
setenv MPI_HOME "$MPI_ARCH_PATH"
-
- _foamAddPath "$MPI_ARCH_PATH"/bin
- _foamAddMan "$MPI_ARCH_PATH"/share/man
- _foamAddLibAuto "$MPI_ARCH_PATH" "lib$WM_COMPILER_LIB_ARCH"
+ if ( "$MPI_ARCH_PATH" != "" ) then
+ _foamAddPath "$MPI_ARCH_PATH"/bin
+ _foamAddMan "$MPI_ARCH_PATH"/share/man
+ _foamAddLibAuto "$MPI_ARCH_PATH" "lib$WM_COMPILER_LIB_ARCH"
+ endif
breaksw
@@ -198,9 +244,11 @@ case MPICH-GM:
setenv MPICH_PATH "$MPI_ARCH_PATH"
setenv GM_LIB_PATH "$MPICH_PATH/lib$WM_COMPILER_LIB_ARCH"
- _foamAddPath "$MPI_ARCH_PATH"/bin
- _foamAddLib "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH"
- _foamAddLib "$GM_LIB_PATH"
+ if ( "$MPI_ARCH_PATH" != "" ) then
+ _foamAddPath "$MPI_ARCH_PATH"/bin
+ _foamAddLib "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH"
+ _foamAddLib "$GM_LIB_PATH"
+ endif
breaksw
@@ -214,9 +262,11 @@ case MVA2MPI:
setenv MPI_ARCH_PATH "$_foamMpiPrefixDir/$FOAM_MPI"
endif
- _foamAddPath "$MPI_ARCH_PATH"/bin
- _foamAddMan "$MPI_ARCH_PATH"/share/man
- _foamAddLibAuto "$MPI_ARCH_PATH" "lib$WM_COMPILER_LIB_ARCH"
+ if ( "$MPI_ARCH_PATH" != "" ) then
+ _foamAddPath "$MPI_ARCH_PATH"/bin
+ _foamAddMan "$MPI_ARCH_PATH"/share/man
+ _foamAddLibAuto "$MPI_ARCH_PATH" "lib$WM_COMPILER_LIB_ARCH"
+ endif
breaksw
@@ -231,8 +281,10 @@ case CRAY-MPICH:
echo "Please set MPICH_DIR correctly"
endif
- # _foamAddPath "$MPI_ARCH_PATH"/bin
- _foamAddLib "$MPI_ARCH_PATH"/lib
+ if ( "$MPI_ARCH_PATH" != "" ) then
+ # _foamAddPath "$MPI_ARCH_PATH"/bin
+ _foamAddLib "$MPI_ARCH_PATH"/lib
+ endif
breaksw
@@ -241,26 +293,26 @@ case HPMPI:
setenv MPI_HOME /opt/hpmpi
setenv MPI_ARCH_PATH "$MPI_HOME"
- set libDir=""
+ set _foamFoundDir=""
switch (`uname -m`)
case x86_64:
- set libDir=lib/linux_amd64
+ set _foamFoundDir=lib/linux_amd64
breaksw
case i686:
- set libDir=lib/linux_ia32
+ set _foamFoundDir=lib/linux_ia32
breaksw
case ia64:
- set libDir=lib/linux_ia64
+ set _foamFoundDir=lib/linux_ia64
breaksw
endsw
- if ( "${libDir}" != "" ) then
+ if ( "${_foamFoundDir}" != "" ) then
_foamAddPath "$MPI_ARCH_PATH"/bin
- _foamAddLib "$MPI_ARCH_PATH/$libDir"
+ _foamAddLib "$MPI_ARCH_PATH/$_foamFoundDir"
else
echo "openfoam: (`uname -m`) - unsupported HP-MPI processor type"
endif
- unset libDir
+ unset _foamFoundDir
breaksw
@@ -335,7 +387,20 @@ case INTELMPI*:
else if ( "$MPI_ARCH_PATH" != "" ) then
# 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'
+ foreach _foamFoundDir (\
+ "$WM_THIRD_PARTY_DIR/opt/intel/oneapi/mpi/latest" \
+ "$WM_THIRD_PARTY_DIR/opt/intel/mpi/latest" \
+ )
+ if ( -d "$_foamFoundDir" ) then
+ setenv MPI_ARCH_PATH "$_foamFoundDir"
+ setenv I_MPI_ROOT "$MPI_ARCH_PATH"
+ break
+ endif
+ end
endif
+ unset _foamFoundDir
if ( -d "$MPI_ARCH_PATH" ) then
# Remove trailing slash
@@ -364,7 +429,7 @@ case INTELMPI*:
# With/without "intel64/" directory - handled here and in mpi rules
# Path, lib-path may have been set prior to call
- if (1) then
+ if ( -d "$MPI_ARCH_PATH" ) then
if ( -d "$MPI_ARCH_PATH"/intel64/lib ) then
_foamAddPath "$MPI_ARCH_PATH"/intel64/bin
_foamAddLib "$MPI_ARCH_PATH"/intel64/lib
@@ -375,6 +440,34 @@ case INTELMPI*:
_foamAddLib "$MPI_ARCH_PATH"/lib/release
endif
endif
+ breaksw
+
+
+case MSMPI:
+ setenv FOAM_MPI msmpi
+ _foamEtc -config prefs.msmpi ## Optional adjustments
+
+ # MPI_ARCH_PATH (prefs) if a valid dir, or ThirdParty location
+ # Also consider ThirdParty 'opt/' directory (binary package)
+ if ( ! -d "$MPI_ARCH_PATH" ) then
+ foreach _foamFoundDir (\
+ "$_foamMpiPrefixDir/$FOAM_MPI" \
+ "$WM_THIRD_PARTY_DIR/opt/$FOAM_MPI" \
+ )
+ if ( -d "$_foamFoundDir" ) then
+ setenv MPI_ARCH_PATH "$_foamFoundDir"
+ break
+ endif
+ end
+ endif
+ unset _foamFoundDir
+
+ if ( -d "$MPI_ARCH_PATH" ) then
+ # _foamAddPath "$MPI_ARCH_PATH"/bin
+ _foamAddLib "$MPI_ARCH_PATH"/lib/x64
+ endif
+ breaksw
+
endsw
diff --git a/etc/config.csh/settings b/etc/config.csh/settings
index 4919f0092a..3c6bb87a56 100644
--- a/etc/config.csh/settings
+++ b/etc/config.csh/settings
@@ -96,7 +96,7 @@ case MSYS*:
if ( "$WM_COMPILER" == Gcc ) setenv WM_COMPILER Mingw
setenv WM_COMPILER_LIB_ARCH 64 # Consistent with linux64Mingw
echo "openfoam: windows support (mingw64) is runtime only"
- ;;
+ breaksw
case SunOS*:
setenv WM_ARCH solaris64
@@ -146,12 +146,12 @@ setenv FOAM_USER_APPBIN "$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/bin"
setenv FOAM_USER_LIBBIN "$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/lib"
# Prepend wmake to the path - not required for runtime-only environment
-set foundDir="${WM_PROJECT_DIR}/wmake"
+set _foamFoundDir="${WM_PROJECT_DIR}/wmake"
if ( $?WM_DIR ) then
- if ( -d "${WM_DIR}" ) set foundDir="${WM_DIR}"
+ if ( -d "${WM_DIR}" ) set _foamFoundDir="${WM_DIR}"
endif
-if ( -d "$foundDir" ) then
- setenv PATH "${foundDir}:${PATH}"
+if ( -d "$_foamFoundDir" ) then
+ setenv PATH "${_foamFoundDir}:${PATH}"
else
unsetenv WM_DIR
endif
@@ -317,7 +317,7 @@ endsw
# Cleanup
# ~~~~~~~
-unset archDir siteDir foundDir archOption
+unset archOption archDir siteDir _foamFoundDir
unset gcc_version gccDir
unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir
unset clang_version clangDir
diff --git a/etc/config.csh/setup b/etc/config.csh/setup
index 49d5d4ad5d..52b5476bb6 100644
--- a/etc/config.csh/setup
+++ b/etc/config.csh/setup
@@ -30,7 +30,7 @@
setenv FOAM_API `$WM_PROJECT_DIR/bin/foamEtcFile -show-api`
# The installation parent directory
-set prefixDir="${WM_PROJECT_DIR:h}"
+set _foamPrefixDir="${WM_PROJECT_DIR:h}"
# Load shell "functions" (actually aliases)
source "$WM_PROJECT_DIR/etc/config.csh/functions"
@@ -52,16 +52,16 @@ if ( -e "$WM_PROJECT_DIR/ThirdParty" ) then
setenv WM_THIRD_PARTY_DIR "$WM_PROJECT_DIR/ThirdParty"
else
_foamEcho "Locating ThirdParty directory"
- foreach foundDir (\
- "$prefixDir/ThirdParty-$WM_PROJECT_VERSION" \
- "$prefixDir/ThirdParty-v$FOAM_API" \
- "$prefixDir/ThirdParty-$FOAM_API" \
- "$prefixDir/ThirdParty-common" \
+ foreach _foamFoundDir (\
+ "$_foamPrefixDir/ThirdParty-$WM_PROJECT_VERSION" \
+ "$_foamPrefixDir/ThirdParty-v$FOAM_API" \
+ "$_foamPrefixDir/ThirdParty-$FOAM_API" \
+ "$_foamPrefixDir/ThirdParty-common" \
)
- _foamEcho "... $foundDir"
- if ( -d "$foundDir" ) then
- if ( -f "$foundDir/Allwmake" || -d "$foundDir/platforms" ) then
- setenv WM_THIRD_PARTY_DIR "$foundDir"
+ _foamEcho "... $_foamFoundDir"
+ if ( -d "$_foamFoundDir" ) then
+ if ( -f "$_foamFoundDir/Allwmake" || -d "$_foamFoundDir/platforms" ) then
+ setenv WM_THIRD_PARTY_DIR "$_foamFoundDir"
break
else
_foamEcho " does not have Allwmake or platforms/"
@@ -239,6 +239,6 @@ unalias _foamAddLib
unalias _foamAddLibAuto
# Variables (done as final statement for a clean exit code)
-unset cleaned foamOldDirs foundDir prefixDir
+unset cleaned foamOldDirs _foamFoundDir _foamPrefixDir
#------------------------------------------------------------------------------
diff --git a/etc/config.csh/tcsh_completion b/etc/config.csh/tcsh_completion
index 8298359d4e..eb93432d4f 100644
--- a/etc/config.csh/tcsh_completion
+++ b/etc/config.csh/tcsh_completion
@@ -8,8 +8,7 @@
# Copyright (C) 2017 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
-# This file is part of OpenFOAM, licensed under GNU General Public License
-# .
+# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.csh/tcsh_completion
diff --git a/etc/config.csh/vtk b/etc/config.csh/vtk
index 1a8c37cca6..0775b85d98 100644
--- a/etc/config.csh/vtk
+++ b/etc/config.csh/vtk
@@ -8,8 +8,7 @@
# Copyright (C) 2016-2019 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
-# This file is part of OpenFOAM, licensed under GNU General Public License
-# .
+# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.csh/vtk
diff --git a/etc/config.sh/FFTW b/etc/config.sh/FFTW
index 65e1658187..ac39eeb010 100644
--- a/etc/config.sh/FFTW
+++ b/etc/config.sh/FFTW
@@ -8,8 +8,7 @@
# Copyright (C) 2016-2018 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
-# This file is part of OpenFOAM, licensed under GNU General Public License
-# .
+# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.sh/FFTW
diff --git a/etc/config.sh/ccmio b/etc/config.sh/ccmio
index 122bd43f9e..7db620c46b 100644
--- a/etc/config.sh/ccmio
+++ b/etc/config.sh/ccmio
@@ -8,8 +8,7 @@
# Copyright (C) 2016 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
-# This file is part of OpenFOAM, licensed under GNU General Public License
-# .
+# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.sh/ccmio
diff --git a/etc/config.sh/functions b/etc/config.sh/functions
index 5945ba8bde..1c9ee25bff 100644
--- a/etc/config.sh/functions
+++ b/etc/config.sh/functions
@@ -50,35 +50,31 @@ then
if [ -n "$FOAM_VERBOSE" ] && [ -n "$PS1" ]
then
_foamEcho() { echo "$@" 1>&2; }
- _foamEtc() {
- eval "$("$WM_PROJECT_DIR"/bin/foamEtcFile -sh-verbose "$@")";
- }
+ _foamEtc() { eval "$("$WM_PROJECT_DIR"/bin/foamEtcFile -sh-verbose "$@")"; }
else
_foamEcho() { true; }
- _foamEtc() {
- eval "$("$WM_PROJECT_DIR"/bin/foamEtcFile -sh "$@")";
- }
+ _foamEtc() { eval "$("$WM_PROJECT_DIR"/bin/foamEtcFile -sh "$@")"; }
fi
# Prepend PATH
unset -f _foamAddPath 2>/dev/null
_foamAddPath()
{
- [ -n "$1" ] && export PATH="$1:$PATH"
+ case "$1" in (/?*) export PATH="$1:$PATH" ;; esac
}
# Prepend MANPATH
unset -f _foamAddMan 2>/dev/null
_foamAddMan()
{
- [ -n "$1" ] && export MANPATH="$1:$MANPATH"
+ case "$1" in (/?*) export MANPATH="$1:$MANPATH" ;; esac
}
# Prepend LD_LIBRARY_PATH
unset -f _foamAddLib 2>/dev/null
_foamAddLib()
{
- [ -n "$1" ] && export LD_LIBRARY_PATH="$1:$LD_LIBRARY_PATH"
+ case "$1" in (/?*) export LD_LIBRARY_PATH="$1:$LD_LIBRARY_PATH" ;; esac
}
# Prepend to LD_LIBRARY_PATH with additional checking
@@ -118,11 +114,11 @@ then
fi
# Use fallback. Add without checking existence of the directory
- foamVar_end=$2
+ foamVar_end="$2"
if [ -n "$foamVar_end" ]
then
case "$foamVar_end" in
- /*) # An absolute path
+ (/*) # Absolute path
export LD_LIBRARY_PATH="$foamVar_end:$LD_LIBRARY_PATH"
;;
(*) # Relative to prefix
@@ -147,7 +143,7 @@ then
# Prepend DYLD_LIBRARY_PATH
_foamAddLib()
{
- [ -n "$1" ] && export DYLD_LIBRARY_PATH="$1:$DYLD_LIBRARY_PATH"
+ case "$1" in (/?*) export DYLD_LIBRARY_PATH="$1:$DYLD_LIBRARY_PATH" ;; esac
}
# Prepend to DYLD_LIBRARY_PATH with additional checking
diff --git a/etc/config.sh/kahip b/etc/config.sh/kahip
index 6eb3854759..cada0abc78 100644
--- a/etc/config.sh/kahip
+++ b/etc/config.sh/kahip
@@ -8,8 +8,7 @@
# Copyright (C) 2017-2019 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
-# This file is part of OpenFOAM, licensed under GNU General Public License
-# .
+# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.sh/kahip
diff --git a/etc/config.sh/metis b/etc/config.sh/metis
index ce42f62a5f..6242dda174 100644
--- a/etc/config.sh/metis
+++ b/etc/config.sh/metis
@@ -9,8 +9,7 @@
# Copyright (C) 2016-2017 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
-# This file is part of OpenFOAM, licensed under GNU General Public License
-# .
+# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.sh/metis
diff --git a/etc/config.sh/mgridgen b/etc/config.sh/mgridgen
index 3ef0ce4acb..52a77782b2 100644
--- a/etc/config.sh/mgridgen
+++ b/etc/config.sh/mgridgen
@@ -8,8 +8,7 @@
# Copyright (C) 2017 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
-# This file is part of OpenFOAM, licensed under GNU General Public License
-# .
+# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.sh/mgridgen
diff --git a/etc/config.sh/mpi b/etc/config.sh/mpi
index ed38419271..d131891f9c 100644
--- a/etc/config.sh/mpi
+++ b/etc/config.sh/mpi
@@ -38,7 +38,7 @@
#
# Environment
# I_MPI_CC, I_MPI_CXX environment variables define the compiler
-# to be used the Intel mpicc/mpicxx wrappers
+# to be used by Intel mpiicc/mpiicpc wrappers
#
# MPI_BUFFER_SIZE overrides 'mpiBufferSize' (controlDict entry).
# Eg, export MPI_BUFFER_SIZE=20000000
@@ -71,19 +71,63 @@ SYSTEMOPENMPI | SYSTEMOPENMPI[1-9])
fi
_foamEtc -config prefs.sys-openmpi ## Optional adjustments
- # MPI_ARCH_PATH (prefs) if a valid dir, or discover via
+ unset _foamFoundCmd
+
+ # MPI_ARCH_PATH (prefs) if a valid dir, or need to discover
if [ -d "$MPI_ARCH_PATH" ]
then
_foamAddLibAuto "$MPI_ARCH_PATH"
else
- # Slight hack: strip off 'lib' to get prefix directory
- libDir=$(mpicc --showme:link | sed -e 's/.*-L\([^ ]*\).*/\1/')
-
- export MPI_ARCH_PATH="${libDir%/*}" # prefix from libdir
- _foamAddLib "$libDir"
- unset libDir
+ unset MPI_ARCH_PATH
fi
+ # Use (openmpi only command) to query configuration
+ if [ -z "$MPI_ARCH_PATH" ] && _foamFoundCmd="$(command -v orte-info)"
+ then
+ # prefix
+ _foamFoundDir="$("$_foamFoundCmd" --path prefix --parsable | sed -e 's/^.*:prefix://')"
+ if [ -d "$_foamFoundDir" ]
+ then
+ MPI_ARCH_PATH="${_foamFoundDir}"
+
+ # libdir
+ _foamFoundDir="$("$_foamFoundCmd" --path libdir --parsable | sed -e 's/^.*:libdir://')"
+ if [ -d "$_foamFoundDir" ]
+ then
+ _foamAddLib "$_foamFoundDir"
+ elif [ "$MPI_ARCH_PATH" != /usr ]
+ then
+ _foamAddLibAuto "$MPI_ARCH_PATH"
+ fi
+ fi
+ fi
+
+ # Use to get the link information and (slight hack)
+ # strip off 'lib' to get the prefix directory
+ if [ -z "$MPI_ARCH_PATH" ] && _foamFoundCmd="$(command -v mpicc)"
+ then
+ _foamFoundDir="$("$_foamFoundCmd" --showme:link | sed -e 's/.*-L\([^ ]*\).*/\1/')"
+
+ MPI_ARCH_PATH="${_foamFoundDir%/*}" # Prefix from libdir
+ _foamAddLib "$_foamFoundDir"
+ fi
+
+ # Last resort (worse hack):
+ # Use to get ../path/bin/orterun and infer prefix, libdir
+ if [ -z "$MPI_ARCH_PATH" ] && _foamFoundCmd="$(command -v orterun)"
+ then
+ _foamFoundDir="${_foamFoundCmd%/*}" # The bin dir
+ MPI_ARCH_PATH="${_foamFoundDir%/*}" # The prefix dir
+
+ _foamAddLibAuto "$MPI_ARCH_PATH"
+ fi
+
+ if [ -z "$MPI_ARCH_PATH" ]
+ then
+ echo "Warn: could not determine prefix for system-openmpi" 1>&2
+ fi
+ unset _foamFoundCmd _foamFoundDir
+
#-
# TBD: extra (major) version qualifier on name?
#-
@@ -113,7 +157,7 @@ OPENMPI)
export OPAL_PREFIX="$MPI_ARCH_PATH"
# Could be sourced from ThirdParty with incomplete environment
- if command -v _foamAddLibAuto >/dev/null # Normal sourcing
+ if [ -n "$MPI_ARCH_PATH" ] && command -v _foamAddLibAuto >/dev/null
then
_foamAddPath "$MPI_ARCH_PATH"/bin
_foamAddMan "$MPI_ARCH_PATH"/share/man
@@ -197,7 +241,7 @@ MPICH)
export MPI_HOME="$MPI_ARCH_PATH"
# Could be sourced from ThirdParty with incomplete environment
- if command -v _foamAddLibAuto >/dev/null # Normal sourcing
+ if [ -n "$MPI_ARCH_PATH" ] && command -v _foamAddLibAuto >/dev/null
then
_foamAddPath "$MPI_ARCH_PATH"/bin
_foamAddMan "$MPI_ARCH_PATH"/share/man
@@ -219,9 +263,12 @@ MPICH-GM)
export MPICH_PATH="$MPI_ARCH_PATH"
export GM_LIB_PATH="$MPICH_PATH/lib$WM_COMPILER_LIB_ARCH"
- _foamAddPath "$MPI_ARCH_PATH"/bin
- _foamAddLib "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH"
- _foamAddLib "$GM_LIB_PATH"
+ if [ -n "$MPI_ARCH_PATH" ]
+ then
+ _foamAddPath "$MPI_ARCH_PATH"/bin
+ _foamAddLib "$MPI_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH"
+ _foamAddLib "$GM_LIB_PATH"
+ fi
;;
@@ -237,7 +284,7 @@ MVA2MPI)
fi
# Could be sourced from ThirdParty with incomplete environment
- if command -v _foamAddLibAuto >/dev/null # Normal sourcing
+ if [ -n "$MPI_ARCH_PATH" ] && command -v _foamAddLibAuto >/dev/null
then
_foamAddPath "$MPI_ARCH_PATH"/bin
_foamAddMan "$MPI_ARCH_PATH"/share/man
@@ -256,8 +303,11 @@ CRAY-MPICH)
echo "Please set MPICH_DIR correctly" 1>&2
}
- # _foamAddPath "$MPI_ARCH_PATH"/bin
- _foamAddLib "$MPI_ARCH_PATH"/lib
+ if [ -n "$MPI_ARCH_PATH" ]
+ then
+ # _foamAddPath "$MPI_ARCH_PATH"/bin
+ _foamAddLib "$MPI_ARCH_PATH"/lib
+ fi
;;
@@ -266,21 +316,21 @@ HPMPI)
export MPI_HOME=/opt/hpmpi
export MPI_ARCH_PATH="$MPI_HOME"
- unset libDir
case "$(uname -m)" in
- x86_64) libDir=lib/linux_amd64 ;;
- i686) libDir=lib/linux_ia32 ;;
- ia64) libDir=lib/linux_ia64 ;;
+ x86_64) _foamFoundDir=lib/linux_amd64 ;;
+ i686) _foamFoundDir=lib/linux_ia32 ;;
+ ia64) _foamFoundDir=lib/linux_ia64 ;;
+ *) unset _foamFoundDir ;;
esac
- if [ -n "$libDir" ]
+ if [ -n "$_foamFoundDir" ]
then
_foamAddPath "$MPI_ARCH_PATH"/bin
- _foamAddLib "$MPI_ARCH_PATH/$libDir"
+ _foamAddLib "$MPI_ARCH_PATH/$_foamFoundDir"
else
echo "openfoam: ($(uname -m)) - unsupported HP-MPI processor type" 1>&2
fi
- unset libDir
+ unset _foamFoundDir
;;
@@ -361,8 +411,23 @@ INTELMPI*)
then
# MPI_ARCH_PATH: Set I_MPI_ROOT accordingly
export I_MPI_ROOT="$MPI_ARCH_PATH"
- fi
+ else
+ # Final effort - check ThirdParty opt/intel locations for 'latest'
+ for _foamFoundDir in \
+ "$WM_THIRD_PARTY_DIR/opt/intel/oneapi/mpi/latest" \
+ "$WM_THIRD_PARTY_DIR/opt/intel/mpi/latest" \
+ ;
+ do
+ if [ -d "$_foamFoundDir" ]
+ then
+ MPI_ARCH_PATH="$_foamFoundDir"
+ export I_MPI_ROOT="$MPI_ARCH_PATH"
+ break
+ fi
+ done
+ fi
+ unset _foamFoundDir
if [ -d "$MPI_ARCH_PATH" ]
then
@@ -391,7 +456,7 @@ INTELMPI*)
# With/without "intel64/" directory - handled here and in mpi rules
# Path, lib-path may have been set prior to call
- if true
+ if [ -d "$MPI_ARCH_PATH" ]
then
if [ -d "$MPI_ARCH_PATH"/intel64/bin ] \
&& [ -d "$MPI_ARCH_PATH"/intel64/lib ]
@@ -416,13 +481,28 @@ MSMPI)
_foamEtc -config prefs.msmpi ## Optional adjustments
# MPI_ARCH_PATH (prefs) if a valid dir, or ThirdParty location
+ # Also consider ThirdParty 'opt/' directory (binary package)
if [ ! -d "$MPI_ARCH_PATH" ]
then
- export MPI_ARCH_PATH="$_foamMpiPrefixDir/$FOAM_MPI"
+ for _foamFoundDir in \
+ "$_foamMpiPrefixDir/$FOAM_MPI" \
+ "$WM_THIRD_PARTY_DIR/opt/$FOAM_MPI" \
+ ;
+ do
+ if [ -d "$_foamFoundDir" ]
+ then
+ MPI_ARCH_PATH="$_foamFoundDir"
+ break
+ fi
+ done
fi
+ unset _foamFoundDir
- # _foamAddPath "$MPI_ARCH_PATH"/bin
- _foamAddLib "$MPI_ARCH_PATH"/lib/x64
+ if [ -d "$MPI_ARCH_PATH" ]
+ then
+ # _foamAddPath "$MPI_ARCH_PATH"/bin
+ _foamAddLib "$MPI_ARCH_PATH"/lib/x64
+ fi
;;
esac
diff --git a/etc/config.sh/settings b/etc/config.sh/settings
index 7a69e91e52..e27a2bf16e 100644
--- a/etc/config.sh/settings
+++ b/etc/config.sh/settings
@@ -143,14 +143,14 @@ export FOAM_USER_LIBBIN="$WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/lib"
# Prepend wmake to the path - not required for runtime-only environment
-foundDir="$WM_PROJECT_DIR/wmake"
+_foamFoundDir="$WM_PROJECT_DIR/wmake"
if [ -d "$WM_DIR" ]
then
- foundDir="${WM_DIR}"
+ _foamFoundDir="${WM_DIR}"
fi
-if [ -d "$foundDir" ]
+if [ -d "$_foamFoundDir" ]
then
- PATH="$foundDir:$PATH"
+ PATH="$_foamFoundDir:$PATH"
else
unset WM_DIR
fi
@@ -308,7 +308,7 @@ esac
# Cleanup
# ~~~~~~~
-unset archDir siteDir foundDir archOption
+unset archOption archDir siteDir _foamFoundDir
unset gcc_version gccDir
unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir
unset clang_version clangDir
diff --git a/etc/config.sh/setup b/etc/config.sh/setup
index 36ef8d63e9..fb0a1f5e59 100644
--- a/etc/config.sh/setup
+++ b/etc/config.sh/setup
@@ -30,7 +30,7 @@
export FOAM_API=$("$WM_PROJECT_DIR/bin/foamEtcFile" -show-api)
# The installation parent directory
-prefixDir="${WM_PROJECT_DIR%/*}"
+_foamPrefixDir="${WM_PROJECT_DIR%/*}"
# Load shell functions
unset WM_SHELL_FUNCTIONS
@@ -54,20 +54,20 @@ then
WM_THIRD_PARTY_DIR="$WM_PROJECT_DIR/ThirdParty"
else
_foamEcho "Locating ThirdParty directory"
- for foundDir in \
- "$prefixDir/ThirdParty-$WM_PROJECT_VERSION" \
- "$prefixDir/ThirdParty-v$FOAM_API" \
- "$prefixDir/ThirdParty-$FOAM_API" \
- "$prefixDir/ThirdParty-common" \
+ for _foamFoundDir in \
+ "$_foamPrefixDir/ThirdParty-$WM_PROJECT_VERSION" \
+ "$_foamPrefixDir/ThirdParty-v$FOAM_API" \
+ "$_foamPrefixDir/ThirdParty-$FOAM_API" \
+ "$_foamPrefixDir/ThirdParty-common" \
;
do
- _foamEcho "... $foundDir"
- if [ -d "$foundDir" ]
+ _foamEcho "... $_foamFoundDir"
+ if [ -d "$_foamFoundDir" ]
then
- if [ -f "$foundDir/Allwmake" ] || \
- [ -d "$foundDir/platforms" ]
+ if [ -f "$_foamFoundDir/Allwmake" ] || \
+ [ -d "$_foamFoundDir/platforms" ]
then
- WM_THIRD_PARTY_DIR="$foundDir"
+ WM_THIRD_PARTY_DIR="$_foamFoundDir"
break
else
_foamEcho " does not have Allwmake or platforms/"
@@ -259,6 +259,6 @@ fi
. "$WM_PROJECT_DIR/etc/config.sh/functions"
# Variables (done as the last statement for a clean exit code)
-unset cleaned foamOldDirs foundDir prefixDir
+unset cleaned foamOldDirs _foamFoundDir _foamPrefixDir
#------------------------------------------------------------------------------
diff --git a/etc/config.sh/vtk b/etc/config.sh/vtk
index 312034f80e..3bc8c48402 100644
--- a/etc/config.sh/vtk
+++ b/etc/config.sh/vtk
@@ -8,8 +8,7 @@
# Copyright (C) 2016-2019 OpenCFD Ltd.
#------------------------------------------------------------------------------
# License
-# This file is part of OpenFOAM, licensed under GNU General Public License
-# .
+# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
#
# File
# etc/config.sh/vtk