ENH: add build scripts for KaHIP and METIS

This commit is contained in:
Mark Olesen
2017-10-11 09:50:16 +02:00
parent 6f32862d26
commit 491b3390bb
11 changed files with 622 additions and 92 deletions

View File

@ -94,6 +94,19 @@ do
done done
# Clean various packages via 'wclean'
for i in libccmio*/Make kahip*/lib/Make
do
[ -d "$i" ] && (
echo
echo "${i%/Make}"
echo " wclean"
echo
cd ${i%/Make} && wclean
)
done
# Clean out-of-source build directories # Clean out-of-source build directories
if [ -d build ] if [ -d build ]
then then

View File

@ -65,8 +65,7 @@ warnBuildIssues()
warnNotFound() warnNotFound()
{ {
echo " Optional component ($1) was not found" echo "Optional component ($1) was not found"
echo
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
@ -101,7 +100,7 @@ fi
echo echo
echo ======================================== echo ========================================
echo "Build Scotch decomposition library $SCOTCH_VERSION" echo "Scotch decomposition ($SCOTCH_VERSION)"
echo " $SCOTCH_ARCH_PATH" echo " $SCOTCH_ARCH_PATH"
SCOTCH_SOURCE_DIR=$sourceBASE/$SCOTCH_VERSION SCOTCH_SOURCE_DIR=$sourceBASE/$SCOTCH_VERSION
@ -113,8 +112,8 @@ if [ -f $SCOTCH_ARCH_PATH/include/scotch.h \
-a -r $FOAM_EXT_LIBBIN/libscotch.so \ -a -r $FOAM_EXT_LIBBIN/libscotch.so \
-a -r $FOAM_EXT_LIBBIN/libscotcherrexit.so ] -a -r $FOAM_EXT_LIBBIN/libscotcherrexit.so ]
then then
echo " scotch header in $SCOTCH_ARCH_PATH/include" echo " scotch include: $SCOTCH_ARCH_PATH/include"
echo " scotch libs in $FOAM_EXT_LIBBIN" echo " scotch library: $FOAM_EXT_LIBBIN"
elif [ -d "$SCOTCH_SOURCE_DIR" ] elif [ -d "$SCOTCH_SOURCE_DIR" ]
then then
( (
@ -176,15 +175,15 @@ if [ "${FOAM_MPI:-dummy}" != dummy ] && \
then then
echo echo
echo ======================================== echo ========================================
echo "Build pt-scotch decomposition library $SCOTCH_VERSION (with $FOAM_MPI)" echo "pt-scotch decomposition ($SCOTCH_VERSION with $FOAM_MPI)"
echo " $SCOTCH_ARCH_PATH" echo " $SCOTCH_ARCH_PATH"
if [ -f $SCOTCH_ARCH_PATH/include/$FOAM_MPI/ptscotch.h \ if [ -f $SCOTCH_ARCH_PATH/include/$FOAM_MPI/ptscotch.h \
-a -r $FOAM_EXT_LIBBIN/$FOAM_MPI/libptscotch.so \ -a -r $FOAM_EXT_LIBBIN/$FOAM_MPI/libptscotch.so \
-a -r $FOAM_EXT_LIBBIN/$FOAM_MPI/libptscotcherrexit.so ] -a -r $FOAM_EXT_LIBBIN/$FOAM_MPI/libptscotcherrexit.so ]
then then
echo " ptscotch header in $SCOTCH_ARCH_PATH/include/$FOAM_MPI" echo " ptscotch include: $SCOTCH_ARCH_PATH/include/$FOAM_MPI"
echo " ptscotch libs in $FOAM_EXT_LIBBIN/$FOAM_MPI" echo " ptscotch library: $FOAM_EXT_LIBBIN/$FOAM_MPI"
else else
( (
cd $SCOTCH_SOURCE_DIR/src || exit 1 cd $SCOTCH_SOURCE_DIR/src || exit 1
@ -239,55 +238,46 @@ fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Metis is optional
echo echo
echo ======================================== echo ========================================
echo Build Metis decomposition # Get KAHIP_ARCH_PATH
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/kahip)
# Get METIS_VERSION, METIS_ARCH_PATH
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/metis)
then then
. $settings . $settings
fi fi
if [ -n "$KAHIP_ARCH_PATH" ]
METIS_SOURCE_DIR=$sourceBASE/$METIS_VERSION
if [ -f $METIS_ARCH_PATH/include/metis.h \
-a -r $FOAM_EXT_LIBBIN/libmetis.so ]
then then
echo " metis header in $METIS_ARCH_PATH/include" echo KaHIP decomposition
echo " metis libs in $FOAM_EXT_LIBBIN" ./makeKAHIP -test "$KAHIP_ARCH_PATH" || \
elif [ -d "$METIS_SOURCE_DIR" ] ./makeKAHIP || warnBuildIssues KAHIP
then
(
cd $METIS_SOURCE_DIR || exit 1
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo
rm -rf $METIS_ARCH_PATH
# Adjust metis integer size to match OpenFOAM label-size
sed -i -e 's=\(#define IDXTYPEWIDTH\).*=\1 '$WM_LABEL_SIZE'=' \
include/metis.h
# No config option for the library location.
# - build normally and use mv to relocate it
make config shared=1 prefix=$METIS_ARCH_PATH \
&& make -j $WM_NCOMPPROCS install \
&& mv $METIS_ARCH_PATH/lib/libmetis.so $FOAM_EXT_LIBBIN
rmdir $METIS_ARCH_PATH/lib 2>/dev/null || true # Failed rmdir is uncritical
) || warnBuildIssues METIS
else else
warnNotFound METIS warnNotFound KAHIP # METIS is optional
fi
#------------------------------------------------------------------------------
echo
echo ========================================
# Get METIS_ARCH_PATH
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/metis)
then
. $settings
fi
if [ -n "$METIS_ARCH_PATH" ]
then
echo Metis decomposition
./makeMETIS -test "$METIS_ARCH_PATH" || \
./makeMETIS || warnBuildIssues METIS
else
warnNotFound METIS # METIS is optional
fi fi
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
echo echo
echo ======================================== echo ========================================
echo Build CGAL
if [ -n "$CGAL_ARCH_PATH" ] if [ -n "$CGAL_ARCH_PATH" ]
then then
echo "CGAL/boost"
./makeCGAL -test "$CGAL_ARCH_PATH" "$BOOST_ARCH_PATH" || \ ./makeCGAL -test "$CGAL_ARCH_PATH" "$BOOST_ARCH_PATH" || \
./makeCGAL || warnBuildIssues CGAL ./makeCGAL || warnBuildIssues CGAL
else else
@ -296,9 +286,9 @@ fi
echo echo
echo ======================================== echo ========================================
echo Build FFTW
if [ -n "$FFTW_ARCH_PATH" ] if [ -n "$FFTW_ARCH_PATH" ]
then then
echo FFTW
./makeFFTW -test "$FFTW_ARCH_PATH" || \ ./makeFFTW -test "$FFTW_ARCH_PATH" || \
./makeFFTW || warnBuildIssues FFTW ./makeFFTW || warnBuildIssues FFTW
else else

View File

@ -109,7 +109,7 @@ ThirdParty components prior to building OpenFOAM itself.
- This will be automatically invoked by the top-level OpenFOAM `Allwmake`, but - This will be automatically invoked by the top-level OpenFOAM `Allwmake`, but
can also be invoked directly to find possible build errors. can also be invoked directly to find possible build errors.
- Builds an mpi library (openmpi or mpich), scotch decomposition, boost, CGAL, FFTW. - Builds an mpi library (openmpi or mpich), scotch decomposition, boost, CGAL, FFTW.
- If the optional metis directory is found, it will also be compiled. - If the optional kahip or metis directories are found, they will also be compiled.
4. `makeParaView` *(optional but highly recommended)* 4. `makeParaView` *(optional but highly recommended)*
- This is optional, but extremely useful for visualization and for - This is optional, but extremely useful for visualization and for
run-time post-processing function objects. run-time post-processing function objects.
@ -122,16 +122,26 @@ ThirdParty components prior to building OpenFOAM itself.
#### Optional Components #### Optional Components
`makeADIOS` `makeADIOS`
- Only required for ADIOS support, - Only required for [ADIOS](#parallel) support,
which is currently staged in the [add-ons repository][link AddOns]. which is currently staged in the [add-ons repository][link AddOns].
`makeCGAL` `makeCGAL`
- Builds third-party boost and CGAL. - Builds [boost](#general-packages) and [CGAL](#general-packages).
Automatically invoked from the ThirdParty `Allwmake`, Automatically invoked from the ThirdParty `Allwmake`,
but can be invoked directly to resolve possible build errors. but can be invoked directly to resolve possible build errors.
`makeFFTW` `makeFFTW`
- Builds third-party FFTW. - Builds [FFTW](#general-packages).
Automatically invoked from the ThirdParty `Allwmake`,
but can be invoked directly to resolve possible build errors.
`makeKAHIP`
- Builds [KaHIP](#parallel) decomposition library.
Automatically invoked from the ThirdParty `Allwmake`,
but can be invoked directly to resolve possible build errors.
`makeMETIS`
- Builds [METIS](#parallel) decomposition library.
Automatically invoked from the ThirdParty `Allwmake`, Automatically invoked from the ThirdParty `Allwmake`,
but can be invoked directly to resolve possible build errors. but can be invoked directly to resolve possible build errors.
@ -147,11 +157,11 @@ ThirdParty components prior to building OpenFOAM itself.
`makeMesa`, `makeVTK` `makeMesa`, `makeVTK`
- Additional support for building offscreen rendering components. - Additional support for building offscreen rendering components.
Useful if you want to render on computer servers without graphics cards. Useful if you want to render on computer servers without graphics cards.
The `makeParaView.example` and `makeVTK.example` files provide some useful The `makeParaView.example` and `makeVTK.example` files offer some
suggestions about compiling such a configuration. suggestions about compiling such a configuration.
`makeQt` `makeQt`
- Script to build a [third-party installation of Qt](#makeQt), including qmake. - Script to build a [Qt](#makeQt), including qmake.
- Possibly needed for `makeParaView`. - Possibly needed for `makeParaView`.
- The associated `etc/relocateQt` may be of independent use. - The associated `etc/relocateQt` may be of independent use.
Read the file for more details. Read the file for more details.
@ -312,15 +322,6 @@ GNU *configure* can only be used prior to clang version 3.9.
| [llvm][page llvm] | [download][link llvm] | [llvm][page llvm] | [download][link llvm]
### Parallel Processing <a name="parallel"></a>
| Name | Location
|-----------------------|------------------------
| [adios][page adios] | [repo][repo adios] or [github download][link adios] or [alt download][altlink adios]
| [scotch, ptscotch][page scotch] | [download][link scotch]
| [openmpi][page openmpi] | [download][link openmpi]. The newer [openmpi][newer openmpi] make exhibit stability issues.
### General <a name="general-packages"></a> ### General <a name="general-packages"></a>
| Name | Location | Name | Location
@ -334,6 +335,17 @@ GNU *configure* can only be used prior to clang version 3.9.
| gperftools | [repo][repo gperftools] or [download][link gperftools] | gperftools | [repo][repo gperftools] or [download][link gperftools]
### Parallel Processing <a name="parallel"></a>
| Name | Location
|-----------------------|------------------------
| [openmpi][page openmpi] | [download][link openmpi]. The newer [openmpi][newer openmpi] make exhibit stability issues.
| [adios][page adios] | [repo][repo adios] or [github download][link adios] or [alt download][altlink adios]
| [scotch, ptscotch][page scotch] | [download][link scotch]
| [kahip][page kahip] | [download][link kahip]
| [metis][page metis] | [download][link metis]
### Visualization <a name="viz-version"></a> ### Visualization <a name="viz-version"></a>
| Name | Location | Name | Location
@ -405,6 +417,12 @@ The minimum gcc/g++ requirements for building various components.
[page scotch]: https://www.labri.fr/perso/pelegrin/scotch/ [page scotch]: https://www.labri.fr/perso/pelegrin/scotch/
[link scotch]: https://gforge.inria.fr/frs/download.php/file/34099/scotch_6.0.3.tar.gz [link scotch]: https://gforge.inria.fr/frs/download.php/file/34099/scotch_6.0.3.tar.gz
[page kahip]: http://algo2.iti.kit.edu/documents/kahip/
[link kahip]: http://algo2.iti.kit.edu/schulz/software_releases/KaHIP_2.00.tar.gz
[page metis]: http://glaros.dtc.umn.edu/gkhome/metis/metis/overview
[link metis]: http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-5.1.0.tar.gz
[page openmpi]: http://www.open-mpi.org/ [page openmpi]: http://www.open-mpi.org/
[link openmpi]: https://www.open-mpi.org/software/ompi/v1.10/downloads/openmpi-1.10.4.tar.bz2 [link openmpi]: https://www.open-mpi.org/software/ompi/v1.10/downloads/openmpi-1.10.4.tar.bz2
[newer openmpi]: https://www.open-mpi.org/software/ompi/v2.1/downloads/openmpi-2.1.1.tar.bz2 [newer openmpi]: https://www.open-mpi.org/software/ompi/v2.1/downloads/openmpi-2.1.1.tar.bz2
@ -452,7 +470,7 @@ The minimum gcc/g++ requirements for building various components.
<!-- OpenFOAM --> <!-- OpenFOAM -->
[link AddOns]: https://develop.openfoam.com/Community/OpenFOAM-addOns [link AddOns]: https://develop.openfoam.com/Community/OpenFOAM-addOns
[link community-projects]: http://www.openfoam.com/services/community-projects.php [link community-projects]: http://www.openfoam.com/community/projects.php
<!-- Standard Footer --> <!-- Standard Footer -->
@ -460,8 +478,8 @@ The minimum gcc/g++ requirements for building various components.
- [Community AddOns][link AddOns] repository - [Community AddOns][link AddOns] repository
- [Collaborative and Community-based Developments][link community-projects] - [Collaborative and Community-based Developments][link community-projects]
- [Download](http://www.openfoam.com/releases) and - [Download](http://www.openfoam.com/download) and
[installation instructions](http://www.openfoam.com/download/installation.php) [installation instructions](http://www.openfoam.com/code/build-guide.php)
- [Documentation](http://www.openfoam.com/documentation) - [Documentation](http://www.openfoam.com/documentation)
- [Reporting bugs/issues](http://www.openfoam.com/code/bug-reporting.php) (including bugs/suggestions/feature requests) in OpenFOAM+ - [Reporting bugs/issues](http://www.openfoam.com/code/bug-reporting.php) (including bugs/suggestions/feature requests) in OpenFOAM+
- [Contacting OpenCFD](http://www.openfoam.com/contact) - [Contacting OpenCFD](http://www.openfoam.com/contact)

70
etc/makeFiles/kahip/files Normal file
View File

@ -0,0 +1,70 @@
/* NOTE: make any changes to this file in etc/wmakeFiles/ */
interface/kaHIP_interface.cpp
/* List obtained from SConscript, libkaffpa_files = [ ... ] entry */
data_structure/graph_hierarchy.cpp
algorithms/strongly_connected_components.cpp
algorithms/topological_sort.cpp
algorithms/push_relabel.cpp
io/graph_io.cpp
tools/quality_metrics.cpp
tools/random_functions.cpp
tools/graph_extractor.cpp
tools/misc.cpp
tools/partition_snapshooter.cpp
partition/graph_partitioner.cpp
partition/w_cycles/wcycle_partitioner.cpp
partition/coarsening/coarsening.cpp
partition/coarsening/contraction.cpp
partition/coarsening/edge_rating/edge_ratings.cpp
partition/coarsening/matching/matching.cpp
partition/coarsening/matching/random_matching.cpp
partition/coarsening/matching/gpa/path.cpp
partition/coarsening/matching/gpa/gpa_matching.cpp
partition/coarsening/matching/gpa/path_set.cpp
partition/coarsening/clustering/node_ordering.cpp
partition/coarsening/clustering/size_constraint_label_propagation.cpp
partition/initial_partitioning/initial_partitioning.cpp
partition/initial_partitioning/initial_partitioner.cpp
partition/initial_partitioning/initial_partition_bipartition.cpp
partition/initial_partitioning/initial_refinement/initial_refinement.cpp
partition/initial_partitioning/bipartition.cpp
partition/initial_partitioning/initial_node_separator.cpp
partition/uncoarsening/uncoarsening.cpp
partition/uncoarsening/separator/area_bfs.cpp
partition/uncoarsening/separator/vertex_separator_algorithm.cpp
partition/uncoarsening/separator/vertex_separator_flow_solver.cpp
partition/uncoarsening/refinement/cycle_improvements/greedy_neg_cycle.cpp
partition/uncoarsening/refinement/cycle_improvements/problem_factory.cpp
partition/uncoarsening/refinement/cycle_improvements/augmented_Qgraph.cpp
partition/uncoarsening/refinement/mixed_refinement.cpp
partition/uncoarsening/refinement/label_propagation_refinement/label_propagation_refinement.cpp
partition/uncoarsening/refinement/refinement.cpp
partition/uncoarsening/refinement/quotient_graph_refinement/2way_fm_refinement/two_way_fm.cpp
partition/uncoarsening/refinement/quotient_graph_refinement/flow_refinement/two_way_flow_refinement.cpp
partition/uncoarsening/refinement/quotient_graph_refinement/flow_refinement/boundary_bfs.cpp
partition/uncoarsening/refinement/quotient_graph_refinement/flow_refinement/flow_solving_kernel/cut_flow_problem_solver.cpp
partition/uncoarsening/refinement/quotient_graph_refinement/flow_refinement/most_balanced_minimum_cuts/most_balanced_minimum_cuts.cpp
partition/uncoarsening/refinement/quotient_graph_refinement/quotient_graph_refinement.cpp
partition/uncoarsening/refinement/quotient_graph_refinement/complete_boundary.cpp
partition/uncoarsening/refinement/quotient_graph_refinement/partial_boundary.cpp
partition/uncoarsening/refinement/quotient_graph_refinement/quotient_graph_scheduling/quotient_graph_scheduling.cpp
partition/uncoarsening/refinement/quotient_graph_refinement/quotient_graph_scheduling/simple_quotient_graph_scheduler.cpp
partition/uncoarsening/refinement/quotient_graph_refinement/quotient_graph_scheduling/active_block_quotient_graph_scheduler.cpp
partition/uncoarsening/refinement/kway_graph_refinement/kway_graph_refinement.cpp
partition/uncoarsening/refinement/kway_graph_refinement/kway_graph_refinement_core.cpp
partition/uncoarsening/refinement/kway_graph_refinement/kway_graph_refinement_commons.cpp
partition/uncoarsening/refinement/cycle_improvements/augmented_Qgraph_fabric.cpp
partition/uncoarsening/refinement/cycle_improvements/advanced_models.cpp
partition/uncoarsening/refinement/kway_graph_refinement/multitry_kway_fm.cpp
partition/uncoarsening/refinement/node_separators/greedy_ns_local_search.cpp
partition/uncoarsening/refinement/node_separators/fm_ns_local_search.cpp
partition/uncoarsening/refinement/node_separators/localized_fm_ns_local_search.cpp
algorithms/cycle_search.cpp
partition/uncoarsening/refinement/cycle_improvements/cycle_refinement.cpp
partition/uncoarsening/refinement/tabu_search/tabu_search.cpp
LIB = $(FOAM_EXT_LIBBIN)/libkahip

View File

@ -0,0 +1,14 @@
/*
* NOTE: make any changes to this file in etc/wmakeFiles/
* Must use -DNDEBUG to disable kahip debug mode.
* Using -DMODE_NODESEP is not strictly required for building the library.
*/
EXE_INC = \
${c++LESSWARN} \
-DNDEBUG -DMODE_NODESEP \
-I$(KAHIP_LIB_SRC) \
-I$(KAHIP_LIB_SRC)/partition \
-I$(KAHIP_LIB_SRC)/partition/uncoarsening/refinement/quotient_graph_refinement/flow_refinement
LIB_LIBS =

View File

@ -111,29 +111,48 @@ CCMIO_ARCH_PATH=$installBASE/$ccmioPACKAGE
# Sources must be available # Sources must be available
[ -d "$CCMIO_SOURCE_DIR" ] || die "Missing sources: '$ccmioPACKAGE'" [ -d "$CCMIO_SOURCE_DIR" ] || die "Missing sources: '$ccmioPACKAGE'"
#
# Manual installation
#
install()
{
# Ensure a clean build next time
wclean
local incdir=$CCMIO_ARCH_PATH/include/libccmio
# Make headers available:
mkdir -m 0755 -p $incdir
/bin/cp -pv libccmio/ccmio*.h $incdir
}
echo "Starting build: $ccmioPACKAGE ($targetType)"
echo
( (
cd $CCMIO_SOURCE_DIR || exit 1 cd $CCMIO_SOURCE_DIR || exit 1
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo export GIT_DIR=$PWD/.git # Mask seeing our own git-repo
incDIR=$CCMIO_ARCH_PATH/include/libccmio rm -rf $CCMIO_ARCH_PATH
libDIR=$CCMIO_ARCH_PATH/lib rm -f $FOAM_EXT_LIBBIN/libccmio.so
mkdir -p $incDIR 2>/dev/null libdir=$CCMIO_ARCH_PATH/lib
mkdir -p $libDIR 2>/dev/null
cpMakeFiles libccmio 2>/dev/null cpMakeFiles libccmio 2>/dev/null
# Place static libraries in sub-directory: # Place static libraries in sub-directory:
if [ "$targetType" = lib ] if [ "$targetType" = lib ]
then then
export FOAM_EXT_LIBBIN=$libDIR mkdir -m 0755 -p $libdir 2>/dev/null
export FOAM_EXT_LIBBIN=$libdir
fi fi
if wmake $targetType wmake -j $WM_NCOMPPROCS -s $targetType \
then && echo "Built: ccmio" \
# Make headers available: && install
/bin/cp -pv libccmio/ccmio*.h $incDIR ) || {
fi echo "Error building: ccmio"
) exit 1
}
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -44,8 +44,8 @@ then
dir="$2" # <- CGAL_ARCH_PATH dir="$2" # <- CGAL_ARCH_PATH
if [ -d "$dir/include" -a -r "$dir/lib$WM_COMPILER_LIB_ARCH/libCGAL.so" ] if [ -d "$dir/include" -a -r "$dir/lib$WM_COMPILER_LIB_ARCH/libCGAL.so" ]
then then
echo " CGAL headers in $dir/include" echo " CGAL include: $dir/include"
echo " CGAL libs in $dir/lib$WM_COMPILER_LIB_ARCH" echo " CGAL library: $dir/lib$WM_COMPILER_LIB_ARCH"
# Additional information about boost # Additional information about boost
dir="$3" # <- BOOST_ARCH_PATH dir="$3" # <- BOOST_ARCH_PATH
for root in "$dir" /usr for root in "$dir" /usr
@ -53,8 +53,8 @@ then
if [ -d "$root/include/boost" \ if [ -d "$root/include/boost" \
-a -r "$root/lib$WM_COMPILER_LIB_ARCH/libboost_system.so" ] -a -r "$root/lib$WM_COMPILER_LIB_ARCH/libboost_system.so" ]
then then
echo " BOOST headers in $root/include" echo " boost include: $root/include"
echo " BOOST libs in $root/lib$WM_COMPILER_LIB_ARCH" echo " boost library: $root/lib$WM_COMPILER_LIB_ARCH"
break break
fi fi
done done

View File

@ -38,8 +38,8 @@ then
dir="$2" # <- FFTW_ARCH_PATH dir="$2" # <- FFTW_ARCH_PATH
if [ -d "$dir/include" -a -r "$dir/lib$WM_COMPILER_LIB_ARCH/libfftw3.so" ] if [ -d "$dir/include" -a -r "$dir/lib$WM_COMPILER_LIB_ARCH/libfftw3.so" ]
then then
echo " FFTW headers in $dir/include" echo " fftw include: $dir/include"
echo " FFTW libs in $dir/lib$WM_COMPILER_LIB_ARCH" echo " fftw library: $dir/lib$WM_COMPILER_LIB_ARCH"
exit 0 exit 0
else else
exit 2 exit 2

205
makeKAHIP Executable file
View File

@ -0,0 +1,205 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
#
# OpenFOAM is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# makeKAHIP
#
# Description
# Build the KaHIP library (int32 only).
#
# ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------
# Short-circuit test for an installation
if [ "$1" = "-test" ]
then
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; }
dir="$2" # <- KAHIP_ARCH_PATH
if [ -d "$dir/include" ]
then
for lib in \
$FOAM_EXT_LIBBIN/libkahip.so \
$dir/lib/libkahip.a \
$dir/lib/libkahip.so \
$dir/lib$WM_COMPILER_LIB_ARCH/libkahip.a \
$dir/lib$WM_COMPILER_LIB_ARCH/libkahip.so \
;
do
if [ -r "$lib" ]
then
echo " kahip include: $dir/include"
echo " kahip library: ${lib%/*}"
exit 0
fi
done
fi
exit 2
fi
#------------------------------------------------------------------------------
# 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
#------------------------------------------------------------------------------
_foamEtc config.sh/kahip
kahipPACKAGE=${KAHIP_VERSION:-kahip-system}
targetType=libso
#------------------------------------------------------------------------------
usage()
{
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
/bin/cat<<USAGE
Usage: ${0##*/} [OPTION] [lib|libso] [kahip-VERSION]
options:
-gcc Force gcc/g++ instead of the values from \$WM_CC, \$WM_CXX
-help
* Compile KaHIP
$kahipPACKAGE
USAGE
exit 1
}
#------------------------------------------------------------------------------
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
'') ;; # Ignore empty
-h | -help) usage ;;
-gcc) useGcc ;;
lib|libso)
targetType="$1"
;;
kahip-[1-9]* | kahip-git)
kahipPACKAGE="${1%%/}"
unset KAHIP_ARCH_PATH # Avoid inconsistency
;;
*)
die "unknown option/argument: '$1'"
;;
esac
shift
done
[ -n "$kahipPACKAGE" ] || die "The kahip-VERSION was not specified"
# Nothing to build
if _foamIsNone $kahipPACKAGE
then
echo "Using kahip-none (skip ThirdParty build of KAHIP)"
exit 0
elif _foamIsSystem $kahipPACKAGE
then
echo "Using kahip-system"
exit 0
fi
#------------------------------------------------------------------------------
#
# Build KaHIP
#
# KAHIP_ARCH_PATH : installation directory
# KAHIP_SOURCE_DIR : location of the original sources
KAHIP_SOURCE_DIR=$sourceBASE/$kahipPACKAGE
KAHIP_ARCH_PATH=$installBASE/$kahipPACKAGE
[ -d "$KAHIP_SOURCE_DIR" ] || {
echo "Missing sources: '$kahipPACKAGE'"
exit 1
}
#
# Manual installation
#
install()
{
# Ensure a clean build next time
wclean
local bindir=$KAHIP_ARCH_PATH/bin
local incdir=$KAHIP_ARCH_PATH/include
local libdir=$KAHIP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
mkdir -m 0755 -p $incdir
/bin/cp -pv \
$KAHIP_SOURCE_DIR/interface/kaHIP_interface.h \
$incdir
}
echo "Starting build: $kahipPACKAGE ($targetType)"
echo
(
cd $KAHIP_SOURCE_DIR/lib || exit 1
export GIT_DIR=$KAHIP_SOURCE_DIR/.git # Mask seeing our own git-repo
rm -rf $KAHIP_ARCH_PATH
rm -f $FOAM_EXT_LIBBIN/libkahip.so
libdir=$KAHIP_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
cpMakeFiles kahip 2>/dev/null
if [ -e ../interface -a ! -e interface ]
then
ln -s ../interface interface
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 \
&& echo "Built: kahip" \
&& install
) || {
echo "Error building: kahip"
exit 1
}
#------------------------------------------------------------------------------

201
makeMETIS Executable file
View File

@ -0,0 +1,201 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM.
#
# OpenFOAM is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# makeMETIS
#
# Description
# Build script for METIS
#
# ----------------------------------------------
# NO USER-CONFIGURABLE SETTINGS WITHIN THIS FILE
#------------------------------------------------------------------------------
# Short-circuit test for an installation
if [ "$1" = "-test" ]
then
[ "$#" -eq 2 ] || { echo "${0##*/} -test : needs 1 argument"; exit 1; }
dir="$2" # <- METIS_ARCH_PATH
if [ -d "$dir/include" ]
then
for lib in \
$FOAM_EXT_LIBBIN/libmetis.so \
$dir/lib/libmetis.a \
$dir/lib/libmetis.so \
$dir/lib$WM_COMPILER_LIB_ARCH/libmetis.a \
$dir/lib$WM_COMPILER_LIB_ARCH/libmetis.so \
;
do
if [ -r "$lib" ]
then
echo " metis include: $dir/include"
echo " metis library: ${lib%/*}"
exit 0
fi
done
fi
exit 2
fi
#------------------------------------------------------------------------------
# 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
#------------------------------------------------------------------------------
_foamEtc config.sh/metis
metisPACKAGE=${METIS_VERSION:-metis-system}
targetType=libso
#------------------------------------------------------------------------------
usage() {
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE
usage: ${0##*/} [OPTION] [lib|libso] [METIS-VERSION]
options:
-gcc Force gcc/g++ instead of the values from \$WM_CC, \$WM_CXX
-help
* build METIS with
${metisPACKAGE:-'unspecified metis version'}
USAGE
exit 1
}
#------------------------------------------------------------------------------
# Compiler settings for CMake/configure
[ -n "$WM_CC" ] && export CC="$WM_CC"
[ -n "$WM_CXX" ] && export CXX="$WM_CXX"
# Parse options
while [ "$#" -gt 0 ]
do
case "$1" in
'') ;; # Ignore empty
-h | -help) usage ;;
-gcc) useGcc ;;
lib|libso)
targetType="$1"
;;
metis-[0-9]*)
metisPACKAGE="${1%%/}"
unset METIS_ARCH_PATH # Avoid inconsistency
;;
*)
die "unknown option/argument: '$1'"
;;
esac
shift
done
[ -n "$metisPACKAGE" ] || die "The metis-VERSION was not specified"
# Nothing to build
if _foamIsNone $metisPACKAGE
then
echo "Using metis-none (skip ThirdParty build of METIS)"
exit 0
elif _foamIsSystem $metisPACKAGE
then
echo "Using metis-system"
exit 0
fi
#------------------------------------------------------------------------------
#
# Build METIS
#
# METIS_ARCH_PATH : installation directory
# METIS_SOURCE_DIR : location of the original sources
METIS_SOURCE_DIR=$sourceBASE/$metisPACKAGE
: ${METIS_ARCH_PATH:=$installBASE$WM_PRECISION_OPTION$WM_LABEL_OPTION/$metisPACKAGE}
[ -d "$METIS_SOURCE_DIR" ] || {
echo "Missing sources: '$metisPACKAGE'"
exit 1
}
#
# Manual installation (of library)
#
install()
{
local libdir=$METIS_ARCH_PATH/lib
if [ "$targetType" = libso ]
then
\mv $libdir/libmetis.so $FOAM_EXT_LIBBIN
rmdir $libdir 2>/dev/null # Failed rmdir is uncritical
echo "Installing: $FOAM_EXT_LIBBIN/libmetis.so"
fi
return 0
}
echo "Starting build: $metisPACKAGE ($targetType)"
echo
(
# Configuration options:
unset configOpt
if [ "$targetType" = libso ]
then
configOpt="shared=1"
fi
cd $METIS_SOURCE_DIR || exit 1
export GIT_DIR=$PWD/.git # Mask seeing our own git-repo
rm -rf $METIS_ARCH_PATH
rm -f $FOAM_EXT_LIBBIN/libmetis.so
# Adjust metis integer size to match OpenFOAM label-size
sed -i -e 's=\(#define IDXTYPEWIDTH\).*=\1 '$WM_LABEL_SIZE'=' \
include/metis.h
# No config option for the library location.
# - build normally and use mv to relocate it
make config $configOpt prefix=$METIS_ARCH_PATH \
&& make -j $WM_NCOMPPROCS install \
&& echo "Built: metis" \
&& install
) || {
echo "Error building: metis"
exit 1
}
#------------------------------------------------------------------------------

View File

@ -124,23 +124,23 @@ echo
# #
install() install()
{ {
echo "Install into $MGRIDGEN_ARCH_PATH" echo "Install into $MGRIDGEN_ARCH_PATH"
local bindir=$MGRIDGEN_ARCH_PATH/bin local bindir=$MGRIDGEN_ARCH_PATH/bin
local incdir=$MGRIDGEN_ARCH_PATH/include local incdir=$MGRIDGEN_ARCH_PATH/include
local libdir=$MGRIDGEN_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH local libdir=$MGRIDGEN_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH
for dir in $MGRIDGEN_ARCH_PATH $bindir $incdir $libdir for dir in $MGRIDGEN_ARCH_PATH $bindir $incdir $libdir
do do
mkdir -m 0755 -p $dir mkdir -m 0755 -p $dir
done done
cp -vf mgridgen.h $incdir cp -vf mgridgen.h $incdir
cp -vf libmgrid.a $libdir cp -vf libmgrid.a $libdir
cp -vf mgridgen $bindir cp -vf mgridgen $bindir
chmod -R 0644 $incdir/* $libdir/* chmod -R 0644 $incdir/* $libdir/*
chmod -R 0755 $bindir/* chmod -R 0755 $bindir/*
} }