ENH: support explicit int-32/64 for metis, scotch

- simplifies creation of 64bit indexed libraries, for reuse
  (with widening) by various OpenFOAM label sizes

- add -bin/-no-bin for metis (as per scotch)
This commit is contained in:
Mark Olesen
2021-08-30 13:47:14 +02:00
parent cd853a6270
commit 665437cf8c
3 changed files with 53 additions and 18 deletions

View File

@ -6,7 +6,7 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2017-2020 OpenCFD Ltd. # Copyright (C) 2017-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -78,7 +78,7 @@ options:
-cmake PATH With cmake from the given path -cmake PATH With cmake from the given path
-help -help
* Compile KaHIP * Build KaHIP (int32_t only)
$kahipPACKAGE $kahipPACKAGE
USAGE USAGE
@ -98,6 +98,8 @@ do
-h | -help) usage ;; -h | -help) usage ;;
-gcc) useGccWmake ;; -gcc) useGccWmake ;;
-force) optForce=true ;; -force) optForce=true ;;
-int32 | -int64) echo "ignoring $1" ;;
-bin | -no-bin) echo "ignoring $1" ;;
-cmake) -cmake)
[ "$#" -ge 2 ] || die "'$1' option requires an argument" [ "$#" -ge 2 ] || die "'$1' option requires an argument"

View File

@ -6,7 +6,7 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2017-2020 OpenCFD Ltd. # Copyright (C) 2017-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -73,9 +73,13 @@ usage() {
usage: ${0##*/} [OPTION] [lib|libso] [METIS-VERSION] usage: ${0##*/} [OPTION] [lib|libso] [METIS-VERSION]
options: options:
-gcc Force use of gcc/g++ -gcc Force use of gcc/g++
-int32 Use IDXTYPEWIDTH 32
-int64 Use IDXTYPEWIDTH 64
-bin Create metis binaries as well (default)
-no-bin Suppress creation of metis binaries
-help -help
* build METIS with * Build METIS (default: -int${WM_LABEL_SIZE:-32}) with
${metisPACKAGE:-'unspecified metis version'} ${metisPACKAGE:-'unspecified metis version'}
USAGE USAGE
@ -85,6 +89,10 @@ USAGE
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
exportCompiler # Compiler info for CMake/configure exportCompiler # Compiler info for CMake/configure
unset optForce
optBinaries=true
optIntSize="${WM_LABEL_SIZE:-32}"
# Parse options # Parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
@ -92,6 +100,10 @@ do
'') ;; # Ignore empty '') ;; # Ignore empty
-h | -help) usage ;; -h | -help) usage ;;
-gcc) useGcc ;; -gcc) useGcc ;;
-force) echo "ignoring $1" ;;
-int32 | -int64) optIntSize="${1#-int}" ;;
-bin) optBinaries=true ;;
-no-bin) optBinaries=false ;;
lib|libso) lib|libso)
targetType="$1" targetType="$1"
@ -155,19 +167,30 @@ METIS_SOURCE_DIR=$sourceBASE/$metisPACKAGE
# #
install() install()
{ {
local libdir=$METIS_ARCH_PATH/lib local bindir="$METIS_ARCH_PATH"/bin
local libdir="$METIS_ARCH_PATH"/lib
if [ "$optBinaries" = false ]
then
echo "Removing binaries: $bindir"
rm -rf "$bindir" 2>/dev/null # Failed removal is uncritical
fi
if [ "$targetType" = libso ] if [ "$targetType" = libso ]
then then
\mv $libdir/libmetis$EXT_SO $FOAM_EXT_LIBBIN mv "$libdir/libmetis$EXT_SO" "$FOAM_EXT_LIBBIN"
rmdir $libdir 2>/dev/null # Failed rmdir is uncritical rmdir "$libdir" 2>/dev/null # Failed rmdir is uncritical
echo "Installing: $FOAM_EXT_LIBBIN/libmetis$EXT_SO" echo "Installing: $FOAM_EXT_LIBBIN/libmetis$EXT_SO"
fi fi
return 0 return 0
} }
echo "Starting build: $metisPACKAGE ($targetType)" echo "Starting build: $metisPACKAGE ($targetType)"
if [ "$optIntSize" != "$WM_LABEL_SIZE" ]
then
echo "Using int-$optIntSize instead of int-$WM_LABEL_SIZE"
fi
echo echo
( (
# Configuration options: # Configuration options:
@ -180,17 +203,17 @@ echo
cd "$METIS_SOURCE_DIR" || exit cd "$METIS_SOURCE_DIR" || exit
export GIT_DIR="$PWD/.git" # Mask seeing our own git-repo export GIT_DIR="$PWD/.git" # Mask seeing our own git-repo
rm -rf $METIS_ARCH_PATH rm -rf "$METIS_ARCH_PATH"
rm -f $FOAM_EXT_LIBBIN/libmetis$EXT_SO rm -f "$FOAM_EXT_LIBBIN"/libmetis*
# Adjust metis integer size to match OpenFOAM label-size # Adjust metis IDXTYPEWIDTH (integer size)
sed -i -e 's=\(#define IDXTYPEWIDTH\).*=\1 '$WM_LABEL_SIZE'=' \ sed -i -e 's=\(#define IDXTYPEWIDTH\).*=\1 '"$optIntSize"'=' \
include/metis.h include/metis.h
# No config option for the library location. # No config option for the library location.
# - build normally and use mv to relocate it # - build normally and use mv to relocate it
make config $configOpt prefix=$METIS_ARCH_PATH \ make config $configOpt prefix="$METIS_ARCH_PATH" \
&& make -j $WM_NCOMPPROCS install \ && make -j $WM_NCOMPPROCS install \
&& echo "Built: metis" \ && echo "Built: metis" \
&& install && install

View File

@ -6,7 +6,7 @@
# \\ / A nd | www.openfoam.com # \\ / A nd | www.openfoam.com
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2019-2020 OpenCFD Ltd. # Copyright (C) 2019-2021 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -48,12 +48,14 @@ options:
-force Force compilation, even if include/library already exists -force Force compilation, even if include/library already exists
Also force build attempt of pt-scotch (mingw) Also force build attempt of pt-scotch (mingw)
-gcc Force use of gcc/g++ -gcc Force use of gcc/g++
-bin Create scotch binaries as well (experimental) -int32 Use SCOTCH_Num 32
-int64 Use SCOTCH_Num 64
-bin Create scotch binaries as well
-no-bin Suppress creation of scotch binaries (default) -no-bin Suppress creation of scotch binaries (default)
-no-mpi Suppress build of pt-scotch -no-mpi Suppress build of pt-scotch
-help -help
* Compile SCOTCH * Build SCOTCH (default: -int${WM_LABEL_SIZE:-32}) with
$scotchPACKAGE $scotchPACKAGE
USAGE USAGE
@ -62,7 +64,9 @@ USAGE
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
unset optBinaries optForce unset optForce
optBinaries=false
optIntSize="${WM_LABEL_SIZE:-32}"
# Parse options # Parse options
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
@ -72,9 +76,9 @@ do
-h | -help) usage ;; -h | -help) usage ;;
-gcc) useGcc ;; -gcc) useGcc ;;
-force) optForce=true ;; -force) optForce=true ;;
-int32 | -int64) optIntSize="${1#-int}" ;;
-bin) optBinaries=true ;; -bin) optBinaries=true ;;
-no-bin) unset optBinaries ;; -no-bin) optBinaries=false ;;
-no-mpi) unset withMPI ;; -no-mpi) unset withMPI ;;
scotch-[0-9]* | scotch-git | scotch_* ) scotch-[0-9]* | scotch-git | scotch_* )
@ -146,6 +150,12 @@ binDIR="$prefixDIR"/bin
incDIR="$prefixDIR"/include incDIR="$prefixDIR"/include
libDIR="$FOAM_EXT_LIBBIN" libDIR="$FOAM_EXT_LIBBIN"
if [ "$optIntSize" != "$WM_LABEL_SIZE" ]
then
echo "Using int-$optIntSize instead of int-$WM_LABEL_SIZE"
export WM_LABEL_SIZE="$optIntSize"
fi
# Test installation. May or may not have libscotcherrexit.so # Test installation. May or may not have libscotcherrexit.so
if [ -z "$optForce" ] \ if [ -z "$optForce" ] \
&& [ -f "$incDIR"/scotch.h ] \ && [ -f "$incDIR"/scotch.h ] \