diff --git a/BUILD.md b/BUILD.md index ff5e325ef08a755c96d82adefec0855c845534e2..179e4fc459afd6bbed1baa9c1a5082f84a05d8fa 100644 --- a/BUILD.md +++ b/BUILD.md @@ -420,6 +420,7 @@ you may have additional hurdles to using the newest versions of clang. | [CGAL][page CGAL] | [download][link CGAL] | [FFTW][page FFTW] | [download][link FFTW] | [PETSC][page PETSC] | [download][link PETSC] +| [HYPRE][page HYPRE] | [repo][repo HYPRE] or [download][link HYPRE] | [ADF/CGNS][page CGNS], ccm | [link ccmio][link ccmio] | gperftools | [repo][repo gperftools] or [download][link gperftools] @@ -565,6 +566,10 @@ easier to use `grep` and find the relevant pages and links. [page petsc]: https://www.mcs.anl.gov/petsc/ [link petsc]: http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-3.13.2.tar.gz +[page hypre]: https://computing.llnl.gov/projects/hypre-scalable-linear-solvers-multigrid-methods/ +[repo hypre]: https://github.com/hypre-space/hypre/ +[link hypre]: https://github.com/hypre-space/hypre/archive/v2.19.0.tar.gz + [page cgns]: http://cgns.github.io/ [link ccmio]: http://portal.nersc.gov/project/visit/third_party/libccmio-2.6.1.tar.gz (check usage conditions) [altlink ccmio]: http://portal.nersc.gov/svn/visit/trunk/third_party/libccmio-2.6.1.tar.gz (check usage conditions) diff --git a/makeHYPRE b/makeHYPRE index 5b6dbbc832bbda1a993c5e458b4d032d76d13cba..9667b9c3f62c947dadb8d6a520c4a19429b1e478 100755 --- a/makeHYPRE +++ b/makeHYPRE @@ -20,35 +20,7 @@ # ---------------------------------------------- # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE #------------------------------------------------------------------------------ -# Dynamic library ending (default is .so) -[ "$(uname -s)" = Darwin ] && EXT_SO=.dylib || EXT_SO=.so -# Short-circuit test for an installation -if [ "$1" = "-test" ] -then - [ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; } - dir="${2%/}" # <- HYPRE_ARCH_PATH - if [ -d "$dir/include" ] - then - for lib in \ - $FOAM_EXT_LIBBIN/libhypre$EXT_SO \ - $dir/lib/libhypre.a \ - $dir/lib/libhypre$EXT_SO \ - $dir/lib$WM_COMPILER_LIB_ARCH/libhypre.a \ - $dir/lib$WM_COMPILER_LIB_ARCH/libhypre$EXT_SO \ - ; - do - if [ -r "$lib" ] - then - echo " hypre include: $dir/include" - echo " hypre library: ${lib%/*}" - exit 0 - fi - done - fi - exit 2 -fi -#------------------------------------------------------------------------------ # Run from third-party directory only cd "${0%/*}" || exit wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { @@ -56,16 +28,11 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { echo " Check your OpenFOAM environment and installation" exit 1 } -[ -n "$FOAM_EXT_LIBBIN" ] || { - echo "Error (${0##*/}) : \$FOAM_EXT_LIBBIN not set" - echo " Check your OpenFOAM environment and installation" - exit 1 -} . etc/tools/ThirdPartyFunctions #------------------------------------------------------------------------------ _foamConfig hypre -hyprePACKAGE=${hypre_version:-hypre-system} +hyprePACKAGE="${hypre_version:-hypre-system}" targetType=libso #------------------------------------------------------------------------------ @@ -74,7 +41,7 @@ usage() { while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat<<USAGE -usage: ${0##*/} [OPTION] [lib|libso] [HYPRE-VERSION] +usage: ${0##*/} [OPTION] [lib|libso] [HYPRE-VERSION] [-- configure-options] options: -gcc Force use of gcc/g++ -help @@ -83,6 +50,7 @@ options: ${hyprePACKAGE:-'unspecified hypre version'} USAGE + showDownloadHint HYPRE exit 1 } #------------------------------------------------------------------------------ @@ -100,7 +68,7 @@ do targetType="$1" ;; - hypre-[0-9]*) + hypre-[0-9]* | hypre-git) hyprePACKAGE="${1%%/}" unset HYPRE_ARCH_PATH # Avoid inconsistency ;; @@ -114,11 +82,11 @@ done [ -n "$hyprePACKAGE" ] || die "The hypre-VERSION was not specified" # Nothing to build -if _foamIsNone $hyprePACKAGE +if _foamIsNone "$hyprePACKAGE" then echo "Using hypre-none (skip ThirdParty build of HYPRE)" exit 0 -elif _foamIsSystem $hyprePACKAGE +elif _foamIsSystem "$hyprePACKAGE" then echo "Using hypre-system" exit 0 @@ -131,12 +99,12 @@ fi # HYPRE_ARCH_PATH : installation directory # HYPRE_SOURCE_DIR : location of the original sources -HYPRE_SOURCE_DIR=$sourceBASE/$hyprePACKAGE +HYPRE_SOURCE_DIR="$sourceBASE/$hyprePACKAGE" : "${HYPRE_ARCH_PATH:=$installBASE$WM_SIZE_OPTIONS/$hyprePACKAGE}" [ -d "$HYPRE_SOURCE_DIR" ] || { echo "Missing sources: '$hyprePACKAGE'" - showDownloadHint HYPER + showDownloadHint HYPRE exit 1 } @@ -148,17 +116,24 @@ CXX="$(whichMpicxx)" echo "Starting build: $hyprePACKAGE ($targetType)" echo ( - # Configuration options: + # Configuration options unset configOpt + # Additional configure options + if [ "$1" = "--" ] + then + shift + configOpt="$configOpt $@" + fi + cd "$HYPRE_SOURCE_DIR/src" || exit export GIT_DIR="$PWD/.git" # Mask seeing our own git-repo - rm -rf $HYPRE_ARCH_PATH + rm -rf "$HYPRE_ARCH_PATH" [ -e Makefile ] && make distclean 2>/dev/null ./configure \ - --prefix=$HYPRE_ARCH_PATH \ + --prefix="$HYPRE_ARCH_PATH" \ --disable-fortran \ --enable-shared \ $configOpt \ diff --git a/makePETSC b/makePETSC index 5988cc8e944e1684dd42b31f2c38a6e015a60189..0cac627fe3ba8a47e1696ed795693b5d331cab3c 100755 --- a/makePETSC +++ b/makePETSC @@ -20,35 +20,7 @@ # ---------------------------------------------- # NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE #------------------------------------------------------------------------------ -# Dynamic library ending (default is .so) -[ "$(uname -s)" = Darwin ] && EXT_SO=.dylib || EXT_SO=.so -# Short-circuit test for an installation -if [ "$1" = "-test" ] -then - [ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; } - dir="${2%/}" # <- *_ARCH_PATH - if [ -d "$dir/include" ] - then - for lib in \ - $FOAM_EXT_LIBBIN/libpetsc$EXT_SO \ - $dir/lib/libpetsc.a \ - $dir/lib/libpetsc$EXT_SO \ - $dir/lib$WM_COMPILER_LIB_ARCH/libpetsc.a \ - $dir/lib$WM_COMPILER_LIB_ARCH/libpetsc$EXT_SO \ - ; - do - if [ -r "$lib" ] - then - echo " petsc include: $dir/include" - echo " petsc library: ${lib%/*}" - exit 0 - fi - done - fi - exit 2 -fi -#------------------------------------------------------------------------------ # Run from third-party directory only cd "${0%/*}" || exit wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { @@ -56,38 +28,44 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || { echo " Check your OpenFOAM environment and installation" exit 1 } -[ -n "$FOAM_EXT_LIBBIN" ] || { - echo "Error (${0##*/}) : \$FOAM_EXT_LIBBIN not set" - echo " Check your OpenFOAM environment and installation" - exit 1 -} . etc/tools/ThirdPartyFunctions #------------------------------------------------------------------------------ +_foamConfig hypre _foamConfig petsc -petscPACKAGE=${petsc_version:-petsc-system} +hyprePACKAGE="${hypre_version:-hypre-none}" +petscPACKAGE="${petsc_version:-petsc-system}" targetType=libso +# Should be possible to build with download, but seems to fail +# hypreURL="https://github.com/hypre-space/hypre/archive/v2.14.0.tar.gz" +unset hypreURL + #------------------------------------------------------------------------------ usage() { exec 1>&2 while [ "$#" -ge 1 ]; do echo "$1"; shift; done cat<<USAGE -usage: ${0##*/} [OPTION] [lib|libso] [PETSC-VERSION] +usage: ${0##*/} [OPTION] [lib|libso] [HYPRE-VERSION] [PETSC-VERSION] [-- configure-options] options: -gcc Force use of gcc/g++ + -inplace Build/install inplace (expert option) + -no-hype Disable automatic hypre detection -help * build PETSC with ${petscPACKAGE:-'unspecified petsc version'} USAGE + showDownloadHint PETSC exit 1 } #------------------------------------------------------------------------------ exportCompiler # Compiler info for CMake/configure +unset optInplace + # Parse options while [ "$#" -gt 0 ] do @@ -96,10 +74,24 @@ do -h | -help) usage ;; -gcc) useGcc ;; + -inplace) + optInplace=true + ;; + lib|libso) targetType="$1" ;; + -no-hypre) + unset hyprePACKAGE hypreURL + unset HYPRE_ARCH_PATH + ;; + + hypre-[0-9]* | hypre-git) + hyprePACKAGE="${1%%/}" + unset hypreURL + unset HYPRE_ARCH_PATH # Avoid inconsistency + ;; petsc-[0-9]* | petsc-git) petscPACKAGE="${1%%/}" unset PETSC_ARCH_PATH # Avoid inconsistency @@ -124,6 +116,20 @@ then exit 0 fi +#------------------------------------------------------------------------------ +# Integrations + +# No hypre +if _foamIsNone "$hyprePACKAGE" +then + : +elif [ -n "$hyprePACKAGE" ] +then + # Clunky + : "${HYPRE_ARCH_PATH:=$installBASE$WM_SIZE_OPTIONS/$hyprePACKAGE}" +fi + + #------------------------------------------------------------------------------ # # Build PETSC @@ -141,15 +147,47 @@ PETSC_SOURCE_DIR="$sourceBASE/$petscPACKAGE" } +# PETSC arch - same root as WM_OPTIONS (eg, DPInt32) +archOpt="$WM_SIZE_OPTIONS" + +if [ -n "$optInplace" ] +then + unset installPrefix + # No install stage requires + makeInstall() { true; } +else + + # Regular installation location + installPrefix="$PETSC_ARCH_PATH" + + makeInstall() { + make PETSC_DIR="$PETSC_SOURCE_DIR" PETSC_ARCH="$archOpt" install + } +fi + echo "Starting build: $petscPACKAGE ($targetType)" echo ( - # PETSC arch - same root as WM_OPTIONS (eg, DPInt32) - archOpt="$WM_SIZE_OPTIONS" - # Configuration options configOpt="--with-cc=$(whichMpicc) --with-cxx=$(whichMpicxx)" + # Normally want hypre but this is really clunky + if [ -f "$HYPRE_ARCH_PATH/include/HYPRE.h" ] + 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 ] then configOpt="$configOpt --with-shared-libraries" @@ -179,25 +217,29 @@ echo export GIT_DIR="$PWD/.git" # Mask seeing our own git-repo rm -rf "$PETSC_ARCH_PATH" + # No clean here, if we have multiple arch in the same directory ## without tests? --testdir=.. + ## configOpt="$configOpt --download-f2cblaslapack=1" set -x ./configure \ - --prefix="$PETSC_ARCH_PATH" \ + ${installPrefix:+--prefix="$installPrefix"} \ + --PETSC_DIR="$PETSC_SOURCE_DIR" \ --with-petsc-arch="$archOpt" \ --with-clanguage=C \ --with-fc=0 \ --with-scalapack=0 \ --with-superlu_dist=0 \ --with-suitesparse=0 \ - --download-f2cblaslapack=1 \ + --with-x=0 \ $configOpt \ && set +x \ && echo "Configured: petsc" \ - && make PETSC_DIR="$PETSC_SOURCE_DIR" PETSC_ARCH="$archOpt" all \ + && make ${WM_NCOMPPROCS:+-j $WM_NCOMPPROCS} \ + PETSC_DIR="$PETSC_SOURCE_DIR" PETSC_ARCH="$archOpt" all \ && echo "Built: petsc" \ - && make PETSC_DIR="$PETSC_SOURCE_DIR" PETSC_ARCH="$archOpt" install \ + && makeInstall \ && echo "Installed: petsc - may require etc/pkgconfigPrefix to relocate" ) || { echo "Error building: petsc"