Commit ae5b2326 authored by Mark Olesen's avatar Mark Olesen

ENH: provide separate makeSCOTCH script for independent use

- improve handling of scotch build toolchain

- relax the test for existence of libscotcherrexit, which can also be
  incorporated into libscotch itself
parent bbbc7b29
...@@ -38,21 +38,6 @@ exportCompiler true # Compiler info + flags for CMake/configure ...@@ -38,21 +38,6 @@ exportCompiler true # Compiler info + flags for CMake/configure
exportLinker # Linker flags for CMake/configure exportLinker # Linker flags for CMake/configure
useGccFlag $@ # Scan arguments for a '-gcc' option useGccFlag $@ # Scan arguments for a '-gcc' option
warnBuildIssues()
{
echo
echo " ---------------------------------------------------"
echo " Optional component ($1) had build issues"
echo " OpenFOAM will nonetheless remain largely functional"
echo " ---------------------------------------------------"
echo
}
warnNotFound()
{
echo "Optional component ($1) was not found"
}
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
echo echo
...@@ -73,191 +58,10 @@ esac ...@@ -73,191 +58,10 @@ esac
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Building scotch on different platforms is still a bit of a pain
# Get SCOTCH_VERSION, SCOTCH_ARCH_PATH
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/scotch)
then
. $settings
else
echo
echo "Error: no config.sh/scotch settings"
echo
fi
echo
echo ========================================
echo "Scotch decomposition ($SCOTCH_VERSION)"
echo " $SCOTCH_ARCH_PATH"
SCOTCH_SOURCE_DIR=$sourceBASE/$SCOTCH_VERSION
# Needs generalizing, but works fairly well
for scotchMakefile in \
"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
if [ -f "$SCOTCH_ARCH_PATH/include/scotch.h" ] \
&& [ -r "$FOAM_EXT_LIBBIN/libscotch$EXT_SO" ] \
&& [ -r "$FOAM_EXT_LIBBIN/libscotcherrexit$EXT_SO" ]
then
echo " scotch include: $SCOTCH_ARCH_PATH/include"
echo " scotch library: $FOAM_EXT_LIBBIN"
elif [ -d "$SCOTCH_SOURCE_DIR" ]
then
(
# Older versions ok, but scotch-6.0.5a cannot build in parallel.
# Force serial build
export WM_NCOMPPROCS=1
echo "*** building scotch in serial ***"
echo
[ -f "$scotchMakefile" ] || {
echo " Error: no such makefile: $scotchMakefile"
exit 1
}
cd $SCOTCH_SOURCE_DIR/src || exit 1
export GIT_DIR=$SCOTCH_SOURCE_DIR/.git # Mask seeing our own git-repo
rm -rf $SCOTCH_ARCH_PATH
applyPatch $SCOTCH_VERSION .. # patch at parent-level
prefixDIR=$SCOTCH_ARCH_PATH
incDIR=$SCOTCH_ARCH_PATH/include
libDIR=$FOAM_EXT_LIBBIN
mkdir -p $prefixDIR 2>/dev/null
mkdir -p $incDIR 2>/dev/null
mkdir -p $libDIR 2>/dev/null
# Makefile relative to this directory
scotchMakefile=../../$scotchMakefile
if [ -f $scotchMakefile ]
then
rm -f Makefile.inc
ln -s $scotchMakefile Makefile.inc
fi
[ -f Makefile.inc ] || {
echo " Error: scotch needs an appropriate Makefile.inc"
exit 1
}
export CCS="$(whichCC)" # CCS (serial compiler)
export CCP="$(whichMpicc)" # CCP (parallel compiler) default=mpicc
# Consistency for Intel-MPI and non-icc compilers
[ -n "$I_MPI_CC" ] || export I_MPI_CC="$(whichCC)"
make realclean 2>/dev/null # Extra safety
make -j $WM_NCOMPPROCS libscotch \
&& make \
prefix=$prefixDIR \
includedir=$incDIR \
libdir=$libDIR \
install
make realclean 2>/dev/null || true # Failed cleanup is uncritical
) || warnBuildIssues SCOTCH
else
warnNotFound SCOTCH
fi
# Build ptscotch if MPI (ThirdParty or system) is available
# and normal scotch was built (has include and library)
if [ "${FOAM_MPI:-dummy}" != dummy ] && \
[ -f $SCOTCH_ARCH_PATH/include/scotch.h \
-a -r $FOAM_EXT_LIBBIN/libscotch$EXT_SO ] || \
{
# Report that the above tests failed and pass-through the failure
echo
echo " WARNING: skipping pt-scotch - no mpi or <scotch.h> not found"
false
}
then
echo
echo ========================================
echo "pt-scotch decomposition ($SCOTCH_VERSION with $FOAM_MPI)"
echo " $SCOTCH_ARCH_PATH"
if [ -f $SCOTCH_ARCH_PATH/include/$FOAM_MPI/ptscotch.h \
-a -r $FOAM_EXT_LIBBIN/$FOAM_MPI/libptscotch$EXT_SO \
-a -r $FOAM_EXT_LIBBIN/$FOAM_MPI/libptscotcherrexit$EXT_SO ]
then
echo " ptscotch include: $SCOTCH_ARCH_PATH/include/$FOAM_MPI"
echo " ptscotch library: $FOAM_EXT_LIBBIN/$FOAM_MPI"
else
(
# Older versions ok, but scotch-6.0.5a cannot build in parallel.
# Force serial build
export WM_NCOMPPROCS=1
echo "*** building pt-scotch in serial ***"
[ -f "$scotchMakefile" ] || {
echo " Error: no such makefile: $scotchMakefile"
exit 1
}
cd $SCOTCH_SOURCE_DIR/src || exit 1
export GIT_DIR=$SCOTCH_SOURCE_DIR/.git # Mask seeing our own git-repo
echo
prefixDIR=$SCOTCH_ARCH_PATH
incDIR=$SCOTCH_ARCH_PATH/include/$FOAM_MPI
libDIR=$FOAM_EXT_LIBBIN/$FOAM_MPI
mkdir -p $prefixDIR 2>/dev/null
mkdir -p $incDIR 2>/dev/null
mkdir -p $libDIR 2>/dev/null
if [ -f $scotchMakefile ]
then
rm -f Makefile.inc
ln -s $scotchMakefile Makefile.inc
fi
[ -f Makefile.inc ] || {
echo " Error: ptscotch needs an appropriate Makefile.inc"
exit 1
}
export CCS="$(whichCC)" # CCS (serial compiler)
export CCP=$(whichMpicc) # CCP (parallel compiler) default=mpicc
# Consistency for Intel-MPI and non-icc compilers
[ -n "$I_MPI_CC" ] || export I_MPI_CC="$(whichCC)"
make realclean 2>/dev/null # Extra safety
make -j $WM_NCOMPPROCS libptscotch \
&& make \
prefix=$prefixDIR \
includedir=$incDIR \
libdir=$libDIR \
install
make realclean 2>/dev/null || true # Failed cleanup is uncritical
) || warnBuildIssues PTSCOTCH
fi
# Verify existence of ptscotch include
[ -f $SCOTCH_ARCH_PATH/include/$FOAM_MPI/ptscotch.h ] || {
echo
echo " WARNING: required include file 'ptscotch.h' not found!"
}
fi
# Could now remove $SCOTCH_SOURCE_DIR/src/Makefile.inc
./makeSCOTCH
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
echo echo
echo ======================================== echo ========================================
# Get KAHIP_ARCH_PATH # Get KAHIP_ARCH_PATH
...@@ -271,13 +75,12 @@ then ...@@ -271,13 +75,12 @@ then
./makeKAHIP -test "$KAHIP_ARCH_PATH" || \ ./makeKAHIP -test "$KAHIP_ARCH_PATH" || \
./makeKAHIP || warnBuildIssues KAHIP ./makeKAHIP || warnBuildIssues KAHIP
else else
warnNotFound KAHIP # METIS is optional warnNotFound KAHIP # is optional
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
echo echo
echo ======================================== echo ========================================
# Get METIS_ARCH_PATH # Get METIS_ARCH_PATH
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/metis) if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/metis)
then then
...@@ -289,7 +92,7 @@ then ...@@ -289,7 +92,7 @@ then
./makeMETIS -test "$METIS_ARCH_PATH" || \ ./makeMETIS -test "$METIS_ARCH_PATH" || \
./makeMETIS || warnBuildIssues METIS ./makeMETIS || warnBuildIssues METIS
else else
warnNotFound METIS # METIS is optional warnNotFound METIS # is optional
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
...@@ -301,7 +104,7 @@ then ...@@ -301,7 +104,7 @@ then
./makeCGAL -test "$CGAL_ARCH_PATH" "$BOOST_ARCH_PATH" || \ ./makeCGAL -test "$CGAL_ARCH_PATH" "$BOOST_ARCH_PATH" || \
./makeCGAL || warnBuildIssues CGAL ./makeCGAL || warnBuildIssues CGAL
else else
warnNotFound CGAL # CGAL is optional warnNotFound CGAL # is optional
fi fi
echo echo
...@@ -312,7 +115,7 @@ then ...@@ -312,7 +115,7 @@ then
./makeFFTW -test "$FFTW_ARCH_PATH" || \ ./makeFFTW -test "$FFTW_ARCH_PATH" || \
./makeFFTW || warnBuildIssues FFTW ./makeFFTW || warnBuildIssues FFTW
else else
warnNotFound FFTW # FFTW is optional warnNotFound FFTW # is optional
fi fi
echo echo
......
...@@ -23,14 +23,19 @@ EXE = ...@@ -23,14 +23,19 @@ EXE =
LIB = .dll LIB = .dll
OBJ = .o OBJ = .o
AR = $(CC) # Separate the cross-compilation flags from regular CFLAGS to ensure that
# system gcc does not use them for the scotch build toolchain
CFLAGS_CROSS = -DCOMMON_WINDOWS -DCOMMON_STUB_FORK
AR = x86_64-w64-mingw32-gcc
ARFLAGS = $(CFLAGS) -shared -Wl,--output-def,libscotch.def,--out-implib,libscotch.a,--enable-auto-import,--strip-all -o ARFLAGS = $(CFLAGS) -shared -Wl,--output-def,libscotch.def,--out-implib,libscotch.a,--enable-auto-import,--strip-all -o
CC = x86_64-w64-mingw32-gcc CC = x86_64-w64-mingw32-gcc $(CFLAGS_CROSS)
CCS = x86_64-w64-mingw32-gcc CCS = x86_64-w64-mingw32-gcc
CCP = x86_64-w64-mingw32-gcc CCP = x86_64-w64-mingw32-gcc
CCD = gcc CCD = gcc
CFLAGS = $(WM_CFLAGS) -fPIC -O3 \ CFLAGS = $(WM_CFLAGS) -fPIC -O3 \
-DCOMMON_WINDOWS -DCOMMON_STUB_FORK -DCOMMON_PTHREAD_FILE \ -DCOMMON_PTHREAD_FILE \
-UCOMMON_FILE_COMPRESS \ -UCOMMON_FILE_COMPRESS \
-DCOMMON_RANDOM_FIXED_SEED \ -DCOMMON_RANDOM_FIXED_SEED \
-DSCOTCH_DETERMINISTIC \ -DSCOTCH_DETERMINISTIC \
......
--- scotch_6.0.6/src/libscotch/Makefile.orig 2019-04-14 19:54:54.819485613 +0200 --- scotch_6.0.6/src/libscotch/Makefile.orig 2019-04-29 14:59:53.957103493 +0200
+++ scotch_6.0.6/src/libscotch/Makefile 2019-04-14 19:52:10.623889351 +0200 +++ scotch_6.0.6/src/libscotch/Makefile 2019-04-29 18:50:42.560080675 +0200
@@ -51,6 +51,8 @@ @@ -51,6 +51,12 @@
.PHONY : ptscotch scotch ptinstall install clean realclean .PHONY : ptscotch scotch ptinstall install clean realclean
+libscotch : libscotch$(LIB) scotch.h +ifeq ($(WM_OSTYPE),MSwindows)
+
+libscotch : libscotch$(LIB) scotch.h
+
+endif
+ +
scotch : scotch :
$(MAKE) CC="$(CCS)" CCD="$(CCS)" \ $(MAKE) CC="$(CCS)" CCD="$(CCS)" \
scotch.h \ scotch.h \
@@ -436,7 +438,8 @@ @@ -438,6 +444,11 @@
wgraph_part_rb$(OBJ) \
wgraph_part_st$(OBJ) \
wgraph_part_zr$(OBJ) \ wgraph_part_zr$(OBJ) \
- wgraph_store$(OBJ) wgraph_store$(OBJ)
+ wgraph_store$(OBJ) \
+ library_error_exit$(OBJ)
+ifeq ($(WM_OSTYPE),MSwindows)
+## Add into libscotch instead of having a separate library
+LIBSCOTCHDEPS += library_error_exit$(OBJ)
+endif
+
## ##
## Todo list. ## Todo list.
##
--- scotch_6.0.6/src/Makefile.orig 2018-07-14 17:24:49.000000000 +0200 --- scotch_6.0.6/src/Makefile.orig 2018-07-14 17:24:49.000000000 +0200
+++ scotch_6.0.6/src/Makefile 2019-04-14 19:56:43.207219102 +0200 +++ scotch_6.0.6/src/Makefile 2019-04-29 18:39:16.365132864 +0200
@@ -90,7 +90,7 @@ @@ -89,9 +89,18 @@
$(mandir)/man1 : $(mandir)
-$(MKDIR) $(mandir)/man1 -$(MKDIR) $(mandir)/man1
libscotch : required +ifeq ($(WM_OSTYPE),MSwindows)
- (cd libscotch ; $(MAKE) VERSION=$(VERSION) RELEASE=$(RELEASE) PATCHLEVEL=$(PATCHLEVEL) scotch && $(MAKE) install) +
+libscotch : required
+ (cd libscotch ; $(MAKE) VERSION=$(VERSION) RELEASE=$(RELEASE) PATCHLEVEL=$(PATCHLEVEL) libscotch && $(MAKE) install) + (cd libscotch ; $(MAKE) VERSION=$(VERSION) RELEASE=$(RELEASE) PATCHLEVEL=$(PATCHLEVEL) libscotch && $(MAKE) install)
+
+else
+
libscotch : required
(cd libscotch ; $(MAKE) VERSION=$(VERSION) RELEASE=$(RELEASE) PATCHLEVEL=$(PATCHLEVEL) scotch && $(MAKE) install)
+endif
+
scotch : libscotch scotch : libscotch
(cd scotch ; $(MAKE) VERSION=$(VERSION) RELEASE=$(RELEASE) PATCHLEVEL=$(PATCHLEVEL) scotch && $(MAKE) install) (cd scotch ; $(MAKE) VERSION=$(VERSION) RELEASE=$(RELEASE) PATCHLEVEL=$(PATCHLEVEL) scotch && $(MAKE) install)
(cd libscotchmetis ; $(MAKE) scotch && $(MAKE) install)
...@@ -302,6 +302,24 @@ die() ...@@ -302,6 +302,24 @@ die()
exit 1 exit 1
} }
# Warn
warnBuildIssues()
{
echo
echo " ---------------------------------------------------"
echo " Optional component ($1) had build issues"
echo " OpenFOAM will nonetheless remain largely functional"
echo " ---------------------------------------------------"
echo
}
# Warn
warnNotFound()
{
echo "Optional component ($1) was not found"
}
# Test if it matches "*-none" # Test if it matches "*-none"
_foamIsNone() _foamIsNone()
{ {
......
...@@ -130,7 +130,7 @@ fi ...@@ -130,7 +130,7 @@ fi
# HYPRE_SOURCE_DIR : location of the original sources # 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} : "${HYPRE_ARCH_PATH:=$installBASE$WM_SIZE_OPTIONS/$hyprePACKAGE}"
[ -d "$HYPRE_SOURCE_DIR" ] || { [ -d "$HYPRE_SOURCE_DIR" ] || {
echo "Missing sources: '$hyprePACKAGE'" echo "Missing sources: '$hyprePACKAGE'"
......
...@@ -130,7 +130,7 @@ fi ...@@ -130,7 +130,7 @@ fi
# METIS_SOURCE_DIR : location of the original sources # METIS_SOURCE_DIR : location of the original sources
METIS_SOURCE_DIR=$sourceBASE/$metisPACKAGE METIS_SOURCE_DIR=$sourceBASE/$metisPACKAGE
: ${METIS_ARCH_PATH:=$installBASE$WM_SIZE_OPTIONS/$metisPACKAGE} : "${METIS_ARCH_PATH:=$installBASE$WM_SIZE_OPTIONS/$metisPACKAGE}"
[ -d "$METIS_SOURCE_DIR" ] || { [ -d "$METIS_SOURCE_DIR" ] || {
echo "Missing sources: '$metisPACKAGE'" echo "Missing sources: '$metisPACKAGE'"
......
...@@ -94,7 +94,7 @@ fi ...@@ -94,7 +94,7 @@ fi
# MGRIDGEN_ARCH_PATH : installation directory # MGRIDGEN_ARCH_PATH : installation directory
MGRIDGEN_SOURCE_DIR=$WM_THIRD_PARTY_DIR/$mgridgenPACKAGE MGRIDGEN_SOURCE_DIR=$WM_THIRD_PARTY_DIR/$mgridgenPACKAGE
MGRIDGEN_ARCH_PATH=$installBASE$WM_SIZE_OPTIONS/$mgridgenPACKAGE MGRIDGEN_ARCH_PATH="$installBASE$WM_SIZE_OPTIONS/$mgridgenPACKAGE"
: ${FOAM_MPI:=dummy} : ${FOAM_MPI:=dummy}
......
...@@ -130,7 +130,7 @@ fi ...@@ -130,7 +130,7 @@ fi
# PETSC_SOURCE_DIR : location of the original sources # PETSC_SOURCE_DIR : location of the original sources
PETSC_SOURCE_DIR=$sourceBASE/$petscPACKAGE PETSC_SOURCE_DIR=$sourceBASE/$petscPACKAGE
: ${PETSC_ARCH_PATH:=$installBASE$WM_SIZE_OPTIONS/$petscPACKAGE} : "${PETSC_ARCH_PATH:=$installBASE$WM_SIZE_OPTIONS/$petscPACKAGE}"
[ -d "$PETSC_SOURCE_DIR" ] || { [ -d "$PETSC_SOURCE_DIR" ] || {
echo "Missing sources: '$petscPACKAGE'" echo "Missing sources: '$petscPACKAGE'"
......
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
#
# Script
# makeSCOTCH
#
# Description
# Build the SCOTCH and PTSCOTCH libraries
#
# ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Run from third-party directory only
cd ${0%/*} && wmakeCheckPwd "$WM_THIRD_PARTY_DIR" 2>/dev/null || {
echo "Error (${0##*/}) : not located in \$WM_THIRD_PARTY_DIR"
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 scotch # Get SCOTCH_ARCH_PATH, SCOTCH_VERSION
scotchPACKAGE=${SCOTCH_VERSION:-scotch-system}
unset withMPI
case "$WM_MPLIB" in (*MPI*) [ "$FOAM_MPI" = dummy ] || withMPI=true ;; esac
#------------------------------------------------------------------------------
usage()
{
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
/bin/cat<<USAGE
Usage: ${0##*/} [OPTION] [libso] [scotch-VERSION]
options:
-gcc Force use of gcc/g++
-no-mpi Suppress build of pt-scotch
-help
* Compile SCOTCH
$kahipPACKAGE
USAGE
exit 1
}
#------------------------------------------------------------------------------
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
'') ;; # Ignore empty
-h | -help) usage ;;
-gcc) useGcc ;;
-no-mpi)
unset withMPI
;;
scotch-[1-9]* | scotch-git | scotch_* | scotch-[1-9]*)
scotchPACKAGE="${1%%/}"
unset SCOTCH_ARCH_PATH # Avoid inconsistency
;;
*)
die "unknown option/argument: '$1'"
;;
esac
shift
done
[ -n "$scotchPACKAGE" ] || die "The scotch-VERSION was not specified"
# Nothing to build
if _foamIsNone $scotchPACKAGE
then
echo "Using scotch-none (skip ThirdParty build of SCOTCH)"
exit 0
elif _foamIsSystem $scotchPACKAGE
then
echo "Using scotch-system"
exit 0
fi
#------------------------------------------------------------------------------
# Needs generalizing, but works fairly well
for scotchMakefile in \
"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
#
# SCOTCH_ARCH_PATH : installation directory
# SCOTCH_SOURCE_DIR : location of the original sources
SCOTCH_SOURCE_DIR=$sourceBASE/$scotchPACKAGE
: "${SCOTCH_ARCH_PATH:=$installBASE$WM_SIZE_OPTIONS/$scotchPACKAGE}"
[ -d "$SCOTCH_SOURCE_DIR" ] || {
echo "Missing sources: '$scotchPACKAGE'"
exit 1
}
echo
echo ========================================
echo "scotch decomposition ($scotchPACKAGE)"
echo " Makefile.inc : ${makefileInc##*/}"
# Test installation. May or may not have libscotcherrexit.so
if [ -f "$SCOTCH_ARCH_PATH/include/scotch.h" ] \
&& [ -r "$FOAM_EXT_LIBBIN/libscotch$EXT_SO" ]
then
echo " scotch include: $SCOTCH_ARCH_PATH/include"
echo " scotch library: $FOAM_EXT_LIBBIN"
elif [ -d "$SCOTCH_SOURCE_DIR" ]
then
(
# Older versions ok, but scotch-6.0.5a cannot build in parallel.
# Force serial build
export WM_NCOMPPROCS=1
echo "*** building scotch in serial ***"
echo
[ -f "$scotchMakefile" ] || {
echo " Error: no such makefile: $scotchMakefile"
exit 1
}
cd $SCOTCH_SOURCE_DIR/src || exit 1
export GIT_DIR=$SCOTCH_SOURCE_DIR/.git # Mask seeing our own git-repo
rm -rf $SCOTCH_ARCH_PATH
applyPatch "$scotchPACKAGE" .. # patch at parent-level
prefixDIR=$SCOTCH_ARCH_PATH
incDIR=$SCOTCH_ARCH_PATH/include
libDIR=$FOAM_EXT_LIBBIN
mkdir -p $prefixDIR 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 ] || {
echo " Error: scotch needs an appropriate Makefile.inc"
exit 1
}
export CCS="$(whichCC)" # CCS (serial compiler)
export CCP="$(whichMpicc)" # CCP (parallel compiler) default=mpicc
# Consistency for Intel-MPI and non-icc compilers
[ -n "$I_MPI_CC" ] || export I_MPI_CC="$(whichCC)"
make realclean 2>/dev/null # Extra safety
make -j $WM_NCOMPPROCS libscotch \
&& make \
prefix=$prefixDIR \
includedir=$incDIR \
libdir=$libDIR \
install
rmdir "$SCOTCH_ARCH_PATH/bin" 2> /dev/null || true # Superfluous bin?
make realclean 2>/dev/null || true # Failed cleanup is uncritical
) || warnBuildIssues SCOTCH
else
warnNotFound SCOTCH
fi
# Build ptscotch when MPI (ThirdParty or system) is available
[ "${withMPI}" = true ] || {
# Report that the above tests failed and pass-through the failure
echo "Skipping pt-scotch (no mpi)"
exit 0
}
echo
echo ========================================
echo "pt-scotch decomposition ($scotchPACKAGE with $FOAM_MPI)"
# Build ptscotch if normal scotch was built (has include and library)
[ -f "$SCOTCH_ARCH_PATH/include/scotch.h" ] && \
[ -r "$FOAM_EXT_LIBBIN/libscotch$EXT_SO" ] || \
{
# Report that the above tests failed and pass-through the failure
echo
echo " skipping - no <scotch.h> found"
exit 1
}
if [ -f "$SCOTCH_ARCH_PATH/include/$FOAM_MPI/ptscotch.h" ] && \
[ -r "$FOAM_EXT_LIBBIN/$FOAM_MPI/libptscotch$EXT_SO" ]
then
echo " ptscotch include: $SCOTCH_ARCH_PATH/include/$FOAM_MPI"
echo " ptscotch library: $FOAM_EXT_LIBBIN/$FOAM_MPI"
else
(
# Older versions ok, but scotch-6.0.5a cannot build in parallel.
# Force serial build
export WM_NCOMPPROCS=1
echo "*** building pt-scotch in serial ***"
[ -f "$scotchMakefile" ] || {
echo " Error: no such makefile: $scotchMakefile"
exit 1
}