ENH: build petsc with debugging off (fixes #58)

- also permit petsc to determine its own hypre version (#58)
This commit is contained in:
Mark Olesen
2020-09-07 15:00:48 +02:00
parent 28f482b836
commit 9a3938551a
2 changed files with 63 additions and 37 deletions

View File

@ -64,6 +64,7 @@ while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
'') ;; # Ignore empty '') ;; # Ignore empty
--) break;; # Extra configure options (leave on $@ for later detection)
-h | -help) usage ;; -h | -help) usage ;;
-gcc) useGcc ;; -gcc) useGcc ;;
-force) optForce=true ;; -force) optForce=true ;;

View File

@ -30,16 +30,13 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
} }
. etc/tools/ThirdPartyFunctions . etc/tools/ThirdPartyFunctions
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
_foamConfig hypre
_foamConfig petsc _foamConfig petsc
hyprePACKAGE="${hypre_version:-hypre-none}"
petscPACKAGE="${petsc_version:-petsc-system}" petscPACKAGE="${petsc_version:-petsc-system}"
targetType=libso targetType=libso
# Should be possible to build with download, but seems to fail unset hyprePACKAGE
# hypreURL="https://github.com/hypre-space/hypre/archive/v2.14.0.tar.gz" unset HYPRE_ARCH_PATH # Avoid inconsistency
unset hypreURL
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { usage() {
@ -52,7 +49,8 @@ options:
-force Force compilation, even if include/library already exists -force Force compilation, even if include/library already exists
-gcc Force use of gcc/g++ -gcc Force use of gcc/g++
-inplace Build/install inplace (expert option) -inplace Build/install inplace (expert option)
-no-hypre Disable automatic hypre detection -hypre=URL Specify hypre download location
-no-hypre Disable automatic hypre download/detection
-help -help
* build PETSC with * build PETSC with
@ -70,13 +68,14 @@ USAGE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
exportCompiler # Compiler info for CMake/configure exportCompiler # Compiler info for CMake/configure
unset optForce optInplace unset optForce optInplace optHypre
# Parse options # Parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
'') ;; # Ignore empty '') ;; # Ignore empty
--) break;; # Extra configure options (leave on $@ for later detection)
-h | -help) usage ;; -h | -help) usage ;;
-gcc) useGcc ;; -gcc) useGcc ;;
-force) optForce=true ;; -force) optForce=true ;;
@ -86,19 +85,24 @@ do
targetType="$1" targetType="$1"
;; ;;
-hypre=*)
optHypre="${1#*=}" # URL for downloadd
unset hyprePACKAGE HYPRE_ARCH_PATH
;;
-no-hypre) -no-hypre)
unset hyprePACKAGE hypreURL optHypre=false
unset HYPRE_ARCH_PATH unset hyprePACKAGE HYPRE_ARCH_PATH
;; ;;
hypre-[0-9]* | hypre-git) hypre-[0-9]* | hypre-git)
hyprePACKAGE="${1%%/}" hyprePACKAGE="${1%%/}"
unset hypreURL unset optHypre
unset HYPRE_ARCH_PATH # Avoid inconsistency unset HYPRE_ARCH_PATH # Avoid inconsistency
;; ;;
petsc-[0-9]* | petsc-git) petsc-[0-9]* | petsc-git)
petscPACKAGE="${1%%/}" petscPACKAGE="${1%%/}"
unset PETSC_ARCH_PATH # Avoid inconsistency unset PETSC_ARCH_PATH # Avoid inconsistency
;; ;;
*) *)
die "unknown option/argument: '$1'" die "unknown option/argument: '$1'"
@ -123,13 +127,11 @@ fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Integrations # Integrations
# No hypre # Clunky
if _foamIsNone "$hyprePACKAGE" if [ -z "$optHypre" ] && [ -n "$hyprePACKAGE" ] \
&& ! _foamIsNone "$hyprePACKAGE"
then then
: echo "Using $hyprePACKAGE"
elif [ -n "$hyprePACKAGE" ]
then
# Clunky
: "${HYPRE_ARCH_PATH:=$installBASE$WM_SIZE_OPTIONS/$hyprePACKAGE}" : "${HYPRE_ARCH_PATH:=$installBASE$WM_SIZE_OPTIONS/$hyprePACKAGE}"
fi fi
@ -170,27 +172,23 @@ else
fi fi
echo "Starting build: $petscPACKAGE ($targetType)" echo "Starting build: $petscPACKAGE ($targetType)"
if [ "$WM_PRECISION_OPTION" = SP ]
then
optHypre=false # No single-precision hypre
echo "No single-precision hypre"
fi
if [ -d "$PETSC_SOURCE_DIR/$archOpt/externalpackages" ]
then
echo "Removing old $archOpt/externalpackages"
rm -rf "$PETSC_SOURCE_DIR/$archOpt/externalpackages"
fi
echo echo
( (
# Configuration options # Configuration options
configOpt="--with-cc=$(whichMpicc) --with-cxx=$(whichMpicxx)" configOpt="--with-cc=$(whichMpicc) --with-cxx=$(whichMpicxx)"
configOpt="$configOpt --with-debugging=0"
# Normally want hypre but this is really clunky # A reasonable assumption
if [ -f "$HYPRE_ARCH_PATH/include/HYPRE.h" ] configOpt="$configOpt --COPTFLAGS=-O3 --CXXOPTFLAGS=-O3"
then
echo "Has installed hypre: $hyprePACKAGE"
configOpt="$configOpt --with-hypre-dir=$HYPRE_ARCH_PATH"
elif [ -n "$urlHypre" ]
then
configOpt="$configOpt --download-hypre=$urlHypre"
fi
# Additional configure options
if [ "$1" = "--" ]
then
shift
configOpt="$configOpt $@"
fi
if [ "$targetType" = libso ] if [ "$targetType" = libso ]
then then
@ -211,14 +209,40 @@ echo
configOpt="$configOpt --with-precision=double" configOpt="$configOpt --with-precision=double"
fi fi
case "$optHypre" in
false)
configOpt="$configOpt --with-hypre=0"
;;
ftp:* | git:* | http:* | https:*)
configOpt="$configOpt --download-hypre=$optHypre"
;;
*)
# This is a really clunky way to use ThirdParty hypre
if [ -f "$HYPRE_ARCH_PATH/include/HYPRE.h" ]
then
echo "Has installed hypre: $hyprePACKAGE"
configOpt="$configOpt --with-hypre-dir=$HYPRE_ARCH_PATH"
else
configOpt="$configOpt --download-hypre"
fi
;;
esac
# Additional configure options
if [ "$1" = "--" ]
then
shift
configOpt="$configOpt $@"
fi
# We export compiler settings (above) but actually use the # We export compiler settings (above) but actually use the
# --with-cc and --with-cxx. So ignore them and flags # --with-cc and --with-cxx. So ignore these environment variables.
unset CC CXX unset CC CXX
unset CFLAGS CXXFLAGS unset CFLAGS CXXFLAGS
cd "$PETSC_SOURCE_DIR" || exit cd "$PETSC_SOURCE_DIR" || exit
export GIT_DIR="$PWD/.git" # Mask seeing our own git-repo unset GIT_DIR # No special git-repo handling
rm -rf "$PETSC_ARCH_PATH" rm -rf "$PETSC_ARCH_PATH"
# No clean here, if we have multiple arch in the same directory # No clean here, if we have multiple arch in the same directory
@ -226,6 +250,7 @@ echo
## without tests? --testdir=.. ## without tests? --testdir=..
## configOpt="$configOpt --download-f2cblaslapack=1" ## configOpt="$configOpt --download-f2cblaslapack=1"
echo
set -x set -x
./configure \ ./configure \
${installPrefix:+--prefix="$installPrefix"} \ ${installPrefix:+--prefix="$installPrefix"} \