From 491b3390bb3b024354c46563a5a6ab4fea380f45 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Wed, 11 Oct 2017 09:50:16 +0200 Subject: [PATCH] ENH: add build scripts for KaHIP and METIS --- Allclean | 13 +++ Allwmake | 78 ++++++-------- BUILD.md | 54 ++++++---- etc/makeFiles/kahip/files | 70 ++++++++++++ etc/makeFiles/kahip/options | 14 +++ makeCCMIO | 41 ++++++-- makeCGAL | 8 +- makeFFTW | 4 +- makeKAHIP | 205 ++++++++++++++++++++++++++++++++++++ makeMETIS | 201 +++++++++++++++++++++++++++++++++++ makeMGridGen | 26 ++--- 11 files changed, 622 insertions(+), 92 deletions(-) create mode 100644 etc/makeFiles/kahip/files create mode 100644 etc/makeFiles/kahip/options create mode 100755 makeKAHIP create mode 100755 makeMETIS diff --git a/Allclean b/Allclean index b50475c..429a3f5 100755 --- a/Allclean +++ b/Allclean @@ -94,6 +94,19 @@ do 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 if [ -d build ] then diff --git a/Allwmake b/Allwmake index 6546e15..ce04428 100755 --- a/Allwmake +++ b/Allwmake @@ -65,8 +65,7 @@ warnBuildIssues() warnNotFound() { - echo " Optional component ($1) was not found" - echo + echo "Optional component ($1) was not found" } #------------------------------------------------------------------------------ @@ -101,7 +100,7 @@ fi echo echo ======================================== -echo "Build Scotch decomposition library $SCOTCH_VERSION" +echo "Scotch decomposition ($SCOTCH_VERSION)" echo " $SCOTCH_ARCH_PATH" 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/libscotcherrexit.so ] then - echo " scotch header in $SCOTCH_ARCH_PATH/include" - echo " scotch libs in $FOAM_EXT_LIBBIN" + echo " scotch include: $SCOTCH_ARCH_PATH/include" + echo " scotch library: $FOAM_EXT_LIBBIN" elif [ -d "$SCOTCH_SOURCE_DIR" ] then ( @@ -176,15 +175,15 @@ if [ "${FOAM_MPI:-dummy}" != dummy ] && \ then 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" 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/libptscotcherrexit.so ] then - echo " ptscotch header in $SCOTCH_ARCH_PATH/include/$FOAM_MPI" - echo " ptscotch libs in $FOAM_EXT_LIBBIN/$FOAM_MPI" + echo " ptscotch include: $SCOTCH_ARCH_PATH/include/$FOAM_MPI" + echo " ptscotch library: $FOAM_EXT_LIBBIN/$FOAM_MPI" else ( cd $SCOTCH_SOURCE_DIR/src || exit 1 @@ -239,55 +238,46 @@ fi #------------------------------------------------------------------------------ -# Metis is optional echo echo ======================================== -echo Build Metis decomposition - -# Get METIS_VERSION, METIS_ARCH_PATH -if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/metis) +# Get KAHIP_ARCH_PATH +if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/kahip) then . $settings fi - -METIS_SOURCE_DIR=$sourceBASE/$METIS_VERSION - -if [ -f $METIS_ARCH_PATH/include/metis.h \ - -a -r $FOAM_EXT_LIBBIN/libmetis.so ] +if [ -n "$KAHIP_ARCH_PATH" ] then - echo " metis header in $METIS_ARCH_PATH/include" - echo " metis libs in $FOAM_EXT_LIBBIN" -elif [ -d "$METIS_SOURCE_DIR" ] -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 + echo KaHIP decomposition + ./makeKAHIP -test "$KAHIP_ARCH_PATH" || \ + ./makeKAHIP || warnBuildIssues KAHIP 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 - #------------------------------------------------------------------------------ echo echo ======================================== -echo Build CGAL if [ -n "$CGAL_ARCH_PATH" ] then + echo "CGAL/boost" ./makeCGAL -test "$CGAL_ARCH_PATH" "$BOOST_ARCH_PATH" || \ ./makeCGAL || warnBuildIssues CGAL else @@ -296,9 +286,9 @@ fi echo echo ======================================== -echo Build FFTW if [ -n "$FFTW_ARCH_PATH" ] then + echo FFTW ./makeFFTW -test "$FFTW_ARCH_PATH" || \ ./makeFFTW || warnBuildIssues FFTW else diff --git a/BUILD.md b/BUILD.md index b66b633..751c7c6 100644 --- a/BUILD.md +++ b/BUILD.md @@ -109,7 +109,7 @@ ThirdParty components prior to building OpenFOAM itself. - This will be automatically invoked by the top-level OpenFOAM `Allwmake`, but can also be invoked directly to find possible build errors. - 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)* - This is optional, but extremely useful for visualization and for run-time post-processing function objects. @@ -122,16 +122,26 @@ ThirdParty components prior to building OpenFOAM itself. #### Optional Components `makeADIOS` -- Only required for ADIOS support, +- Only required for [ADIOS](#parallel) support, which is currently staged in the [add-ons repository][link AddOns]. `makeCGAL` -- Builds third-party boost and CGAL. +- Builds [boost](#general-packages) and [CGAL](#general-packages). Automatically invoked from the ThirdParty `Allwmake`, but can be invoked directly to resolve possible build errors. `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`, but can be invoked directly to resolve possible build errors. @@ -147,11 +157,11 @@ ThirdParty components prior to building OpenFOAM itself. `makeMesa`, `makeVTK` - Additional support for building offscreen rendering components. 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. `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`. - The associated `etc/relocateQt` may be of independent use. 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] -### Parallel Processing - -| 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 | 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] +### Parallel Processing + +| 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 | Name | Location @@ -405,6 +417,12 @@ The minimum gcc/g++ requirements for building various components. [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 +[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/ [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 @@ -452,7 +470,7 @@ The minimum gcc/g++ requirements for building various components. [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 @@ -460,8 +478,8 @@ The minimum gcc/g++ requirements for building various components. - [Community AddOns][link AddOns] repository - [Collaborative and Community-based Developments][link community-projects] -- [Download](http://www.openfoam.com/releases) and - [installation instructions](http://www.openfoam.com/download/installation.php) +- [Download](http://www.openfoam.com/download) and + [installation instructions](http://www.openfoam.com/code/build-guide.php) - [Documentation](http://www.openfoam.com/documentation) - [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) diff --git a/etc/makeFiles/kahip/files b/etc/makeFiles/kahip/files new file mode 100644 index 0000000..9ecb867 --- /dev/null +++ b/etc/makeFiles/kahip/files @@ -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 diff --git a/etc/makeFiles/kahip/options b/etc/makeFiles/kahip/options new file mode 100644 index 0000000..3c0ce03 --- /dev/null +++ b/etc/makeFiles/kahip/options @@ -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 = diff --git a/makeCCMIO b/makeCCMIO index 2e1b976..64e48a8 100755 --- a/makeCCMIO +++ b/makeCCMIO @@ -111,29 +111,48 @@ CCMIO_ARCH_PATH=$installBASE/$ccmioPACKAGE # Sources must be available [ -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 export GIT_DIR=$PWD/.git # Mask seeing our own git-repo - incDIR=$CCMIO_ARCH_PATH/include/libccmio - libDIR=$CCMIO_ARCH_PATH/lib + rm -rf $CCMIO_ARCH_PATH + rm -f $FOAM_EXT_LIBBIN/libccmio.so - mkdir -p $incDIR 2>/dev/null - mkdir -p $libDIR 2>/dev/null + libdir=$CCMIO_ARCH_PATH/lib cpMakeFiles libccmio 2>/dev/null # Place static libraries in sub-directory: if [ "$targetType" = lib ] then - export FOAM_EXT_LIBBIN=$libDIR + mkdir -m 0755 -p $libdir 2>/dev/null + export FOAM_EXT_LIBBIN=$libdir fi - if wmake $targetType - then - # Make headers available: - /bin/cp -pv libccmio/ccmio*.h $incDIR - fi -) + wmake -j $WM_NCOMPPROCS -s $targetType \ + && echo "Built: ccmio" \ + && install +) || { + echo "Error building: ccmio" + exit 1 +} #------------------------------------------------------------------------------ diff --git a/makeCGAL b/makeCGAL index 7c27be6..b2260c7 100755 --- a/makeCGAL +++ b/makeCGAL @@ -44,8 +44,8 @@ then dir="$2" # <- CGAL_ARCH_PATH if [ -d "$dir/include" -a -r "$dir/lib$WM_COMPILER_LIB_ARCH/libCGAL.so" ] then - echo " CGAL headers in $dir/include" - echo " CGAL libs in $dir/lib$WM_COMPILER_LIB_ARCH" + echo " CGAL include: $dir/include" + echo " CGAL library: $dir/lib$WM_COMPILER_LIB_ARCH" # Additional information about boost dir="$3" # <- BOOST_ARCH_PATH for root in "$dir" /usr @@ -53,8 +53,8 @@ then if [ -d "$root/include/boost" \ -a -r "$root/lib$WM_COMPILER_LIB_ARCH/libboost_system.so" ] then - echo " BOOST headers in $root/include" - echo " BOOST libs in $root/lib$WM_COMPILER_LIB_ARCH" + echo " boost include: $root/include" + echo " boost library: $root/lib$WM_COMPILER_LIB_ARCH" break fi done diff --git a/makeFFTW b/makeFFTW index dd8ea35..7f77cba 100755 --- a/makeFFTW +++ b/makeFFTW @@ -38,8 +38,8 @@ then dir="$2" # <- FFTW_ARCH_PATH if [ -d "$dir/include" -a -r "$dir/lib$WM_COMPILER_LIB_ARCH/libfftw3.so" ] then - echo " FFTW headers in $dir/include" - echo " FFTW libs in $dir/lib$WM_COMPILER_LIB_ARCH" + echo " fftw include: $dir/include" + echo " fftw library: $dir/lib$WM_COMPILER_LIB_ARCH" exit 0 else exit 2 diff --git a/makeKAHIP b/makeKAHIP new file mode 100755 index 0000000..b2eebbd --- /dev/null +++ b/makeKAHIP @@ -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 . +# +# 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</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 +} + + +#------------------------------------------------------------------------------ diff --git a/makeMETIS b/makeMETIS new file mode 100755 index 0000000..67793d3 --- /dev/null +++ b/makeMETIS @@ -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 . +# +# 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</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 +} + + +#------------------------------------------------------------------------------ diff --git a/makeMGridGen b/makeMGridGen index fdf395f..872680f 100755 --- a/makeMGridGen +++ b/makeMGridGen @@ -124,23 +124,23 @@ echo # install() { - echo "Install into $MGRIDGEN_ARCH_PATH" + echo "Install into $MGRIDGEN_ARCH_PATH" - local bindir=$MGRIDGEN_ARCH_PATH/bin - local incdir=$MGRIDGEN_ARCH_PATH/include - local libdir=$MGRIDGEN_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH + local bindir=$MGRIDGEN_ARCH_PATH/bin + local incdir=$MGRIDGEN_ARCH_PATH/include + local libdir=$MGRIDGEN_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH - for dir in $MGRIDGEN_ARCH_PATH $bindir $incdir $libdir - do - mkdir -m 0755 -p $dir - done + for dir in $MGRIDGEN_ARCH_PATH $bindir $incdir $libdir + do + mkdir -m 0755 -p $dir + done - cp -vf mgridgen.h $incdir - cp -vf libmgrid.a $libdir - cp -vf mgridgen $bindir + cp -vf mgridgen.h $incdir + cp -vf libmgrid.a $libdir + cp -vf mgridgen $bindir - chmod -R 0644 $incdir/* $libdir/* - chmod -R 0755 $bindir/* + chmod -R 0644 $incdir/* $libdir/* + chmod -R 0755 $bindir/* }