mirror of
https://develop.openfoam.com/Development/ThirdParty-common.git
synced 2025-12-08 06:57:50 +00:00
ENH: explictly set scotch INTSIZE. Tag scotch libs with -intNN ending
- Use WM_LABEL_SIZE to explicitly define INTSIZE32 or INTSIZE64, which ensures that SCOTCH_Num appears as (int32_t | int64_t) and avoids any ambiguity that a plain 'int' may have. - Provide library symlinks to the respective label-size. Eg, libscotch.so -> libscotch-int32.so This provides a unique library linkage name that avoids ambiguity with system-installed libraries. - Use IDXSIZE64 (memory addressing width Fortran) NOTE Unfortunately -DINT32 seems to fail if openmpi was built without Fortran! The MPI_INT32_T is interpreted as MPI_INTEGER4 which does not exist - needs more investigation ENH: scotch - document Makefile.inc by copying into the source directory ENH: update kahip build to use cmake for newer versions
This commit is contained in:
@ -1,4 +1,6 @@
|
|||||||
/* NOTE: make any changes to this file in etc/wmakeFiles/ */
|
/*
|
||||||
|
* NOTE: make any changes to this file in ThirdParty etc/wmakeFiles/
|
||||||
|
*/
|
||||||
|
|
||||||
interface/kaHIP_interface.cpp
|
interface/kaHIP_interface.cpp
|
||||||
|
|
||||||
@ -66,5 +68,4 @@ algorithms/cycle_search.cpp
|
|||||||
partition/uncoarsening/refinement/cycle_improvements/cycle_refinement.cpp
|
partition/uncoarsening/refinement/cycle_improvements/cycle_refinement.cpp
|
||||||
partition/uncoarsening/refinement/tabu_search/tabu_search.cpp
|
partition/uncoarsening/refinement/tabu_search/tabu_search.cpp
|
||||||
|
|
||||||
|
LIB = $(KAHIP_LIB_DIR)/libkahip
|
||||||
LIB = $(FOAM_EXT_LIBBIN)/libkahip
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* NOTE: make any changes to this file in etc/wmakeFiles/
|
* NOTE: make any changes to this file in ThirdParty etc/wmakeFiles/
|
||||||
* Must use -DNDEBUG to disable kahip debug mode.
|
* Must use -DNDEBUG to disable kahip debug mode.
|
||||||
* Using -DMODE_NODESEP is not strictly required for building the library.
|
* Using -DMODE_NODESEP is not strictly required for building the library.
|
||||||
*/
|
*/
|
||||||
@ -9,10 +9,13 @@ EXE_INC = \
|
|||||||
${COMP_OPENMP} \
|
${COMP_OPENMP} \
|
||||||
-DNDEBUG -DMODE_NODESEP \
|
-DNDEBUG -DMODE_NODESEP \
|
||||||
-I. \
|
-I. \
|
||||||
-I$(KAHIP_LIB_SRC) \
|
-I./partition \
|
||||||
-I$(KAHIP_LIB_SRC)/partition \
|
-I./partition/uncoarsening/refinement/quotient_graph_refinement/flow_refinement
|
||||||
-I$(KAHIP_LIB_SRC)/partition/uncoarsening/refinement/quotient_graph_refinement/flow_refinement
|
|
||||||
|
|
||||||
LIB_LIBS =
|
LIB_LIBS =
|
||||||
|
|
||||||
PROJECT_LIBS =
|
PROJECT_LIBS =
|
||||||
|
|
||||||
|
/* failsafe location */
|
||||||
|
ifeq (,$(strip $(KAHIP_LIB_DIR)))
|
||||||
|
KAHIP_LIB_DIR = $(FOAM_EXT_LIBBIN)
|
||||||
|
endif
|
||||||
|
|||||||
@ -33,9 +33,18 @@ CFLAGS = $(WM_CFLAGS) -fPIC -O3 \
|
|||||||
-DCOMMON_RANDOM_FIXED_SEED \
|
-DCOMMON_RANDOM_FIXED_SEED \
|
||||||
-DSCOTCH_DETERMINISTIC \
|
-DSCOTCH_DETERMINISTIC \
|
||||||
-DSCOTCH_RENAME \
|
-DSCOTCH_RENAME \
|
||||||
|
-DIDXSIZE64 \
|
||||||
-Drestrict=__restrict
|
-Drestrict=__restrict
|
||||||
|
|
||||||
# 32-bit vs. 64-bit labels
|
# Use 32/64-bit integers
|
||||||
|
# ---------------
|
||||||
|
# Unfortunately -DINT32 seems to fail when openmpi is build without
|
||||||
|
# Fortran! The MPI_INT32_T is interpreted as MPI_INTEGER4 which does
|
||||||
|
# not exist
|
||||||
|
# ---------------
|
||||||
|
# ifeq ($(WM_LABEL_SIZE),32)
|
||||||
|
# CFLAGS += -DINTSIZE32
|
||||||
|
# endif
|
||||||
ifeq ($(WM_LABEL_SIZE),64)
|
ifeq ($(WM_LABEL_SIZE),64)
|
||||||
CFLAGS += -DINTSIZE64
|
CFLAGS += -DINTSIZE64
|
||||||
endif
|
endif
|
||||||
@ -50,7 +59,8 @@ LN = ln
|
|||||||
MKDIR = mkdir
|
MKDIR = mkdir
|
||||||
MV = mv
|
MV = mv
|
||||||
RANLIB = echo
|
RANLIB = echo
|
||||||
LEX = flex -Pscotchyy -olex.yy.c
|
|
||||||
YACC = bison -pscotchyy -y -b y
|
LEX = flex "-Pscotchyy$(SCOTCH_NAME_SUFFIX)" -olex.yy.c
|
||||||
|
YACC = bison "-pscotchyy$(SCOTCH_NAME_SUFFIX)" -y -b y
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
@ -40,15 +40,23 @@ CCS = x86_64-w64-mingw32-gcc $(CFLAGS_WINMPI)
|
|||||||
CCP = x86_64-w64-mingw32-gcc $(CFLAGS_WINMPI)
|
CCP = x86_64-w64-mingw32-gcc $(CFLAGS_WINMPI)
|
||||||
CCD = gcc $(CFLAGS_WINMPI)
|
CCD = gcc $(CFLAGS_WINMPI)
|
||||||
CFLAGS = $(WM_CFLAGS) -fPIC -O3 \
|
CFLAGS = $(WM_CFLAGS) -fPIC -O3 \
|
||||||
-DCOMMON_PTHREAD_FILE \
|
-DCOMMON_PTHREAD_FILE -DSCOTCH_PTHREAD \
|
||||||
-UCOMMON_FILE_COMPRESS \
|
-UCOMMON_FILE_COMPRESS \
|
||||||
-DCOMMON_RANDOM_FIXED_SEED \
|
-DCOMMON_RANDOM_FIXED_SEED \
|
||||||
-DSCOTCH_DETERMINISTIC \
|
-DSCOTCH_DETERMINISTIC \
|
||||||
-DSCOTCH_RENAME \
|
-DSCOTCH_RENAME \
|
||||||
-DSCOTCH_PTHREAD \
|
-DIDXSIZE64 \
|
||||||
-Drestrict=__restrict
|
-Drestrict=__restrict
|
||||||
|
|
||||||
# 32-bit vs. 64-bit labels
|
# Use 32/64-bit integers
|
||||||
|
# ---------------
|
||||||
|
# Unfortunately -DINT32 seems to fail when openmpi is build without
|
||||||
|
# Fortran! The MPI_INT32_T is interpreted as MPI_INTEGER4 which does
|
||||||
|
# not exist
|
||||||
|
# ---------------
|
||||||
|
# ifeq ($(WM_LABEL_SIZE),32)
|
||||||
|
# CFLAGS += -DINTSIZE32
|
||||||
|
# endif
|
||||||
ifeq ($(WM_LABEL_SIZE),64)
|
ifeq ($(WM_LABEL_SIZE),64)
|
||||||
CFLAGS += -DINTSIZE64
|
CFLAGS += -DINTSIZE64
|
||||||
endif
|
endif
|
||||||
@ -67,7 +75,8 @@ LN = ln
|
|||||||
MKDIR = mkdir
|
MKDIR = mkdir
|
||||||
MV = mv
|
MV = mv
|
||||||
RANLIB = echo
|
RANLIB = echo
|
||||||
LEX = flex -Pscotchyy -olex.yy.c
|
|
||||||
YACC = bison -pscotchyy -y -b y
|
LEX = flex "-Pscotchyy$(SCOTCH_NAME_SUFFIX)" -olex.yy.c
|
||||||
|
YACC = bison "-pscotchyy$(SCOTCH_NAME_SUFFIX)" -y -b y
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
@ -33,9 +33,18 @@ CFLAGS = $(WM_CFLAGS) -fPIC -O3 \
|
|||||||
-DCOMMON_RANDOM_FIXED_SEED \
|
-DCOMMON_RANDOM_FIXED_SEED \
|
||||||
-DSCOTCH_DETERMINISTIC \
|
-DSCOTCH_DETERMINISTIC \
|
||||||
-DSCOTCH_RENAME \
|
-DSCOTCH_RENAME \
|
||||||
|
-DIDXSIZE64 \
|
||||||
-Drestrict=__restrict
|
-Drestrict=__restrict
|
||||||
|
|
||||||
# 32-bit vs. 64-bit labels
|
# Use 32/64-bit integers
|
||||||
|
# ---------------
|
||||||
|
# Unfortunately -DINT32 seems to fail when openmpi is build without
|
||||||
|
# Fortran! The MPI_INT32_T is interpreted as MPI_INTEGER4 which does
|
||||||
|
# not exist
|
||||||
|
# ---------------
|
||||||
|
# ifeq ($(WM_LABEL_SIZE),32)
|
||||||
|
# CFLAGS += -DINTSIZE32
|
||||||
|
# endif
|
||||||
ifeq ($(WM_LABEL_SIZE),64)
|
ifeq ($(WM_LABEL_SIZE),64)
|
||||||
CFLAGS += -DINTSIZE64
|
CFLAGS += -DINTSIZE64
|
||||||
endif
|
endif
|
||||||
@ -50,7 +59,8 @@ LN = ln
|
|||||||
MKDIR = mkdir
|
MKDIR = mkdir
|
||||||
MV = mv
|
MV = mv
|
||||||
RANLIB = echo
|
RANLIB = echo
|
||||||
LEX = flex -Pscotchyy -olex.yy.c
|
|
||||||
YACC = bison -pscotchyy -y -b y
|
LEX = flex "-Pscotchyy$(SCOTCH_NAME_SUFFIX)" -olex.yy.c
|
||||||
|
YACC = bison "-pscotchyy$(SCOTCH_NAME_SUFFIX)" -y -b y
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
363
makeKAHIP
363
makeKAHIP
@ -57,18 +57,23 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
|
|||||||
echo " Check your OpenFOAM environment and installation"
|
echo " Check your OpenFOAM environment and installation"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
. etc/tools/ThirdPartyFunctions
|
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
# Obtain version from OpenFOAM etc/config.sh file:
|
||||||
_foamConfig kahip
|
_foamConfig kahip
|
||||||
|
|
||||||
kahipPACKAGE=${KAHIP_VERSION:-kahip-system}
|
PACKAGE="${KAHIP_VERSION:-system}"
|
||||||
targetType=libso
|
targetType=libso
|
||||||
|
|
||||||
|
# Hint for cmake findMPI
|
||||||
|
if [ -d "$MPI_ARCH_PATH" ]
|
||||||
|
then
|
||||||
|
export MPI_HOME="$MPI_ARCH_PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
usage()
|
printVersions() { listPackageVersions kahip; exit 0; }
|
||||||
{
|
printHelp() {
|
||||||
exec 1>&2
|
|
||||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
|
||||||
/bin/cat<<USAGE
|
/bin/cat<<USAGE
|
||||||
|
|
||||||
Usage: ${0##*/} [OPTION] [lib|libso] [kahip-VERSION]
|
Usage: ${0##*/} [OPTION] [lib|libso] [kahip-VERSION]
|
||||||
@ -76,43 +81,61 @@ options:
|
|||||||
-gcc Force use of gcc/g++
|
-gcc Force use of gcc/g++
|
||||||
-force Force build attempt (mingw)
|
-force Force build attempt (mingw)
|
||||||
-cmake PATH With cmake from the given path
|
-cmake PATH With cmake from the given path
|
||||||
-help
|
-bin Create kahip binaries as well
|
||||||
|
-no-bin Suppress creation of kahip binaries (default)
|
||||||
|
-mpi-home PATH With hint for MPI_HOME
|
||||||
|
-no-mpi Compile without MPI
|
||||||
|
-list List available unpacked source versions
|
||||||
|
-help Display usage help
|
||||||
|
|
||||||
* Build KaHIP (int32_t only)
|
* Build kahip (int32_t only)
|
||||||
$kahipPACKAGE
|
${PACKAGE:-[unspecified]}
|
||||||
|
|
||||||
USAGE
|
USAGE
|
||||||
showDownloadHint KAHIP
|
showDownloadHint kahip
|
||||||
exit 1
|
exit 0 # Clean exit
|
||||||
}
|
}
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
exportCompiler minimal # Minimal compiler info for CMake/configure
|
exportCompiler minimal # Minimal compiler info for CMake/configure
|
||||||
|
|
||||||
unset optForce
|
unset optForce optNoExtlib
|
||||||
|
optBinaries=false
|
||||||
|
optWithMPI=true
|
||||||
|
optLabelSize="${WM_LABEL_SIZE:-32}"
|
||||||
|
|
||||||
# Parse options
|
# Parse options
|
||||||
while [ "$#" -gt 0 ]
|
while [ "$#" -gt 0 ]
|
||||||
do
|
do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
'') ;; # Ignore empty
|
'') ;; # Ignore empty
|
||||||
-h | -help) usage ;;
|
-h | -help*) printHelp;;
|
||||||
|
-list) printVersions;;
|
||||||
-gcc) useGccWmake ;;
|
-gcc) useGccWmake ;;
|
||||||
-force) optForce=true ;;
|
-force) optForce=true ;;
|
||||||
-int32 | -int64) echo "ignoring $1" ;;
|
-int32 | -int64) echo "ignoring $1" ;;
|
||||||
-bin | -no-bin) echo "ignoring $1" ;;
|
-bin) optBinaries=true ;;
|
||||||
|
-no-bin) optBinaries=false ;;
|
||||||
|
-no-mpi) optWithMPI=false ;;
|
||||||
|
-no-extlib) optNoExtlib=true ;; # Hidden option (experimental)
|
||||||
|
|
||||||
-cmake)
|
-cmake)
|
||||||
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
||||||
CMAKE_PATH="${2%%/}"
|
CMAKE_PATH="${2%%/}"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
-mpi-home) # mpi with hint
|
||||||
|
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
|
||||||
|
export MPI_HOME="${2%%/}"
|
||||||
|
case "${MPI_HOME:-none}" in (false|none) unset MPI_HOME;; esac
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
lib|libso)
|
lib|libso)
|
||||||
targetType="$1"
|
targetType="$1"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
kahip-[0-9]* | kahip-git | KaHIP_* | KaHIP-[0-9]*)
|
kahip-[0-9]* | kahip-git | KaHIP_* | KaHIP-[0-9]*)
|
||||||
kahipPACKAGE="${1%%/}"
|
PACKAGE="${1%%/}"
|
||||||
unset KAHIP_ARCH_PATH # Avoid inconsistency
|
unset KAHIP_ARCH_PATH # Avoid inconsistency
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@ -122,16 +145,12 @@ do
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
[ -n "$kahipPACKAGE" ] || die "The kahip-VERSION was not specified"
|
if [ -z "$PACKAGE" ]
|
||||||
|
|
||||||
# Nothing to build
|
|
||||||
if _foamIsNone $kahipPACKAGE
|
|
||||||
then
|
then
|
||||||
echo "Using kahip-none (skip ThirdParty build of KAHIP)"
|
die "The KAHIP package/version not specified"
|
||||||
exit 0
|
elif _foamIsNone "$PACKAGE" || _foamIsSystem "$PACKAGE"
|
||||||
elif _foamIsSystem $kahipPACKAGE
|
|
||||||
then
|
then
|
||||||
echo "Using kahip-system"
|
echo "Using none/system (skip ThirdParty build of KAHIP)"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -148,65 +167,285 @@ case "$WM_COMPILER" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
requireWMakeToolchain
|
if [ "$optNoExtlib" = true ]
|
||||||
requireExtLibBin
|
then
|
||||||
|
unset FOAM_EXT_LIBBIN
|
||||||
|
else
|
||||||
|
requireExtLibBin
|
||||||
|
fi
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Build KaHIP
|
# Build KaHIP
|
||||||
#
|
#
|
||||||
# KAHIP_ARCH_PATH : installation directory
|
# KAHIP_ARCH_PATH : installation directory (as per config file)
|
||||||
# KAHIP_SOURCE_DIR : location of the original sources
|
#
|
||||||
|
# *PACKAGE : name-version of the package
|
||||||
|
# *SOURCE : location of original sources
|
||||||
|
# *PREFIX : installation directory
|
||||||
|
|
||||||
KAHIP_SOURCE_DIR=$sourceBASE/$kahipPACKAGE
|
PKG_SOURCE="$sourceBASE/$PACKAGE"
|
||||||
KAHIP_ARCH_PATH=$installBASE/$kahipPACKAGE
|
PACKAGE="$(basename "$PACKAGE")"
|
||||||
|
# Future: PKG_PREFIX="$installBASE$WM_SIZE_OPTIONS/$PACKAGE"
|
||||||
|
PKG_PREFIX="$installBASE/$PACKAGE"
|
||||||
|
export GIT_DIR="$PKG_SOURCE/.git"
|
||||||
|
|
||||||
[ -d "$KAHIP_SOURCE_DIR" ] || {
|
# Override as per config file (if any)
|
||||||
echo "Missing sources: '$kahipPACKAGE'"
|
[ -n "$KAHIP_ARCH_PATH" ] && PKG_PREFIX="$KAHIP_ARCH_PATH"
|
||||||
showDownloadHint KAHIP
|
|
||||||
|
[ -d "$PKG_SOURCE" ] || {
|
||||||
|
echo "Missing sources: '$PACKAGE'"
|
||||||
|
showDownloadHint kahip
|
||||||
exit 2
|
exit 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# - newer versions use CMake.
|
||||||
|
# - intermediate versions (eg, kahip-2.11) had CMakeLists but didn't install
|
||||||
|
# include/ which means the scons workaround is probably better.
|
||||||
|
# - very old versions only had scons.
|
||||||
|
|
||||||
|
# NB: the flags for 64bit indices in the header seem to be missing.
|
||||||
|
|
||||||
|
unset useWmakeWorkaround
|
||||||
|
if [ -f "$PKG_SOURCE/SConstruct" ]
|
||||||
|
then
|
||||||
|
# Use wmake for old scons builds
|
||||||
|
echo "Using wmake for the build..."
|
||||||
|
useWmakeWorkaround=true
|
||||||
|
requireWMakeToolchain
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Manual installation of serial libraries
|
||||||
|
# from libdir to -> $FOAM_EXT_LIBBIN
|
||||||
|
#
|
||||||
|
install()
|
||||||
|
{
|
||||||
|
local bindir="$PKG_PREFIX"/bin
|
||||||
|
local libdir_source="$1"
|
||||||
|
local libdir_serial="$FOAM_EXT_LIBBIN"
|
||||||
|
local libdir_parallel="$FOAM_EXT_LIBBIN/$FOAM_MPI"
|
||||||
|
local libname_suffix="-int$WM_LABEL_SIZE"
|
||||||
|
|
||||||
|
[ -n "$FOAM_EXT_LIBBIN" ] || unset libdir_serial libdir_parallel
|
||||||
|
[ -n "$WM_LABEL_SIZE" ] || unset libname_suffix
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Adjusting installation"
|
||||||
|
|
||||||
|
if [ "$optBinaries" = false ]
|
||||||
|
then
|
||||||
|
echo "Removing binaries: $bindir"
|
||||||
|
rm -rf "$bindir" 2>/dev/null # Failed removal is uncritical
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$libdir_source" ]
|
||||||
|
then
|
||||||
|
libdir_source="$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH"
|
||||||
|
if [ ! -d "$libdir_source" ]
|
||||||
|
then
|
||||||
|
libdir_source="$PKG_PREFIX/lib"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Before kahip-v3.12 built 'libinterface'. Rename this to 'libkahip'
|
||||||
|
(
|
||||||
|
cd "$libdir_source" || exit
|
||||||
|
libname="libkahip"
|
||||||
|
|
||||||
|
for name in libinterface
|
||||||
|
do
|
||||||
|
if [ -f "$name$EXT_SO" ]
|
||||||
|
then
|
||||||
|
rm -f "$libname$EXT_SO" "$libname$libname_suffix$EXT_SO"
|
||||||
|
mv "$name$EXT_SO" "$libname$EXT_SO"
|
||||||
|
echo "Renamed $name -> $libname"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
)
|
||||||
|
|
||||||
|
# Rename lib as xxx-intNN qualified library names (non-windows)
|
||||||
|
if [ -n "$libname_suffix" ] && [ "${EXT_SO:-.dll}" != ".dll" ]
|
||||||
|
then
|
||||||
|
(
|
||||||
|
cd "$libdir_source" || exit
|
||||||
|
echo "Tagging libraries with $libname_suffix"
|
||||||
|
for name in libkahip libparhip_interface
|
||||||
|
do
|
||||||
|
if [ -f "$name$EXT_SO" ]
|
||||||
|
then
|
||||||
|
mv "$name$EXT_SO" "$name$libname_suffix$EXT_SO"
|
||||||
|
ln -sf "$name$libname_suffix$EXT_SO" "$name$EXT_SO"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
local libdir_target
|
||||||
|
|
||||||
|
# Serial
|
||||||
|
libdir_target="$libdir_serial"
|
||||||
|
if [ -n "$libdir_target" ]
|
||||||
|
then
|
||||||
|
# Remove old libraries/links
|
||||||
|
for name in libkahip libkahip_interface libparhip_interface
|
||||||
|
do
|
||||||
|
rm -f "$libdir_target/$name$EXT_SO"
|
||||||
|
rm -f "$libdir_target/$name$libname_suffix$EXT_SO"
|
||||||
|
done
|
||||||
|
mkdir -p "$libdir_target"
|
||||||
|
echo "Relocating serial libraries"
|
||||||
|
|
||||||
|
# echo "Installing: $libdir_target/libkahip$libname_suffix"
|
||||||
|
mv -f "$libdir_source"/libkahip*"$EXT_SO" "$libdir_target" 2>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Parallel
|
||||||
|
libdir_target="$libdir_parallel"
|
||||||
|
if [ -n "$libdir_target" ]
|
||||||
|
then
|
||||||
|
# Remove old libraries/links
|
||||||
|
for name in libkahip libkahip_interface libparhip_interface
|
||||||
|
do
|
||||||
|
rm -f "$libdir_target/$name$EXT_SO"
|
||||||
|
rm -f "$libdir_target/$name$libname_suffix$EXT_SO"
|
||||||
|
done
|
||||||
|
mkdir -p "$libdir_target"
|
||||||
|
echo "Relocating parallel libraries"
|
||||||
|
|
||||||
|
# echo "Installing: $libdir_target/libparhip$libname_suffix"
|
||||||
|
mv -f "$libdir_source"/libparhip*"$EXT_SO" "$libdir_target" 2>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
rmdir "$libdir_source" 2>/dev/null # Failed rmdir is uncritical
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Manual installation
|
# Manual installation
|
||||||
#
|
#
|
||||||
install()
|
install_wmake()
|
||||||
{
|
{
|
||||||
# Ensure a clean build next time
|
local bindir="$PKG_PREFIX"/bin
|
||||||
|
local incdir="$PKG_PREFIX"/include
|
||||||
|
local libdir_source="$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH"
|
||||||
|
local libdir_target="$FOAM_EXT_LIBBIN"
|
||||||
|
local libname_suffix="-int$WM_LABEL_SIZE"
|
||||||
|
|
||||||
|
[ -n "$WM_LABEL_SIZE" ] || unset libname_suffix
|
||||||
|
|
||||||
|
# Leave static libraries in sub-directory
|
||||||
|
if [ "$targetType" = lib ] || [ -z "$FOAM_EXT_LIBBIN" ]
|
||||||
|
then
|
||||||
|
unset libdir_target
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Remove build artifacts from the source directory
|
||||||
|
# (for a clean build next time)
|
||||||
wclean
|
wclean
|
||||||
|
|
||||||
local bindir=$KAHIP_ARCH_PATH/bin
|
echo
|
||||||
local incdir=$KAHIP_ARCH_PATH/include
|
echo "Adjusting installation"
|
||||||
local libdir=$KAHIP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
|
echo "Installing headers: $incdir"
|
||||||
|
|
||||||
mkdir -m 0755 -p $incdir
|
|
||||||
|
|
||||||
|
mkdir -m 0755 -p "$incdir"
|
||||||
/bin/cp -pv \
|
/bin/cp -pv \
|
||||||
$KAHIP_SOURCE_DIR/interface/kaHIP_interface.h \
|
"$PKG_SOURCE"/interface/kaHIP_interface.h \
|
||||||
$incdir
|
"$incdir"
|
||||||
|
|
||||||
|
# Rename lib as xxx-intNN qualified library names (non-windows)
|
||||||
|
if [ -n "$libname_suffix" ] && [ "${EXT_SO:-.dll}" != ".dll" ]
|
||||||
|
then
|
||||||
|
(
|
||||||
|
cd "$libdir_source" || exit
|
||||||
|
echo "Tagging libraries with $libname_suffix"
|
||||||
|
for name in libkahip libparhip_interface
|
||||||
|
do
|
||||||
|
if [ -f "$name$EXT_SO" ]
|
||||||
|
then
|
||||||
|
mv "$name$EXT_SO" "$name$libname_suffix$EXT_SO"
|
||||||
|
ln -sf "$name$libname_suffix$EXT_SO" "$name$EXT_SO"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$libdir_target" ]
|
||||||
|
then
|
||||||
|
# Remove old libraries/links
|
||||||
|
for name in libkahip libkahip_interface libparhip_interface
|
||||||
|
do
|
||||||
|
rm -f "$libdir_target/$name$EXT_SO"
|
||||||
|
rm -f "$libdir_target/$name$libname_suffix$EXT_SO"
|
||||||
|
done
|
||||||
|
mkdir -p "$libdir_target"
|
||||||
|
echo "Relocating serial libraries"
|
||||||
|
|
||||||
|
# echo "Installing: $libdir_target/libkahip$libname_suffix"
|
||||||
|
mv -f "$libdir_source"/libkahip*"$EXT_SO" "$libdir_target" 2>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
rmdir "$libdir_source" 2>/dev/null # Failed rmdir is uncritical
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Newer KAHIP (>= 2.11) uses CMake,
|
if [ "${useWmakeWorkaround:-false}" = false ]
|
||||||
# but unfortunately does not install include/
|
|
||||||
# nor pass through flags for 64bit indices in the header.
|
|
||||||
withCmake=true
|
|
||||||
version=$(echo "$kahipPACKAGE" | sed -e 's/^kahip[-_]*//i')
|
|
||||||
case "$version" in 2.0*) unset withCmake;; esac
|
|
||||||
|
|
||||||
if true
|
|
||||||
then
|
then
|
||||||
(
|
(
|
||||||
echo "Starting build: $kahipPACKAGE ($targetType) using wmake"
|
echo "Starting build: $PACKAGE using cmake"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
cd "$KAHIP_SOURCE_DIR/lib" || exit
|
PKG_BUILD="$buildBASE/$PACKAGE"
|
||||||
export GIT_DIR="$KAHIP_SOURCE_DIR/.git" # Mask seeing our own git-repo
|
cd "$PKG_SOURCE" || exit
|
||||||
|
|
||||||
rm -rf "$KAHIP_ARCH_PATH"
|
# Remove any existing build folder and recreate
|
||||||
rm -f "$FOAM_EXT_LIBBIN/libkahip$EXT_SO"
|
rm -rf "$PKG_PREFIX"
|
||||||
|
rm -rf "$PKG_BUILD"
|
||||||
|
mkdir -p "$PKG_BUILD"
|
||||||
|
|
||||||
libdir=$KAHIP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
|
unset buildOpt
|
||||||
|
if [ "$optWithMPI" = false ]
|
||||||
|
then
|
||||||
|
buildOpt="${buildOpt} -DPARHIP=OFF"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cmake=$(findCMake)
|
||||||
|
|
||||||
|
cd "$PKG_BUILD" && $cmake \
|
||||||
|
-B "$PKG_BUILD" \
|
||||||
|
-S "$PKG_SOURCE" \
|
||||||
|
-DCMAKE_INSTALL_PREFIX="$PKG_PREFIX" \
|
||||||
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
|
$buildOpt \
|
||||||
|
${WM_QUIET:+-DCMAKE_RULE_MESSAGES=OFF} \
|
||||||
|
&& make -j $WM_NCOMPPROCS \
|
||||||
|
&& make install \
|
||||||
|
&& install \
|
||||||
|
&& echo "Built: $PACKAGE"
|
||||||
|
) || {
|
||||||
|
echo "Error building: $PACKAGE"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
elif true
|
||||||
|
then
|
||||||
|
(
|
||||||
|
echo "Starting build: $PACKAGE ($targetType) using wmake"
|
||||||
|
echo
|
||||||
|
|
||||||
|
cd "$PKG_SOURCE/lib" || exit
|
||||||
|
|
||||||
|
rm -rf "$PKG_PREFIX"
|
||||||
|
rm -f "$FOAM_EXT_LIBBIN/libkahip"*
|
||||||
|
|
||||||
|
export KAHIP_LIB_DIR="$PKG_PREFIX/lib$WM_COMPILER_LIB_ARCH"
|
||||||
|
mkdir -m 0755 -p "$KAHIP_LIB_DIR" 2>/dev/null
|
||||||
|
|
||||||
cpMakeFiles kahip 2>/dev/null
|
cpMakeFiles kahip 2>/dev/null
|
||||||
|
|
||||||
@ -215,19 +454,9 @@ then
|
|||||||
ln -s ../interface interface
|
ln -s ../interface interface
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Place static libraries in sub-directory:
|
|
||||||
if [ "$targetType" = lib ]
|
|
||||||
then
|
|
||||||
mkdir -m 0755 -p $libdir 2>/dev/null
|
|
||||||
export FOAM_EXT_LIBBIN=$libdir
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Location of lib sources for wmake
|
|
||||||
export KAHIP_LIB_SRC=$PWD
|
|
||||||
|
|
||||||
wmake -j $WM_NCOMPPROCS -s $targetType \
|
wmake -j $WM_NCOMPPROCS -s $targetType \
|
||||||
&& echo "Built: kahip" \
|
&& echo "Built: $PACKAGE" \
|
||||||
&& install
|
&& install_wmake
|
||||||
) || {
|
) || {
|
||||||
echo "Error building: kahip"
|
echo "Error building: kahip"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
145
makeMETIS
145
makeMETIS
@ -57,60 +57,65 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
|
|||||||
echo " Check your OpenFOAM environment and installation"
|
echo " Check your OpenFOAM environment and installation"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
. etc/tools/ThirdPartyFunctions
|
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
# Obtain version from OpenFOAM etc/config.sh file:
|
||||||
_foamConfig metis
|
_foamConfig metis
|
||||||
|
|
||||||
metisPACKAGE=${METIS_VERSION:-metis-system}
|
PACKAGE="${METIS_VERSION:-system}"
|
||||||
targetType=libso
|
targetType=libso
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
usage() {
|
printVersions() { listPackageVersions metis; exit 0; }
|
||||||
|
printHelp() {
|
||||||
exec 1>&2
|
exec 1>&2
|
||||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||||
cat<<USAGE
|
cat<<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
|
-int32 Use IDXTYPEWIDTH 32
|
||||||
-int64 Use IDXTYPEWIDTH 64
|
-int64 Use IDXTYPEWIDTH 64
|
||||||
-bin Create metis binaries as well (default)
|
-bin Create metis binaries as well
|
||||||
-no-bin Suppress creation of metis binaries
|
-no-bin Suppress creation of metis binaries (default)
|
||||||
-help
|
-list List available unpacked source versions
|
||||||
|
-help Display usage help
|
||||||
|
|
||||||
* Build METIS (default: -int${WM_LABEL_SIZE:-32}) with
|
* Build METIS (default: -int${WM_LABEL_SIZE:-32}) with
|
||||||
${metisPACKAGE:-'unspecified metis version'}
|
${PACKAGE:-[unspecified]}
|
||||||
|
|
||||||
USAGE
|
USAGE
|
||||||
showDownloadHint METIS
|
showDownloadHint metis
|
||||||
exit 1
|
exit 0 # Clean exit
|
||||||
}
|
}
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
exportCompiler # Compiler info for CMake/configure
|
exportCompiler # Compiler info for CMake/configure
|
||||||
|
|
||||||
unset optForce
|
unset optForce optNoExtlib
|
||||||
optBinaries=true
|
optBinaries=false
|
||||||
optIntSize="${WM_LABEL_SIZE:-32}"
|
optLabelSize="${WM_LABEL_SIZE:-32}"
|
||||||
|
|
||||||
# Parse options
|
# Parse options
|
||||||
while [ "$#" -gt 0 ]
|
while [ "$#" -gt 0 ]
|
||||||
do
|
do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
'') ;; # Ignore empty
|
'') ;; # Ignore empty
|
||||||
-h | -help) usage ;;
|
-h | -help*) printHelp;;
|
||||||
|
-list) printVersions;;
|
||||||
-gcc) useGcc ;;
|
-gcc) useGcc ;;
|
||||||
-force) echo "ignoring $1" ;;
|
-force) echo "ignoring $1" ;;
|
||||||
-int32 | -int64) optIntSize="${1#-int}" ;;
|
-int32 | -int64) optLabelSize="${1#-int}" ;;
|
||||||
-bin) optBinaries=true ;;
|
-bin) optBinaries=true ;;
|
||||||
-no-bin) optBinaries=false ;;
|
-no-bin) optBinaries=false ;;
|
||||||
|
-no-extlib) optNoExtlib=true ;; # Hidden option (experimental)
|
||||||
|
|
||||||
lib|libso)
|
lib|libso)
|
||||||
targetType="$1"
|
targetType="$1"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
metis-[0-9]*)
|
metis-[0-9]*)
|
||||||
metisPACKAGE="${1%%/}"
|
PACKAGE="${1%%/}"
|
||||||
unset METIS_ARCH_PATH # Avoid inconsistency
|
unset METIS_ARCH_PATH # Avoid inconsistency
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@ -120,16 +125,12 @@ do
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
[ -n "$metisPACKAGE" ] || die "The metis-VERSION was not specified"
|
if [ -z "$PACKAGE" ]
|
||||||
|
|
||||||
# Nothing to build
|
|
||||||
if _foamIsNone $metisPACKAGE
|
|
||||||
then
|
then
|
||||||
echo "Using metis-none (skip ThirdParty build of METIS)"
|
die "The METIS package/version not specified"
|
||||||
exit 0
|
elif _foamIsNone "$PACKAGE" || _foamIsSystem "$PACKAGE"
|
||||||
elif _foamIsSystem $metisPACKAGE
|
|
||||||
then
|
then
|
||||||
echo "Using metis-system"
|
echo "Using none/system (skip ThirdParty build of METIS)"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -144,21 +145,33 @@ case "$WM_COMPILER" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
requireExtLibBin
|
if [ "$optNoExtlib" = true ]
|
||||||
|
then
|
||||||
|
unset FOAM_EXT_LIBBIN
|
||||||
|
else
|
||||||
|
requireExtLibBin
|
||||||
|
fi
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Build METIS
|
# Build METIS
|
||||||
|
# METIS_ARCH_PATH : installation directory (as per config file)
|
||||||
#
|
#
|
||||||
# METIS_ARCH_PATH : installation directory
|
# *PACKAGE : name-version of the package
|
||||||
# METIS_SOURCE_DIR : location of the original sources
|
# *SOURCE : location of original sources
|
||||||
|
# *PREFIX : installation directory
|
||||||
|
|
||||||
METIS_SOURCE_DIR=$sourceBASE/$metisPACKAGE
|
PKG_SOURCE="$sourceBASE/$PACKAGE"
|
||||||
: "${METIS_ARCH_PATH:=$installBASE$WM_SIZE_OPTIONS/$metisPACKAGE}"
|
PACKAGE="$(basename "$PACKAGE")"
|
||||||
|
PKG_PREFIX="$installBASE$WM_SIZE_OPTIONS/$PACKAGE"
|
||||||
|
export GIT_DIR="$PKG_SOURCE/.git"
|
||||||
|
|
||||||
[ -d "$METIS_SOURCE_DIR" ] || {
|
# Override as per config file (if any)
|
||||||
echo "Missing sources: '$metisPACKAGE'"
|
[ -n "$METIS_ARCH_PATH" ] && PKG_PREFIX="$METIS_ARCH_PATH"
|
||||||
showDownloadHint METIS
|
|
||||||
|
[ -d "$PKG_SOURCE" ] || {
|
||||||
|
echo "Missing sources: '$PACKAGE'"
|
||||||
|
showDownloadHint metis
|
||||||
exit 2
|
exit 2
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,30 +180,70 @@ METIS_SOURCE_DIR=$sourceBASE/$metisPACKAGE
|
|||||||
#
|
#
|
||||||
install()
|
install()
|
||||||
{
|
{
|
||||||
local bindir="$METIS_ARCH_PATH"/bin
|
local bindir="$PKG_PREFIX"/bin
|
||||||
local libdir="$METIS_ARCH_PATH"/lib
|
local libdir="$PKG_PREFIX"/lib
|
||||||
|
local libdir_target="$FOAM_EXT_LIBBIN"
|
||||||
|
local libname_suffix="-int$WM_LABEL_SIZE"
|
||||||
|
|
||||||
|
[ -n "$FOAM_EXT_LIBBIN" ] || unset libdir_target
|
||||||
|
[ -n "$WM_LABEL_SIZE" ] || unset libname_suffix
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Adjusting installation"
|
||||||
|
|
||||||
if [ "$optBinaries" = false ]
|
if [ "$optBinaries" = false ]
|
||||||
then
|
then
|
||||||
echo "Removing binaries: $bindir"
|
echo "Removing binaries: $bindir"
|
||||||
rm -rf "$bindir" 2>/dev/null # Failed removal is uncritical
|
rm -rf "$bindir" 2>/dev/null # Failed removal is uncritical
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$targetType" = libso ]
|
if [ "$targetType" = libso ]
|
||||||
then
|
then
|
||||||
mv "$libdir/libmetis$EXT_SO" "$FOAM_EXT_LIBBIN"
|
# Rename lib as xxx-intNN qualified library names (non-windows)
|
||||||
rmdir "$libdir" 2>/dev/null # Failed rmdir is uncritical
|
if [ -n "$libname_suffix" ] && [ "${EXT_SO:-.dll}" != ".dll" ]
|
||||||
|
then
|
||||||
echo "Installing: $FOAM_EXT_LIBBIN/libmetis$EXT_SO"
|
(
|
||||||
|
cd "$libdir" || exit
|
||||||
|
echo "Tagging libraries with $libname_suffix"
|
||||||
|
for name in libmetis
|
||||||
|
do
|
||||||
|
if [ -f "$name$EXT_SO" ]
|
||||||
|
then
|
||||||
|
mv "$name$EXT_SO" "$name$libname_suffix$EXT_SO"
|
||||||
|
ln -sf "$name$libname_suffix$EXT_SO" "$name$EXT_SO"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -n "$libdir_target" ]
|
||||||
|
then
|
||||||
|
# Remove old libraries and links
|
||||||
|
for name in libmetis
|
||||||
|
do
|
||||||
|
rm -f "$libdir_target/$name$EXT_SO"
|
||||||
|
rm -f "$libdir_target/$name$libname_suffix$EXT_SO"
|
||||||
|
done
|
||||||
|
mkdir -p "$libdir_target"
|
||||||
|
echo "Relocating serial libraries"
|
||||||
|
|
||||||
|
# echo "Installing: $libdir_target/libmetis"
|
||||||
|
mv -f "$libdir"/libmetis* "$libdir_target"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
rmdir "$libdir" 2>/dev/null # Failed rmdir is uncritical
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "Starting build: $metisPACKAGE ($targetType)"
|
|
||||||
if [ "$optIntSize" != "$WM_LABEL_SIZE" ]
|
echo "Starting build: $PACKAGE ($targetType)"
|
||||||
|
if [ "$optLabelSize" != "$WM_LABEL_SIZE" ]
|
||||||
then
|
then
|
||||||
echo "Using int-$optIntSize instead of int-$WM_LABEL_SIZE"
|
echo "Using int-$optLabelSize instead of int-$WM_LABEL_SIZE"
|
||||||
fi
|
fi
|
||||||
|
export WM_LABEL_SIZE="$optLabelSize"
|
||||||
|
|
||||||
echo
|
echo
|
||||||
(
|
(
|
||||||
# Configuration options:
|
# Configuration options:
|
||||||
@ -200,20 +253,18 @@ echo
|
|||||||
configOpt="shared=1"
|
configOpt="shared=1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "$METIS_SOURCE_DIR" || exit
|
cd "$PKG_SOURCE" || exit
|
||||||
export GIT_DIR="$PWD/.git" # Mask seeing our own git-repo
|
rm -rf "$PKG_PREFIX"
|
||||||
|
|
||||||
rm -rf "$METIS_ARCH_PATH"
|
|
||||||
rm -f "$FOAM_EXT_LIBBIN"/libmetis*
|
rm -f "$FOAM_EXT_LIBBIN"/libmetis*
|
||||||
|
|
||||||
# Adjust metis IDXTYPEWIDTH (integer size)
|
# Adjust metis IDXTYPEWIDTH (integer size)
|
||||||
sed -i -e 's=\(#define IDXTYPEWIDTH\).*=\1 '"$optIntSize"'=' \
|
sed -i -e 's=\(#define IDXTYPEWIDTH\).*=\1 '"$optLabelSize"'=' \
|
||||||
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="$PKG_PREFIX" \
|
||||||
&& make -j $WM_NCOMPPROCS install \
|
&& make -j $WM_NCOMPPROCS install \
|
||||||
&& echo "Built: metis" \
|
&& echo "Built: metis" \
|
||||||
&& install
|
&& install
|
||||||
|
|||||||
470
makeSCOTCH
470
makeSCOTCH
@ -27,20 +27,18 @@ wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
|
|||||||
echo " Check your OpenFOAM environment and installation"
|
echo " Check your OpenFOAM environment and installation"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
. etc/tools/ThirdPartyFunctions
|
. "${WM_THIRD_PARTY_DIR:?}"/etc/tools/ThirdPartyFunctions
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
_foamConfig scotch # Get SCOTCH_ARCH_PATH, SCOTCH_VERSION
|
_foamConfig scotch # Get SCOTCH_ARCH_PATH, SCOTCH_VERSION
|
||||||
|
|
||||||
scotchPACKAGE=${SCOTCH_VERSION:-scotch-system}
|
PACKAGE="${SCOTCH_VERSION:-system}"
|
||||||
|
|
||||||
unset withMPI
|
unset withMPI
|
||||||
case "$WM_MPLIB" in (*MPI*) [ "$FOAM_MPI" = dummy ] || withMPI=true ;; esac
|
case "$WM_MPLIB" in (*MPI*) [ "$FOAM_MPI" = dummy ] || withMPI=true ;; esac
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
usage()
|
printVersions() { listPackageVersions scotch; exit 0; }
|
||||||
{
|
printHelp() {
|
||||||
exec 1>&2
|
|
||||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
|
||||||
/bin/cat<<USAGE
|
/bin/cat<<USAGE
|
||||||
|
|
||||||
Usage: ${0##*/} [OPTION] [libso] [scotch-VERSION]
|
Usage: ${0##*/} [OPTION] [libso] [scotch-VERSION]
|
||||||
@ -53,36 +51,39 @@ options:
|
|||||||
-bin Create scotch binaries as well
|
-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
|
-list List available unpacked source versions
|
||||||
|
-help Display usage help
|
||||||
|
|
||||||
* Build SCOTCH (default: -int${WM_LABEL_SIZE:-32}) with
|
* Build SCOTCH (default: -int${WM_LABEL_SIZE:-32}) with
|
||||||
$scotchPACKAGE
|
${PACKAGE:-[unspecified]}
|
||||||
|
|
||||||
USAGE
|
USAGE
|
||||||
showDownloadHint SCOTCH
|
showDownloadHint scotch
|
||||||
exit 1
|
exit 0 # Clean exit
|
||||||
}
|
}
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
unset optForce
|
unset optForce optNoExtlib
|
||||||
optBinaries=false
|
optBinaries=false
|
||||||
optIntSize="${WM_LABEL_SIZE:-32}"
|
optLabelSize="${WM_LABEL_SIZE:-32}"
|
||||||
|
|
||||||
# Parse options
|
# Parse options
|
||||||
while [ "$#" -gt 0 ]
|
while [ "$#" -gt 0 ]
|
||||||
do
|
do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
'') ;; # Ignore empty
|
'') ;; # Ignore empty
|
||||||
-h | -help) usage ;;
|
-h | -help*) printHelp;;
|
||||||
|
-list) printVersions;;
|
||||||
-gcc) useGcc ;;
|
-gcc) useGcc ;;
|
||||||
-force) optForce=true ;;
|
-force) optForce=true ;;
|
||||||
-int32 | -int64) optIntSize="${1#-int}" ;;
|
-int32 | -int64) optLabelSize="${1#-int}" ;;
|
||||||
-bin) optBinaries=true ;;
|
-bin) optBinaries=true ;;
|
||||||
-no-bin) optBinaries=false ;;
|
-no-bin) optBinaries=false ;;
|
||||||
-no-mpi) unset withMPI ;;
|
-no-mpi) unset withMPI ;;
|
||||||
|
-no-extlib) optNoExtlib=true ;; # Hidden option
|
||||||
|
|
||||||
scotch-[0-9]* | scotch-git | scotch_* )
|
scotch-[0-9]* | scotch-git | scotch_* )
|
||||||
scotchPACKAGE="${1%%/}"
|
PACKAGE="${1%%/}"
|
||||||
unset SCOTCH_ARCH_PATH # Avoid inconsistency
|
unset SCOTCH_ARCH_PATH # Avoid inconsistency
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@ -92,78 +93,279 @@ do
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
[ -n "$scotchPACKAGE" ] || die "The scotch-VERSION was not specified"
|
if [ -z "$PACKAGE" ]
|
||||||
|
|
||||||
# Nothing to build
|
|
||||||
if _foamIsNone "$scotchPACKAGE"
|
|
||||||
then
|
then
|
||||||
echo "Using scotch-none (skip ThirdParty build of SCOTCH)"
|
die "The SCOTCH package/version not specified"
|
||||||
exit 0
|
elif _foamIsNone "$PACKAGE" || _foamIsSystem "$PACKAGE"
|
||||||
elif _foamIsSystem "$scotchPACKAGE"
|
|
||||||
then
|
then
|
||||||
echo "Using scotch-system"
|
echo "Using none/system (skip ThirdParty build of SCOTCH)"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
requireExtLibBin
|
if [ "$optNoExtlib" = true ]
|
||||||
|
then
|
||||||
#------------------------------------------------------------------------------
|
unset FOAM_EXT_LIBBIN
|
||||||
|
else
|
||||||
# Needs generalizing, but works fairly well
|
requireExtLibBin
|
||||||
for scotchMakefile in \
|
fi
|
||||||
"OpenFOAM-$(uname -s)-${WM_COMPILER}.shlib" \
|
|
||||||
"OpenFOAM-$(uname -s).shlib" \
|
|
||||||
OpenFOAM-Linux.shlib \
|
|
||||||
;
|
|
||||||
do
|
|
||||||
scotchMakefile="etc/makeFiles/scotch/Makefile.inc.$scotchMakefile"
|
|
||||||
[ -f "$scotchMakefile" ] && break
|
|
||||||
done
|
|
||||||
|
|
||||||
# The relative link location within the "scotch/src/" directory
|
|
||||||
makefileInc="../../$scotchMakefile"
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Build SCOTCH
|
# Build SCOTCH
|
||||||
|
# SCOTCH_ARCH_PATH : installation directory (as per config file)
|
||||||
#
|
#
|
||||||
# SCOTCH_ARCH_PATH : installation directory
|
# *PACKAGE : name-version of the package
|
||||||
# SCOTCH_SOURCE_DIR : location of the original sources
|
# *SOURCE : location of original sources
|
||||||
|
# *PREFIX : installation directory
|
||||||
|
|
||||||
SCOTCH_SOURCE_DIR="$sourceBASE/$scotchPACKAGE"
|
PKG_SOURCE="$sourceBASE/$PACKAGE"
|
||||||
: "${SCOTCH_ARCH_PATH:=$installBASE$WM_SIZE_OPTIONS/$scotchPACKAGE}"
|
PACKAGE="$(basename "$PACKAGE")"
|
||||||
|
PKG_PREFIX="$installBASE$WM_SIZE_OPTIONS/$PACKAGE"
|
||||||
|
export GIT_DIR="$PKG_SOURCE/.git"
|
||||||
|
|
||||||
[ -d "$SCOTCH_SOURCE_DIR/src" ] || {
|
# Override as per config file (if any)
|
||||||
echo "Missing sources: '$scotchPACKAGE'"
|
[ -n "$SCOTCH_ARCH_PATH" ] && PKG_PREFIX="$SCOTCH_ARCH_PATH"
|
||||||
showDownloadHint SCOTCH
|
|
||||||
|
[ -d "$PKG_SOURCE/src" ] || {
|
||||||
|
echo "Missing sources: '$PACKAGE'"
|
||||||
|
showDownloadHint scotch
|
||||||
exit 2
|
exit 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Select a Makefile.inc for the scotch build
|
||||||
|
# - could use more generalizing, but works fairly well
|
||||||
|
|
||||||
|
unset MakefileInc
|
||||||
|
for ending in \
|
||||||
|
"$(uname -s)-${WM_COMPILER}".shlib \
|
||||||
|
"$(uname -s)".shlib \
|
||||||
|
Linux.shlib \
|
||||||
|
;
|
||||||
|
do
|
||||||
|
# Fully resolve path
|
||||||
|
file="$WM_THIRD_PARTY_DIR/etc/makeFiles/scotch/Makefile.inc.$ending"
|
||||||
|
if [ -f "$file" ]
|
||||||
|
then
|
||||||
|
MakefileInc="$file"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
# - copy OpenFOAM-specific Makefile include files into the scotch dir.
|
||||||
|
# - place a full copy into an 'openfoam/' directory (for documentation)
|
||||||
|
# - make symlink from the openfoam/Makefile.inc.XXX -> src/Makefile.inc
|
||||||
|
|
||||||
|
createMakefileLinks()
|
||||||
|
{
|
||||||
|
# Sanity checks
|
||||||
|
if [ -z "$MakefileInc" ]
|
||||||
|
then
|
||||||
|
echo "Did not define a Makefile.inc for"
|
||||||
|
echo " $PACKAGE/src"
|
||||||
|
return 1
|
||||||
|
elif [ ! -f "$MakefileInc" ]
|
||||||
|
then
|
||||||
|
echo "No such file to include:"
|
||||||
|
echo " $MakefileInc"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "$PKG_SOURCE"/src ] || [ ! -w "$PKG_SOURCE"/src ]
|
||||||
|
then
|
||||||
|
echo "Directory missing or not writable:"
|
||||||
|
echo " $PKG_SOURCE/src"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Copy files and make links
|
||||||
|
mkdir -p "$PKG_SOURCE"/openfoam
|
||||||
|
cp -p "$(dirname "$MakefileInc")"/* "$PKG_SOURCE"/openfoam
|
||||||
|
rm -f "$PKG_SOURCE"/src/Makefile.inc
|
||||||
|
(
|
||||||
|
cd "$PKG_SOURCE/src" && \
|
||||||
|
ln -sf ../openfoam/"$(basename "$MakefileInc")" Makefile.inc
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#
|
||||||
|
# Manual installation of serial libraries
|
||||||
|
# from libdir to -> $FOAM_EXT_LIBBIN
|
||||||
|
#
|
||||||
|
install_serial()
|
||||||
|
{
|
||||||
|
local libdir_source="$1"
|
||||||
|
local libdir_target="$FOAM_EXT_LIBBIN"
|
||||||
|
local libname_suffix="-int$WM_LABEL_SIZE"
|
||||||
|
|
||||||
|
[ -n "$FOAM_EXT_LIBBIN" ] || unset libdir_target
|
||||||
|
[ -n "$WM_LABEL_SIZE" ] || unset libname_suffix
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Adjusting installation"
|
||||||
|
|
||||||
|
# Rename lib as xxx-intNN qualified library names (non-windows)
|
||||||
|
if [ -n "$libname_suffix" ] && [ "${EXT_SO:-.dll}" != ".dll" ]
|
||||||
|
then
|
||||||
|
(
|
||||||
|
cd "$libdir_source" || exit
|
||||||
|
echo "Tagging libraries with $libname_suffix"
|
||||||
|
for name in libscotch
|
||||||
|
do
|
||||||
|
if [ -f "$name$EXT_SO" ]
|
||||||
|
then
|
||||||
|
mv "$name$EXT_SO" "$name$libname_suffix$EXT_SO"
|
||||||
|
ln -sf "$name$libname_suffix$EXT_SO" "$name$EXT_SO"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$libdir_target" ]
|
||||||
|
then
|
||||||
|
# Remove old libraries and links
|
||||||
|
for name in libscotch
|
||||||
|
do
|
||||||
|
rm -f "$libdir_target/$name$EXT_SO"
|
||||||
|
rm -f "$libdir_target/$name$libname_suffix$EXT_SO"
|
||||||
|
done
|
||||||
|
mkdir -p "$libdir_target"
|
||||||
|
echo "Relocating serial libraries"
|
||||||
|
|
||||||
|
# echo "Installing: $libdir_target/libscotch$libname_suffix"
|
||||||
|
mv -f "$libdir_source"/lib* "$libdir_target"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rmdir "$libdir_source" 2>/dev/null # Failed rmdir is uncritical
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Manual installation of parallel libraries
|
||||||
|
# from libdir to -> $FOAM_EXT_LIBBIN/$FOAM_MPI
|
||||||
|
#
|
||||||
|
install_parallel()
|
||||||
|
{
|
||||||
|
local libdir_source="$1"
|
||||||
|
local libdir_target="$FOAM_EXT_LIBBIN/$FOAM_MPI"
|
||||||
|
local libname_suffix="-int$WM_LABEL_SIZE"
|
||||||
|
local link_serial=false
|
||||||
|
|
||||||
|
[ -n "$FOAM_EXT_LIBBIN" ] || unset libdir_target
|
||||||
|
[ -n "$WM_LABEL_SIZE" ] || unset libname_suffix
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Adjusting installation"
|
||||||
|
|
||||||
|
# Rename lib as xxx-intNN qualified library names (non-windows)
|
||||||
|
if [ -n "$libname_suffix" ] && [ "${EXT_SO:-.dll}" != ".dll" ]
|
||||||
|
then
|
||||||
|
(
|
||||||
|
cd "$libdir_source" || exit
|
||||||
|
echo "Tagging libraries with $libname_suffix"
|
||||||
|
|
||||||
|
# When linked, remove generated serial libraries
|
||||||
|
if [ "$link_serial" = true ]
|
||||||
|
then
|
||||||
|
rm -f libscotch*
|
||||||
|
fi
|
||||||
|
|
||||||
|
for name in libscotch libptscotch
|
||||||
|
do
|
||||||
|
if [ -f "$name$EXT_SO" ]
|
||||||
|
then
|
||||||
|
mv "$name$EXT_SO" "$name$libname_suffix$EXT_SO"
|
||||||
|
ln -sf "$name$libname_suffix$EXT_SO" "$name$EXT_SO"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$libdir_target" ]
|
||||||
|
then
|
||||||
|
# Remove old libraries and links
|
||||||
|
for name in libscotch libptscotch
|
||||||
|
do
|
||||||
|
rm -f "$libdir_target/$name$EXT_SO"
|
||||||
|
rm -f "$libdir_target/$name$libname_suffix$EXT_SO"
|
||||||
|
done
|
||||||
|
mkdir -p "$libdir_target"
|
||||||
|
echo "Relocating parallel libraries"
|
||||||
|
|
||||||
|
# echo "Installing: $libdir_target/libptscotch$libname_suffix"
|
||||||
|
mv -f "$libdir_source"/lib* "$libdir_target"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Create symlinks to serial versions?
|
||||||
|
if [ -n "$link_serial" ] && [ "${EXT_SO:-.dll}" != ".dll" ]
|
||||||
|
then
|
||||||
|
(
|
||||||
|
if [ -n "$libdir_target" ]
|
||||||
|
then
|
||||||
|
cd "$libdir_target" || exit
|
||||||
|
else
|
||||||
|
cd "$libdir_source" || exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
for name in libscotch"$libname_suffix" libscotcherr*
|
||||||
|
do
|
||||||
|
if [ -f ../"$name$EXT_SO" ]
|
||||||
|
then
|
||||||
|
ln -sf ../"$name$EXT_SO" "$name$EXT_SO"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
for name in libscotch
|
||||||
|
do
|
||||||
|
if [ -f "$name$libname_suffix$EXT_SO" ]
|
||||||
|
then
|
||||||
|
ln -sf "$name$libname_suffix$EXT_SO" "$name$EXT_SO"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
rmdir "$libdir_source" 2>/dev/null # Failed rmdir is uncritical
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo ========================================
|
echo ========================================
|
||||||
echo "scotch decomposition ($scotchPACKAGE)"
|
echo "scotch decomposition ($PACKAGE)"
|
||||||
echo " Makefile.inc : ${makefileInc##*/}"
|
echo " Makefile.inc : ${customMakefileInc##*/}"
|
||||||
|
|
||||||
# (serial) scotch
|
# (serial) scotch
|
||||||
prefixDIR="$SCOTCH_ARCH_PATH"
|
bindir="$PKG_PREFIX"/bin
|
||||||
binDIR="$prefixDIR"/bin
|
includedir="$PKG_PREFIX"/include
|
||||||
incDIR="$prefixDIR"/include
|
libdir="$FOAM_EXT_LIBBIN"
|
||||||
libDIR="$FOAM_EXT_LIBBIN"
|
if [ -z "$FOAM_EXT_LIBBIN" ]
|
||||||
|
|
||||||
if [ "$optIntSize" != "$WM_LABEL_SIZE" ]
|
|
||||||
then
|
then
|
||||||
echo "Using int-$optIntSize instead of int-$WM_LABEL_SIZE"
|
libdir="$PKG_PREFIX"/lib
|
||||||
export WM_LABEL_SIZE="$optIntSize"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$optLabelSize" != "$WM_LABEL_SIZE" ]
|
||||||
|
then
|
||||||
|
echo "Using int-$optLabelSize instead of int-$WM_LABEL_SIZE"
|
||||||
|
fi
|
||||||
|
export WM_LABEL_SIZE="$optLabelSize"
|
||||||
|
|
||||||
# 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 "$includedir"/scotch.h ] \
|
||||||
&& haveLibso "$libDIR"/libscotch
|
&& haveLibso "$libdir"/libscotch
|
||||||
then
|
then
|
||||||
echo " scotch include: $incDIR"
|
echo " scotch include: $includedir"
|
||||||
echo " scotch library: $libDIR"
|
echo " scotch library: $libdir"
|
||||||
elif [ -d "$SCOTCH_SOURCE_DIR" ]
|
elif [ -d "$PKG_SOURCE" ]
|
||||||
then
|
then
|
||||||
(
|
(
|
||||||
# Older versions ok, but scotch-6.0.5a cannot build in parallel.
|
# Older versions ok, but scotch-6.0.5a cannot build in parallel.
|
||||||
@ -172,38 +374,36 @@ then
|
|||||||
echo "*** building scotch in serial ***"
|
echo "*** building scotch in serial ***"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
[ -f "$scotchMakefile" ] || {
|
cd "$PKG_SOURCE/src" || exit
|
||||||
echo " Error: no such makefile: $scotchMakefile"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
cd "$SCOTCH_SOURCE_DIR/src" || exit
|
applyPatch "$PACKAGE" .. # patch at parent-level
|
||||||
export GIT_DIR="$SCOTCH_SOURCE_DIR/.git" # Mask seeing our own git-repo
|
createMakefileLinks || exit
|
||||||
rm -rf "$SCOTCH_ARCH_PATH"
|
|
||||||
|
|
||||||
applyPatch "$scotchPACKAGE" .. # patch at parent-level
|
# Verify
|
||||||
|
|
||||||
mkdir -p "$binDIR" 2>/dev/null
|
|
||||||
mkdir -p "$incDIR" 2>/dev/null
|
|
||||||
mkdir -p "$libDIR" 2>/dev/null
|
|
||||||
|
|
||||||
if [ -f "$makefileInc" ]
|
|
||||||
then
|
|
||||||
rm -f Makefile.inc
|
|
||||||
ln -s "$makefileInc" Makefile.inc
|
|
||||||
fi
|
|
||||||
[ -f Makefile.inc ] || {
|
[ -f Makefile.inc ] || {
|
||||||
echo " Error: scotch needs an appropriate Makefile.inc"
|
echo " Error: scotch needs an appropriate Makefile.inc"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Fresh install
|
||||||
|
rm -rf "$PKG_PREFIX"
|
||||||
|
mkdir -p "$bindir" "$includedir" "$libdir"
|
||||||
|
|
||||||
|
# Temporary location for library install
|
||||||
|
libdir_tmp="$libdir"
|
||||||
|
if [ -n "$FOAM_EXT_LIBBIN" ]
|
||||||
|
then
|
||||||
|
libdir_tmp="$PKG_PREFIX"/lib-tmp
|
||||||
|
fi
|
||||||
|
|
||||||
export CCS="$(whichCC)" # CCS (serial compiler)
|
export CCS="$(whichCC)" # CCS (serial compiler)
|
||||||
export CCP="$(whichMpicc)" # CCP (parallel compiler) default=mpicc
|
export CCP="$(whichMpicc)" # CCP (parallel compiler) default=mpicc
|
||||||
|
|
||||||
# Consistency for Intel-MPI and non-icc compilers
|
# Consistency for Intel-MPI and non-icc compilers
|
||||||
[ -n "$I_MPI_CC" ] || export I_MPI_CC="$(whichCC)"
|
[ -n "$I_MPI_CC" ] || export I_MPI_CC="$(whichCC)"
|
||||||
|
|
||||||
# The make targets
|
# The make targets.
|
||||||
|
# - according to docs, cannot make binaries with suffix renaming
|
||||||
make_targets="libscotch"
|
make_targets="libscotch"
|
||||||
if [ "$optBinaries" = true ]
|
if [ "$optBinaries" = true ]
|
||||||
then
|
then
|
||||||
@ -213,14 +413,23 @@ then
|
|||||||
make realclean 2>/dev/null # Extra safety
|
make realclean 2>/dev/null # Extra safety
|
||||||
make -j $WM_NCOMPPROCS $make_targets \
|
make -j $WM_NCOMPPROCS $make_targets \
|
||||||
&& make \
|
&& make \
|
||||||
prefix="$prefixDIR" \
|
prefix="$PKG_PREFIX" \
|
||||||
bindir="$binDIR" \
|
bindir="$bindir" \
|
||||||
libdir="$libDIR" \
|
includedir="$includedir" \
|
||||||
includedir="$incDIR" \
|
libdir="$libdir_tmp" \
|
||||||
install
|
install
|
||||||
|
|
||||||
rmdir "$binDIR" 2>/dev/null || true # Remove empty bin/
|
install_serial "$libdir_tmp"
|
||||||
rmdir "${binDIR%/*}" 2>/dev/null || true # ... and empty parent
|
|
||||||
|
sharedir="$PKG_PREFIX/share"
|
||||||
|
if [ "$optBinaries" = false ]
|
||||||
|
then
|
||||||
|
rm -rf "$sharedir/man" # No bins -> no manpages
|
||||||
|
fi
|
||||||
|
|
||||||
|
rmdir "$bindir" 2>/dev/null || true # Remove empty bin/
|
||||||
|
rmdir "${bindir%/*}" 2>/dev/null || true # ... and empty parent
|
||||||
|
rmdir "$sharedir" 2>/dev/null || true # Remove empty share/
|
||||||
make realclean 2>/dev/null || true # Failed cleanup is uncritical
|
make realclean 2>/dev/null || true # Failed cleanup is uncritical
|
||||||
) || warnBuildIssues SCOTCH
|
) || warnBuildIssues SCOTCH
|
||||||
else
|
else
|
||||||
@ -253,12 +462,12 @@ esac
|
|||||||
|
|
||||||
# Build ptscotch if normal scotch was built (has include and library)
|
# Build ptscotch if normal scotch was built (has include and library)
|
||||||
# (reuse prefix/include/lib dirs set above)
|
# (reuse prefix/include/lib dirs set above)
|
||||||
if [ -f "$incDIR"/scotch.h ] \
|
if [ -f "$includedir"/scotch.h ] \
|
||||||
&& haveLibso "$libDIR"/libscotch
|
&& haveLibso "$libdir"/libscotch
|
||||||
then
|
then
|
||||||
echo
|
echo
|
||||||
echo ========================================
|
echo ========================================
|
||||||
echo "pt-scotch decomposition ($scotchPACKAGE with $FOAM_MPI)"
|
echo "pt-scotch decomposition ($PACKAGE with $FOAM_MPI)"
|
||||||
else
|
else
|
||||||
# Report that the above tests failed and pass-through the failure
|
# Report that the above tests failed and pass-through the failure
|
||||||
echo "Skipping pt-scotch - no <scotch.h> found"
|
echo "Skipping pt-scotch - no <scotch.h> found"
|
||||||
@ -266,81 +475,96 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# (parallel) pt-scotch
|
# (parallel) pt-scotch
|
||||||
prefixDIR="$SCOTCH_ARCH_PATH"
|
bindir="$PKG_PREFIX/bin/$FOAM_MPI"
|
||||||
binDIR="$prefixDIR/bin/$FOAM_MPI"
|
includedir="$PKG_PREFIX/include/$FOAM_MPI"
|
||||||
incDIR="$prefixDIR/include/$FOAM_MPI"
|
libdir="$FOAM_EXT_LIBBIN/$FOAM_MPI"
|
||||||
libDIR="$FOAM_EXT_LIBBIN/$FOAM_MPI"
|
if [ -z "$FOAM_EXT_LIBBIN" ]
|
||||||
|
then
|
||||||
|
libdir="$PKG_PREFIX/lib/$FOAM_MPI"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$optForce" ] \
|
if [ -z "$optForce" ] \
|
||||||
&& [ -f "$incDIR"/ptscotch.h ] \
|
&& [ -f "$includedir"/ptscotch.h ] \
|
||||||
&& haveLibso "$libDIR"/libptscotch
|
&& haveLibso "$libdir"/libptscotch
|
||||||
then
|
then
|
||||||
echo " ptscotch include: $incDIR"
|
echo " ptscotch include: $includedir"
|
||||||
echo " ptscotch library: $libDIR"
|
echo " ptscotch library: $libdir"
|
||||||
else
|
else
|
||||||
(
|
(
|
||||||
# Older versions ok, but scotch-6.0.5a cannot build in parallel.
|
# Older versions ok, but scotch-6.0.5a cannot build in parallel.
|
||||||
# Force serial build
|
# Force serial build
|
||||||
export WM_NCOMPPROCS=1
|
export WM_NCOMPPROCS=1
|
||||||
echo "*** building pt-scotch in serial ***"
|
echo "*** building pt-scotch in serial ***"
|
||||||
|
|
||||||
[ -f "$scotchMakefile" ] || {
|
|
||||||
echo " Error: no such makefile: $scotchMakefile"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
cd "$SCOTCH_SOURCE_DIR/src" || exit
|
|
||||||
export GIT_DIR="$SCOTCH_SOURCE_DIR/.git" # Mask seeing our own git-repo
|
|
||||||
echo
|
echo
|
||||||
|
|
||||||
mkdir -p "$binDIR" 2>/dev/null
|
cd "$PKG_SOURCE/src" || exit
|
||||||
mkdir -p "$incDIR" 2>/dev/null
|
createMakefileLinks || exit
|
||||||
mkdir -p "$libDIR" 2>/dev/null
|
|
||||||
|
|
||||||
if [ -f "$makefileInc" ]
|
# Verify
|
||||||
then
|
|
||||||
rm -f Makefile.inc
|
|
||||||
ln -s "$makefileInc" Makefile.inc
|
|
||||||
fi
|
|
||||||
[ -f Makefile.inc ] || {
|
[ -f Makefile.inc ] || {
|
||||||
echo " Error: ptscotch needs an appropriate Makefile.inc"
|
echo " Error: ptscotch needs an appropriate Makefile.inc"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Install into existing prefix
|
||||||
|
mkdir -p "$bindir" "$includedir" "$libdir"
|
||||||
|
|
||||||
|
# Temporary location for library install
|
||||||
|
libdir_tmp="$libdir"
|
||||||
|
if [ -n "$FOAM_EXT_LIBBIN" ]
|
||||||
|
then
|
||||||
|
libdir_tmp="$PKG_PREFIX"/lib-tmp
|
||||||
|
fi
|
||||||
|
|
||||||
export CCS="$(whichCC)" # CCS (serial compiler)
|
export CCS="$(whichCC)" # CCS (serial compiler)
|
||||||
export CCP="$(whichMpicc)" # CCP (parallel compiler) default=mpicc
|
export CCP="$(whichMpicc)" # CCP (parallel compiler) default=mpicc
|
||||||
|
|
||||||
# Consistency for Intel-MPI and non-icc compilers
|
# Consistency for Intel-MPI and non-icc compilers
|
||||||
[ -n "$I_MPI_CC" ] || export I_MPI_CC="$(whichCC)"
|
[ -n "$I_MPI_CC" ] || export I_MPI_CC="$(whichCC)"
|
||||||
|
|
||||||
# The make targets. No simple means of handling mpi-specific binaries
|
# The make targets.
|
||||||
|
# - no simple means of handling mpi-specific binaries
|
||||||
|
# - according to docs, cannot make binaries with suffix renaming
|
||||||
make_targets="libptscotch"
|
make_targets="libptscotch"
|
||||||
if [ "$optBinaries" = true ]
|
if [ "$optBinaries" = true ]
|
||||||
then
|
then
|
||||||
make_targets="$make_targets ptscotch"
|
make_targets="$make_targets ptscotch"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Remove any old symlinks etc
|
||||||
|
rm -rf "$includedir"/scotch*.h 2>/dev/null
|
||||||
|
rm -rf "$libdir"/libscotch*.so 2>/dev/null
|
||||||
|
|
||||||
make realclean 2>/dev/null # Extra safety
|
make realclean 2>/dev/null # Extra safety
|
||||||
make -j $WM_NCOMPPROCS $make_targets \
|
make -j $WM_NCOMPPROCS $make_targets \
|
||||||
&& make \
|
&& make \
|
||||||
prefix="$prefixDIR" \
|
prefix="$PKG_PREFIX" \
|
||||||
bindir="$binDIR" \
|
bindir="$bindir" \
|
||||||
libdir="$libDIR" \
|
includedir="$includedir" \
|
||||||
includedir="$incDIR" \
|
libdir="$libdir_tmp" \
|
||||||
install
|
install
|
||||||
|
|
||||||
rmdir "$binDIR" 2>/dev/null || true # Remove empty bin/
|
install_parallel "$libdir_tmp"
|
||||||
rmdir "${binDIR%/*}" 2>/dev/null || true # ... and empty parent
|
|
||||||
|
sharedir="$PKG_PREFIX/share"
|
||||||
|
if [ "$optBinaries" = false ]
|
||||||
|
then
|
||||||
|
rm -rf "$sharedir/man" # No bins -> no manpages
|
||||||
|
fi
|
||||||
|
|
||||||
|
rmdir "$bindir" 2>/dev/null || true # Remove empty bin/
|
||||||
|
rmdir "${bindir%/*}" 2>/dev/null || true # ... and empty parent
|
||||||
|
rmdir "$sharedir" 2>/dev/null || true # Remove empty share/
|
||||||
make realclean 2>/dev/null || true # Failed cleanup is uncritical
|
make realclean 2>/dev/null || true # Failed cleanup is uncritical
|
||||||
) || warnBuildIssues PTSCOTCH
|
) || warnBuildIssues PTSCOTCH
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Verify existence of ptscotch include
|
# Verify existence of ptscotch include
|
||||||
[ -f "$SCOTCH_ARCH_PATH/include/$FOAM_MPI/ptscotch.h" ] || {
|
[ -f "$PKG_PREFIX/include/$FOAM_MPI/ptscotch.h" ] || {
|
||||||
echo
|
echo
|
||||||
echo " WARNING: required include file 'ptscotch.h' not found!"
|
echo " WARNING: required include file 'ptscotch.h' not found!"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Could now remove $SCOTCH_SOURCE_DIR/src/Makefile.inc
|
# Could remove $PKG_SOURCE/src/Makefile.inc, but leave for documentation
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user