mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
CONFIG: improve handling of in-source PETSC installations
- when installed in-source, use PETSC_ARCH to find additional include directory and the correct library directory CONFIG: bump to new hypre version - add -hint option for have_adios2, have_hypre, have_petsc
This commit is contained in:
@ -5,11 +5,10 @@
|
|||||||
# \\ / A nd | www.openfoam.com
|
# \\ / A nd | www.openfoam.com
|
||||||
# \\/ M anipulation |
|
# \\/ M anipulation |
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Copyright (C) 2017-2018 OpenCFD Ltd.
|
# Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# License
|
# 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.
|
||||||
# <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
#
|
||||||
# File
|
# File
|
||||||
# etc/config.csh/adios2
|
# etc/config.csh/adios2
|
||||||
@ -22,7 +21,7 @@
|
|||||||
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
||||||
|
|
||||||
set adios2_version=ADIOS2-2.4.0
|
set adios2_version=ADIOS2-2.4.0
|
||||||
setenv ADIOS2_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$adios2_version
|
setenv ADIOS2_ARCH_PATH "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$adios2_version"
|
||||||
|
|
||||||
# END OF (NORMAL) USER EDITABLE PART
|
# END OF (NORMAL) USER EDITABLE PART
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -5,11 +5,10 @@
|
|||||||
# \\ / A nd | www.openfoam.com
|
# \\ / A nd | www.openfoam.com
|
||||||
# \\/ M anipulation |
|
# \\/ M anipulation |
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Copyright (C) 2018 OpenCFD Ltd.
|
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# License
|
# 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.
|
||||||
# <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
#
|
||||||
# File
|
# File
|
||||||
# etc/config.csh/hypre
|
# etc/config.csh/hypre
|
||||||
@ -31,8 +30,8 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
||||||
|
|
||||||
set hypre_version=hypre-2.11.2
|
set hypre_version=hypre-2.19.0
|
||||||
setenv HYPRE_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$hypre_version
|
setenv HYPRE_ARCH_PATH "$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$hypre_version"
|
||||||
|
|
||||||
# END OF (NORMAL) USER EDITABLE PART
|
# END OF (NORMAL) USER EDITABLE PART
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -5,11 +5,10 @@
|
|||||||
# \\ / A nd | www.openfoam.com
|
# \\ / A nd | www.openfoam.com
|
||||||
# \\/ M anipulation |
|
# \\/ M anipulation |
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Copyright (C) 2017-2018 OpenCFD Ltd.
|
# Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# License
|
# 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.
|
||||||
# <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
#
|
||||||
# File
|
# File
|
||||||
# etc/config.sh/adios2
|
# etc/config.sh/adios2
|
||||||
@ -23,7 +22,7 @@
|
|||||||
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
||||||
|
|
||||||
adios2_version=ADIOS2-2.4.0
|
adios2_version=ADIOS2-2.4.0
|
||||||
export ADIOS2_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$adios2_version
|
export ADIOS2_ARCH_PATH="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$adios2_version"
|
||||||
|
|
||||||
# END OF (NORMAL) USER EDITABLE PART
|
# END OF (NORMAL) USER EDITABLE PART
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
@ -51,7 +50,10 @@ then
|
|||||||
if output="$($WM_PROJECT_DIR/bin/tools/lib-dir -sh $ADIOS2_ARCH_PATH 2>/dev/null)"
|
if output="$($WM_PROJECT_DIR/bin/tools/lib-dir -sh $ADIOS2_ARCH_PATH 2>/dev/null)"
|
||||||
then
|
then
|
||||||
eval "$output"
|
eval "$output"
|
||||||
PATH="$ADIOS2_ARCH_PATH/bin:$PATH"
|
if [ -d "$ADIOS2_ARCH_PATH/bin" ]
|
||||||
|
then
|
||||||
|
PATH="$ADIOS2_ARCH_PATH/bin:$PATH"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unset adios2_version output
|
unset adios2_version output
|
||||||
|
|||||||
@ -5,11 +5,10 @@
|
|||||||
# \\ / A nd | www.openfoam.com
|
# \\ / A nd | www.openfoam.com
|
||||||
# \\/ M anipulation |
|
# \\/ M anipulation |
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Copyright (C) 2018 OpenCFD Ltd.
|
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# License
|
# 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.
|
||||||
# <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
#
|
||||||
# File
|
# File
|
||||||
# etc/config.sh/hypre
|
# etc/config.sh/hypre
|
||||||
@ -28,8 +27,8 @@
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
||||||
|
|
||||||
hypre_version=hypre-2.11.2
|
hypre_version=hypre-2.19.0
|
||||||
export HYPRE_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$hypre_version
|
export HYPRE_ARCH_PATH="$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$hypre_version"
|
||||||
|
|
||||||
# END OF (NORMAL) USER EDITABLE PART
|
# END OF (NORMAL) USER EDITABLE PART
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
@ -41,10 +40,22 @@ fi
|
|||||||
if command -v _foamAddLibAuto >/dev/null
|
if command -v _foamAddLibAuto >/dev/null
|
||||||
then
|
then
|
||||||
# Normal sourcing (not makeHYPRE)
|
# Normal sourcing (not makeHYPRE)
|
||||||
|
|
||||||
_foamAddLibAuto $HYPRE_ARCH_PATH
|
_foamAddLibAuto $HYPRE_ARCH_PATH
|
||||||
|
|
||||||
unset hypre_version
|
unset hypre_version
|
||||||
|
|
||||||
|
elif [ "$1" = "-force" ]
|
||||||
|
then
|
||||||
|
# Forced command-line sourcing
|
||||||
|
|
||||||
|
if output="$($WM_PROJECT_DIR/bin/tools/lib-dir -sh $HYPRE_ARCH_PATH 2>/dev/null)"
|
||||||
|
then
|
||||||
|
eval "$output"
|
||||||
|
fi
|
||||||
|
|
||||||
|
unset hypre_version output
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -56,9 +56,7 @@ hint_adios2()
|
|||||||
{
|
{
|
||||||
/bin/cat<<INFORMATION 1>&2
|
/bin/cat<<INFORMATION 1>&2
|
||||||
==> adios2 not found?
|
==> adios2 not found?
|
||||||
|
Define manually, enable in OpenFOAM etc/bashrc, or try the following [POSIX]:
|
||||||
Enable in the OpenFOAM etc/bashrc, define manually or try with the
|
|
||||||
following (POSIX shell):
|
|
||||||
|
|
||||||
eval \$(foamEtcFile -sh -config adios2 -- -force)
|
eval \$(foamEtcFile -sh -config adios2 -- -force)
|
||||||
|
|
||||||
@ -173,6 +171,9 @@ case "$1" in
|
|||||||
-query)
|
-query)
|
||||||
query_adios2
|
query_adios2
|
||||||
;;
|
;;
|
||||||
|
-hint)
|
||||||
|
hint_adios2
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -22,6 +22,7 @@
|
|||||||
#
|
#
|
||||||
# Functions provided
|
# Functions provided
|
||||||
# have_hypre, no_hypre, echo_hypre, query_hypre, search_hypre
|
# have_hypre, no_hypre, echo_hypre, query_hypre, search_hypre
|
||||||
|
# hint_hypre
|
||||||
#
|
#
|
||||||
# Variables set on success
|
# Variables set on success
|
||||||
# HAVE_HYPRE
|
# HAVE_HYPRE
|
||||||
@ -51,6 +52,20 @@ echo_hypre()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Hint for enabling
|
||||||
|
hint_hypre()
|
||||||
|
{
|
||||||
|
/bin/cat<<INFORMATION 1>&2
|
||||||
|
==> hypre not found?
|
||||||
|
Define manually, enable in OpenFOAM etc/bashrc, or try the following [POSIX]:
|
||||||
|
|
||||||
|
eval \$(foamEtcFile -sh -config hypre -- -force)
|
||||||
|
|
||||||
|
==
|
||||||
|
INFORMATION
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# Search
|
# Search
|
||||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||||
#
|
#
|
||||||
@ -114,9 +129,12 @@ have_hypre()
|
|||||||
local config="config.sh/hypre"
|
local config="config.sh/hypre"
|
||||||
local file
|
local file
|
||||||
|
|
||||||
# Setup - prefer current environment value? (TDB)
|
# Setup - prefer current environment value
|
||||||
if [ ! -d "$HYPRE_ARCH_PATH" ]
|
if [ -d "$HYPRE_ARCH_PATH" ] || [ "$HYPRE_ARCH_PATH" = system ]
|
||||||
then
|
then
|
||||||
|
:
|
||||||
|
else
|
||||||
|
# Use config file
|
||||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||||
then
|
then
|
||||||
. "$file"
|
. "$file"
|
||||||
@ -161,6 +179,9 @@ case "$1" in
|
|||||||
-query)
|
-query)
|
||||||
query_hypre
|
query_hypre
|
||||||
;;
|
;;
|
||||||
|
-hint)
|
||||||
|
hint_hypre
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
#
|
#
|
||||||
# Requires
|
# Requires
|
||||||
# PETSC_ARCH_PATH
|
# PETSC_ARCH_PATH
|
||||||
|
# or PETSC_DIR, PETSC_ARCH
|
||||||
# or config.sh/petsc
|
# or config.sh/petsc
|
||||||
#
|
#
|
||||||
# Functions provided
|
# Functions provided
|
||||||
@ -57,9 +58,7 @@ hint_petsc()
|
|||||||
{
|
{
|
||||||
/bin/cat<<INFORMATION 1>&2
|
/bin/cat<<INFORMATION 1>&2
|
||||||
==> petsc not found?
|
==> petsc not found?
|
||||||
|
Define manually, enable in OpenFOAM etc/bashrc, or try the following [POSIX]:
|
||||||
Enable in the OpenFOAM etc/bashrc, define manually or try with the
|
|
||||||
following (POSIX shell):
|
|
||||||
|
|
||||||
eval \$(foamEtcFile -sh -config petsc -- -force)
|
eval \$(foamEtcFile -sh -config petsc -- -force)
|
||||||
|
|
||||||
@ -71,7 +70,16 @@ INFORMATION
|
|||||||
# On success, return 0 and export variables
|
# On success, return 0 and export variables
|
||||||
# -> HAVE_PETSC, PETSC_INC_DIR, PETSC_LIB_DIR
|
# -> HAVE_PETSC, PETSC_INC_DIR, PETSC_LIB_DIR
|
||||||
#
|
#
|
||||||
# $1 = prefix (eg, PETSC_ARCH_PATH)
|
# $1 = prefix (eg, PETSC_DIR, PETSC_ARCH_PATH)
|
||||||
|
# $2 = [arch] (eg, PETSC_ARCH)
|
||||||
|
#
|
||||||
|
# Gets ugly with in-source installation.
|
||||||
|
# 1) In the simple case, petsc is installed with --prefix
|
||||||
|
# we find PREFIX/{include,lib}
|
||||||
|
#
|
||||||
|
# 2) With in-source installation,
|
||||||
|
# headers in PETSC_DIR/include and PETSC_DIR/PETSC_ARCH/include
|
||||||
|
# library is PETSC_DIR/PETSC_ARCH/lib*
|
||||||
search_petsc()
|
search_petsc()
|
||||||
{
|
{
|
||||||
local warn="==> skip petsc"
|
local warn="==> skip petsc"
|
||||||
@ -80,7 +88,8 @@ search_petsc()
|
|||||||
local pkgName="PETSc"
|
local pkgName="PETSc"
|
||||||
|
|
||||||
local prefix="${1:-system}"
|
local prefix="${1:-system}"
|
||||||
local header library
|
local arch="$2"
|
||||||
|
local header library includeDirs libraryDirs
|
||||||
|
|
||||||
# ----------------------------------
|
# ----------------------------------
|
||||||
if isNone "$prefix"
|
if isNone "$prefix"
|
||||||
@ -99,34 +108,56 @@ search_petsc()
|
|||||||
# No system header, attempt discovery with pkg-config
|
# No system header, attempt discovery with pkg-config
|
||||||
if [ -z "$header" ] && pkg-config --exists "$pkgName" 2>/dev/null
|
if [ -z "$header" ] && pkg-config --exists "$pkgName" 2>/dev/null
|
||||||
then
|
then
|
||||||
header=$(pkg-config --cflags-only-I "$pkgName" | sed -e 's/^-[IL]//')
|
includeDirs=$(pkg-config --cflags-only-I "$pkgName" | sed -e 's/^-[IL]//; s/[ ]-[IL]/ /;')
|
||||||
library=$(pkg-config --libs-only-L "$pkgName" | sed -e 's/^-[IL]//')
|
libraryDirs=$(pkg-config --libs-only-L "$pkgName" | sed -e 's/^-[IL]//; s/[ ]-[IL]/ /;')
|
||||||
|
|
||||||
prefix="${header%/*}" # Basename
|
prefix="${includeDirs% *}" # First entry (ie, split on space)
|
||||||
|
prefix="${prefix%/*}" # Basename
|
||||||
# Artifically adjust names (for later)
|
|
||||||
[ -n "$header" ] && header="$header/$incName"
|
|
||||||
[ -n "$library" ] && library="$library/$libName"
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
unset prefix
|
unset prefix
|
||||||
fi
|
fi
|
||||||
# ----------------------------------
|
# ----------------------------------
|
||||||
|
|
||||||
# Header
|
# Header -> directory
|
||||||
[ -n "$header" ] || {
|
if [ -z "$includeDirs" ]
|
||||||
[ -n "$warn" ] && echo "$warn (no header)"
|
then
|
||||||
return 2
|
includeDirs="${header%/*}" # Basename
|
||||||
}
|
|
||||||
|
|
||||||
# Library
|
# Header
|
||||||
[ -n "$library" ] \
|
[ -n "$header" ] || {
|
||||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
[ -n "$warn" ] && echo "$warn (no header)"
|
||||||
|| {
|
return 2
|
||||||
[ -n "$warn" ] && echo "$warn (no library)"
|
}
|
||||||
return 2
|
fi
|
||||||
}
|
|
||||||
|
|
||||||
|
# Library -> directory
|
||||||
|
if [ -z "$libraryDirs" ]
|
||||||
|
then
|
||||||
|
if [ -n "$arch" ] && [ -d "$prefix/$arch" ]
|
||||||
|
then
|
||||||
|
# Prepend with petsc-arch/include
|
||||||
|
if [ -d "$prefix/$arch/include" ]
|
||||||
|
then
|
||||||
|
includeDirs="$prefix/$arch/include${includeDirs:+ }$includeDirs"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Prefer with petsc-arch/lib
|
||||||
|
if [ -z "$library" ]
|
||||||
|
then
|
||||||
|
library=$(findLibrary -prefix="$prefix/$arch" -name="$libName")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -n "$library" ] \
|
||||||
|
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||||
|
|| {
|
||||||
|
[ -n "$warn" ] && echo "$warn (no library)"
|
||||||
|
return 2
|
||||||
|
}
|
||||||
|
|
||||||
|
libraryDirs="${library%/*}" # Basename
|
||||||
|
fi
|
||||||
# ----------------------------------
|
# ----------------------------------
|
||||||
|
|
||||||
# TODO: check size of petsc integer vs label, real vs double?
|
# TODO: check size of petsc integer vs label, real vs double?
|
||||||
@ -134,8 +165,8 @@ search_petsc()
|
|||||||
# OK
|
# OK
|
||||||
export HAVE_PETSC=true
|
export HAVE_PETSC=true
|
||||||
export PETSC_ARCH_PATH="$prefix"
|
export PETSC_ARCH_PATH="$prefix"
|
||||||
export PETSC_INC_DIR="${header%/*}" # Basename
|
export PETSC_INC_DIR="$includeDirs"
|
||||||
export PETSC_LIB_DIR="${library%/*}" # Basename
|
export PETSC_LIB_DIR="$libraryDirs"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -147,9 +178,19 @@ have_petsc()
|
|||||||
local config="config.sh/petsc"
|
local config="config.sh/petsc"
|
||||||
local file
|
local file
|
||||||
|
|
||||||
# Setup - prefer current environment value? (TDB)
|
# Setup - prefer current environment value
|
||||||
if [ ! -d "$PETSC_ARCH_PATH" ]
|
if [ -d "$PETSC_ARCH_PATH" ] || [ "$PETSC_ARCH_PATH" = system ]
|
||||||
then
|
then
|
||||||
|
# OpenFOAM prefix naming, possibly with petsc-arch
|
||||||
|
search_petsc "$PETSC_ARCH_PATH" $PETSC_ARCH
|
||||||
|
|
||||||
|
elif [ -d "$PETSC_DIR" ]
|
||||||
|
then
|
||||||
|
# petsc-dir, petsc-arch naming
|
||||||
|
search_petsc "$PETSC_DIR" $PETSC_ARCH
|
||||||
|
|
||||||
|
else
|
||||||
|
# Use config file
|
||||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||||
then
|
then
|
||||||
. "$file"
|
. "$file"
|
||||||
@ -157,9 +198,8 @@ have_petsc()
|
|||||||
[ -n "$warn" ] && echo "$warn (no $config)"
|
[ -n "$warn" ] && echo "$warn (no $config)"
|
||||||
return 2
|
return 2
|
||||||
fi
|
fi
|
||||||
|
search_petsc "$PETSC_ARCH_PATH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
search_petsc "$PETSC_ARCH_PATH"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -194,6 +234,9 @@ case "$1" in
|
|||||||
-query)
|
-query)
|
||||||
query_petsc
|
query_petsc
|
||||||
;;
|
;;
|
||||||
|
-hint)
|
||||||
|
hint_petsc
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user