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
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
# Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# etc/config.csh/adios2
|
||||
@ -22,7 +21,7 @@
|
||||
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
||||
|
||||
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
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -5,11 +5,10 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# etc/config.csh/hypre
|
||||
@ -31,8 +30,8 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
||||
|
||||
set hypre_version=hypre-2.11.2
|
||||
setenv HYPRE_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$hypre_version
|
||||
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"
|
||||
|
||||
# END OF (NORMAL) USER EDITABLE PART
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -5,11 +5,10 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2017-2018 OpenCFD Ltd.
|
||||
# Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# etc/config.sh/adios2
|
||||
@ -23,7 +22,7 @@
|
||||
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
||||
|
||||
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
|
||||
#------------------------------------------------------------------------------
|
||||
@ -51,7 +50,10 @@ then
|
||||
if output="$($WM_PROJECT_DIR/bin/tools/lib-dir -sh $ADIOS2_ARCH_PATH 2>/dev/null)"
|
||||
then
|
||||
eval "$output"
|
||||
PATH="$ADIOS2_ARCH_PATH/bin:$PATH"
|
||||
if [ -d "$ADIOS2_ARCH_PATH/bin" ]
|
||||
then
|
||||
PATH="$ADIOS2_ARCH_PATH/bin:$PATH"
|
||||
fi
|
||||
fi
|
||||
|
||||
unset adios2_version output
|
||||
|
||||
@ -5,11 +5,10 @@
|
||||
# \\ / A nd | www.openfoam.com
|
||||
# \\/ M anipulation |
|
||||
#------------------------------------------------------------------------------
|
||||
# Copyright (C) 2018 OpenCFD Ltd.
|
||||
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||
#------------------------------------------------------------------------------
|
||||
# License
|
||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||
#
|
||||
# File
|
||||
# etc/config.sh/hypre
|
||||
@ -28,8 +27,8 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# USER EDITABLE PART: Changes made here may be lost with the next upgrade
|
||||
|
||||
hypre_version=hypre-2.11.2
|
||||
export HYPRE_ARCH_PATH=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_LABEL_OPTION/$hypre_version
|
||||
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"
|
||||
|
||||
# END OF (NORMAL) USER EDITABLE PART
|
||||
#------------------------------------------------------------------------------
|
||||
@ -41,10 +40,22 @@ fi
|
||||
if command -v _foamAddLibAuto >/dev/null
|
||||
then
|
||||
# Normal sourcing (not makeHYPRE)
|
||||
|
||||
_foamAddLibAuto $HYPRE_ARCH_PATH
|
||||
|
||||
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
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -56,9 +56,7 @@ hint_adios2()
|
||||
{
|
||||
/bin/cat<<INFORMATION 1>&2
|
||||
==> adios2 not found?
|
||||
|
||||
Enable in the OpenFOAM etc/bashrc, define manually or try with the
|
||||
following (POSIX shell):
|
||||
Define manually, enable in OpenFOAM etc/bashrc, or try the following [POSIX]:
|
||||
|
||||
eval \$(foamEtcFile -sh -config adios2 -- -force)
|
||||
|
||||
@ -173,6 +171,9 @@ case "$1" in
|
||||
-query)
|
||||
query_adios2
|
||||
;;
|
||||
-hint)
|
||||
hint_adios2
|
||||
;;
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
#
|
||||
# Functions provided
|
||||
# have_hypre, no_hypre, echo_hypre, query_hypre, search_hypre
|
||||
# hint_hypre
|
||||
#
|
||||
# Variables set on success
|
||||
# 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
|
||||
# $1 : prefix (*_ARCH_PATH, system, ...)
|
||||
#
|
||||
@ -114,9 +129,12 @@ have_hypre()
|
||||
local config="config.sh/hypre"
|
||||
local file
|
||||
|
||||
# Setup - prefer current environment value? (TDB)
|
||||
if [ ! -d "$HYPRE_ARCH_PATH" ]
|
||||
# Setup - prefer current environment value
|
||||
if [ -d "$HYPRE_ARCH_PATH" ] || [ "$HYPRE_ARCH_PATH" = system ]
|
||||
then
|
||||
:
|
||||
else
|
||||
# Use config file
|
||||
if file="$("$WM_PROJECT_DIR"/bin/foamEtcFile "$config")"
|
||||
then
|
||||
. "$file"
|
||||
@ -161,6 +179,9 @@ case "$1" in
|
||||
-query)
|
||||
query_hypre
|
||||
;;
|
||||
-hint)
|
||||
hint_hypre
|
||||
;;
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
#
|
||||
# Requires
|
||||
# PETSC_ARCH_PATH
|
||||
# or PETSC_DIR, PETSC_ARCH
|
||||
# or config.sh/petsc
|
||||
#
|
||||
# Functions provided
|
||||
@ -57,9 +58,7 @@ hint_petsc()
|
||||
{
|
||||
/bin/cat<<INFORMATION 1>&2
|
||||
==> petsc not found?
|
||||
|
||||
Enable in the OpenFOAM etc/bashrc, define manually or try with the
|
||||
following (POSIX shell):
|
||||
Define manually, enable in OpenFOAM etc/bashrc, or try the following [POSIX]:
|
||||
|
||||
eval \$(foamEtcFile -sh -config petsc -- -force)
|
||||
|
||||
@ -71,7 +70,16 @@ INFORMATION
|
||||
# On success, return 0 and export variables
|
||||
# -> 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()
|
||||
{
|
||||
local warn="==> skip petsc"
|
||||
@ -80,7 +88,8 @@ search_petsc()
|
||||
local pkgName="PETSc"
|
||||
|
||||
local prefix="${1:-system}"
|
||||
local header library
|
||||
local arch="$2"
|
||||
local header library includeDirs libraryDirs
|
||||
|
||||
# ----------------------------------
|
||||
if isNone "$prefix"
|
||||
@ -99,34 +108,56 @@ search_petsc()
|
||||
# No system header, attempt discovery with pkg-config
|
||||
if [ -z "$header" ] && pkg-config --exists "$pkgName" 2>/dev/null
|
||||
then
|
||||
header=$(pkg-config --cflags-only-I "$pkgName" | sed -e 's/^-[IL]//')
|
||||
library=$(pkg-config --libs-only-L "$pkgName" | sed -e 's/^-[IL]//')
|
||||
includeDirs=$(pkg-config --cflags-only-I "$pkgName" | sed -e 's/^-[IL]//; s/[ ]-[IL]/ /;')
|
||||
libraryDirs=$(pkg-config --libs-only-L "$pkgName" | sed -e 's/^-[IL]//; s/[ ]-[IL]/ /;')
|
||||
|
||||
prefix="${header%/*}" # Basename
|
||||
|
||||
# Artifically adjust names (for later)
|
||||
[ -n "$header" ] && header="$header/$incName"
|
||||
[ -n "$library" ] && library="$library/$libName"
|
||||
prefix="${includeDirs% *}" # First entry (ie, split on space)
|
||||
prefix="${prefix%/*}" # Basename
|
||||
fi
|
||||
else
|
||||
unset prefix
|
||||
fi
|
||||
# ----------------------------------
|
||||
|
||||
# Header
|
||||
[ -n "$header" ] || {
|
||||
[ -n "$warn" ] && echo "$warn (no header)"
|
||||
return 2
|
||||
}
|
||||
# Header -> directory
|
||||
if [ -z "$includeDirs" ]
|
||||
then
|
||||
includeDirs="${header%/*}" # Basename
|
||||
|
||||
# Library
|
||||
[ -n "$library" ] \
|
||||
|| library=$(findLibrary -prefix="$prefix" -name="$libName") \
|
||||
|| {
|
||||
[ -n "$warn" ] && echo "$warn (no library)"
|
||||
return 2
|
||||
}
|
||||
# Header
|
||||
[ -n "$header" ] || {
|
||||
[ -n "$warn" ] && echo "$warn (no header)"
|
||||
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?
|
||||
@ -134,8 +165,8 @@ search_petsc()
|
||||
# OK
|
||||
export HAVE_PETSC=true
|
||||
export PETSC_ARCH_PATH="$prefix"
|
||||
export PETSC_INC_DIR="${header%/*}" # Basename
|
||||
export PETSC_LIB_DIR="${library%/*}" # Basename
|
||||
export PETSC_INC_DIR="$includeDirs"
|
||||
export PETSC_LIB_DIR="$libraryDirs"
|
||||
}
|
||||
|
||||
|
||||
@ -147,9 +178,19 @@ have_petsc()
|
||||
local config="config.sh/petsc"
|
||||
local file
|
||||
|
||||
# Setup - prefer current environment value? (TDB)
|
||||
if [ ! -d "$PETSC_ARCH_PATH" ]
|
||||
# Setup - prefer current environment value
|
||||
if [ -d "$PETSC_ARCH_PATH" ] || [ "$PETSC_ARCH_PATH" = system ]
|
||||
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")"
|
||||
then
|
||||
. "$file"
|
||||
@ -157,9 +198,8 @@ have_petsc()
|
||||
[ -n "$warn" ] && echo "$warn (no $config)"
|
||||
return 2
|
||||
fi
|
||||
search_petsc "$PETSC_ARCH_PATH"
|
||||
fi
|
||||
|
||||
search_petsc "$PETSC_ARCH_PATH"
|
||||
}
|
||||
|
||||
|
||||
@ -194,6 +234,9 @@ case "$1" in
|
||||
-query)
|
||||
query_petsc
|
||||
;;
|
||||
-hint)
|
||||
hint_petsc
|
||||
;;
|
||||
esac
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user