diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 69db3489dae34cace52ea0cacacf759b002f7a9b..b6abec079001611f50572c4e69065cb7501fec08 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,7 +6,6 @@ cache: before_script: - tools/install_boost.sh - - tools/install_petsc.sh build:9-debug-gcc: stage: build @@ -28,6 +27,7 @@ build:9-parallel-debug-gcc: stage: build image: duneci/base:9 script: + - tools/install_petsc.sh - tools/build_parallel_amdis.sh Debug only: - master @@ -36,6 +36,7 @@ build:9-parallel-release-gcc: stage: build image: duneci/base:9 script: + - tools/install_petsc.sh - tools/build_parallel_amdis.sh Release only: - master diff --git a/configure.sh b/configure.sh new file mode 100644 index 0000000000000000000000000000000000000000..e247723581a0c999b682a5e2a6104c81a2118fd6 --- /dev/null +++ b/configure.sh @@ -0,0 +1,316 @@ +#!/bin/bash + +AMDIS_VERSION="1.1" + +BUILD_DIR=$( pwd ) +SRC_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) + +# default parameters +INSTALL_PREFIX="/usr/local" +DEBUG="0" +VERBOSE="OFF" +ENABLE_EXTENSIONS="OFF" +ENABLE_UMFPACK="OFF" +ENABLE_COMPRESSION="OFF" +ENABLE_PARALLEL="OFF" +BOOST_PREFIX="${BOOST_ROOT}" +DOWNLOAD_BOOST="0" +BOOST_VERSION="1.62.0" +PETSC_PREFIX="${PETSC_DIR}" +DOWNLOAD_PETSC="0" +PETSC_VERSION="3.5.4" +PARMETIS_PREFIX="" +ZOLTAN_PREFIX="" +DOWNLOAD_ZOLTAN="0" +ZOLTAN_VERSION="3.83" + + +# a help message +help() { +cat << EOF +$(basename "$0") configures AMDiS, by calling the corresponding cmake commands. + +Usage: $(basename "$0") [OPTION]... [VAR=VALUE]... + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help Display this help and exit. + -V, --version Display version information of AMDiS and exit. + +Installation directories: + --prefix=PREFIX Install files in PREFIX [${INSTALL_PREFIX}] + +By default, 'make install' will install all the files in +'${INSTALL_PREFIX}/lib', '${INSTALL_PREFIX}/include' and '${INSTALL_PREFIX}/share'. +You can specify an installation prefix other than '${INSTALL_PREFIX}' using '--prefix', +for instance '--prefix=${HOME}/amdis'. + +Compile parameters: + --debug Compile without optimization and with debug information. + -v, --verbose Show additional information during the compile process. + +Optional Features: + --enable-extensions Compile and install sources from the extensions folder. + --enable-compression Compile with support for output compression. This + requires boost-iostreams with enabled ZLib and libbz2 + support. + --enable-parallel Compile the parallel version of AMDiS. Needs PETSc and + Parmetis. (see --with-petsc-dir, --with-parmetis-dir) + +Optional Packages: + --with-umfpack Adds support for the direct solver UMFPACK. + --with-suitesparse (see --with-umfpack) + + --with-boost-dir=DIR Sets the boost root directory. [${BOOST_PREFIX}] + --download-boost Download and install boost to '${SRC_DIR}/packages/boost'. + + --with-petsc-dir=DIR Sets the PETSc root directory, i.e. a directory + containing the folders 'lib/', 'include/' with e.g. + 'lib/libpetsc.so' [${PETSC_DIR}]. + --download-petsc Download and install petsc, version ${PETSC_VERSION}, + to '${SRC_DIR}/packages/petsc'. + --with-parmetis-dir=DIR Sets the PARMETIS root directory, i.e. a directory + containing the folders 'lib/', 'include/' with e.g. + 'include/parmetis.h' [=PETSC_DIR]. + + --with-zoltan Add support for the Parallel Partitioning suite Zoltan. + --with-zoltan-dir=DIR Sets the Zoltan root directory, i.e. a directory + containing the folders 'lib/', 'include/' with e.g. + 'include/zoltan_cpp.h' [${ZOLTAN_PREFIX}]. + --download-zoltan Download and install Zoltan, version ${ZOLTAN_VERSION}, + to '${SRC_DIR}/packages/zoltan'. + +Report bugs to <amdis.fem@gmail.com>. +EOF +} + +# parse command line +if [ $# -gt 0 ]; then + while [[ $1 = -* ]]; do + case "$1" in + -h|-\?|--help) + help + exit ;; + -V|--version) + echo "AMDiS v${AMDIS_VERSION}" + exit ;; + --prefix) + INSTALL_PREFIX="$2" + shift 2 ;; + --prefix=?*) + INSTALL_PREFIX="${1#*=}" + shift ;; + --prefix=) + printf 'ERROR: "--prefix" requires a non-empty option argument.\n' >&2 + exit 1 ;; + --debug) + DEBUG="1" + shift ;; + -v|--verbose) + VERBOSE="ON" + shift ;; + --enable-extensions) + ENABLE_EXTENSIONS="ON" + shift ;; + --enable-compression) + ENABLE_COMPRESSION="ON" + shift ;; + --enable-parallel) + ENABLE_PARALLEL="ON" + shift ;; + --with-umfpack|--with-suitesparse) + ENABLE_UMFPACK="ON" + shift ;; + --with-boost-dir) + BOOST_PREFIX="$2" + shift 2 ;; + --with-boost-dir=?*) + BOOST_PREFIX="${1#*=}" + shift ;; + --with-boost-dir=) + printf 'ERROR: "--with-boost-dir" requires a non-empty option argument.\n' >&2 + exit 1 ;; + --download-boost) + DOWNLOAD_BOOST="1" + shift ;; + --with-petsc-dir) + PETSC_PREFIX="$2" + shift 2 ;; + --with-petsc-dir=?*) + PETSC_PREFIX="${1#*=}" + shift ;; + --with-petsc-dir=) + printf 'ERROR: "--with-petsc-dir" requires a non-empty option argument.\n' >&2 + exit 1 ;; + --download-petsc) + DOWNLOAD_PETSC="1" + shift ;; + --with-parmetis-dir) + PARMETIS_PREFIX="$2" + shift 2 ;; + --with-parmetis-dir=?*) + PARMETIS_PREFIX="${1#*=}" + shift ;; + --with-parmetis-dir=) + printf 'ERROR: "--with-parmetis-dir" requires a non-empty option argument.\n' >&2 + exit 1 ;; + --with-zoltan) + ENABLE_ZOLTAN="ON" + shift ;; + --with-zoltan-dir) + ZOLTAN_PREFIX="$2" + shift 2 ;; + --with-zoltan-dir=?*) + ZOLTAN_PREFIX="${1#*=}" + shift ;; + --with-zoltan-dir=) + printf 'ERROR: "--with-zoltan-dir" requires a non-empty option argument.\n' >&2 + exit 1 ;; + --download-zoltan) + DOWNLOAD_ZOLTAN="1" + shift ;; + --) + shift + break ;; + -?*) + printf 'WARNING: Unknown option (ignored): %s\n' "$1" >&2 + shift ;; + *) + break + esac + + done +fi + +# Download and install boost +if [ "${DOWNLOAD_BOOST}" -eq "1" ]; then + BOOST_FILENAME="boost_${BOOST_VERSION//[.]/_}.tar.gz" + if [ ! -d /tmp/src/boost ]; then + mkdir -p /tmp/src/boost + curl -SL "http://netcologne.dl.sourceforge.net/project/boost/boost/${BOOST_VERSION}/${BOOST_FILENAME}" \ + | tar --strip-components=1 -xzC /tmp/src/boost + fi + + BOOST_PREFIX=${SRC_DIR}/packages/boost/${BOOST_VERSION} + + cd /tmp/src/boost + ./bootstrap.sh --prefix=${BOOST_PREFIX} --with-libraries=system,iostreams,filesystem,program_options,date_time,unit_test_framework + if [ "${ENABLE_COMPRESSION}" = "ON" ]; then + ./b2 -s cxxflags="-std=c++11" --build-type=minimal variant=release install + else + ./b2 -s NO_BZIP2=1 -s NO_ZLIB=1 cxxflags="-std=c++11" --build-type=minimal variant=release install + fi + rm -rf /tmp/src/boost +fi + + +# Download and install PETSc +if [ "${DOWNLOAD_PETSC}" -eq "1" ]; then + if [ ! -d /tmp/src/petsc ]; then + mkdir -p /tmp/src/petsc + curl -SL "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-${PETSC_VERSION}.tar.gz" \ + | tar --strip-components=1 -xzC /tmp/src/petsc + fi + + PETSC_PREFIX=${SRC_DIR}/packages/petsc/${PETSC_VERSION} + + if [ -n "${PARMETIS_PREFIX}" ]; then + PARMETIS_CONFIG="--with-parmetis-dir=${PARMETIS_PREFIX}" + else + PARMETIS_CONFIG="--download-parmetis=1" + fi + + # Install PETSc + cd /tmp/src/petsc + ./configure --prefix=${PETSC_PREFIX} --with-pic=1 \ + --with-debugging=${DEBUG} --with-clanguage=c++ \ + --with-metis=1 --download-metis=yes \ + --with-parmetis=1 ${PARMETIS_CONFIG} \ + --with-scalapack=1 --download-scalapack=yes \ + --with-hypre=1 --download-hypre=yes \ + --with-mumps=1 --download-mumps=yes \ + --with-fblaslapack=1 --download-fblaslapack=yes + make && make install + rm -rf /tmp/src/petsc +fi + + +# set parmetis dir, if not already set +if [ -z "${PARMETIS_PREFIX}" ]; then + PARMETIS_PREFIX="${PETSC_PREFIX}" +fi + + +if [ "${DEBUG}" -eq "0" ]; then + BUILD_TYPE="Release" + CXX_FLAGS="-O3" +else + BUILD_TYPE="Debug" + CXX_FLAGS="-g" +fi + + +# Download and install Zoltan +if [ "${DOWNLOAD_ZOLTAN}" -eq "1" ]; then + if [ ! -d /tmp/src/zoltan ]; then + mkdir -p /tmp/src/zoltan + curl -SL "http://www.cs.sandia.gov/~kddevin/Zoltan_Distributions/zoltan_distrib_v${ZOLTAN_VERSION}.tar.gz" \ + | tar --strip-components=1 -xC /tmp/src/zoltan + fi + + ZOLTAN_PREFIX=${SRC_DIR}/packages/zoltan + + # Install Zoltan + cd /tmp/src/zoltan + mkdir build && cd build + ../configure --prefix=${ZOLTAN_PREFIX} --enable-mpi \ + --enable-zoltan-cppdriver \ + --with-cxxflags="-std=c++11 -fpic" \ + --with-cflags="-fpic" --with-fcflags="-fpic" \ + --with-parmetis=yes --with-parmetis-libdir=${PARMETIS_PREFIX}/lib \ + --with-parmetis-incdir=${PARMETIS_PREFIX}/include + make && make install + rm -rf /tmp/src/zoltan +fi + + +if [ -n "${BOOST_PREFIX}" ]; then + BOOST_CONFIG="-DBOOST_ROOT:PATH=${BOOST_PREFIX}" +else + BOOST_CONFIG="" +fi + +# Install AMDiS +cd ${BUILD_DIR} +if [ "${ENABLE_PARALLEL}" = "OFF" ]; then + cmake -DENABLE_UMFPACK:BOOL=${ENABLE_UMFPACK} \ + -DCMAKE_BUILD_TYPE:String=${BUILD_TYPE} \ + -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_PREFIX} \ + -DCMAKE_CXX_FLAGS:STRING="${CXX_FLAGS}" \ + -DCMAKE_VERBOSE_MAKEFILE:BOOL=${VERBOSE} \ + -DENABLE_EXTENSIONS:BOOL=${ENABLE_EXTENSIONS} \ + -DENABLE_COMPRESSION:BOOL=${ENABLE_COMPRESSION} ${BOOST_CONFIG} \ + ${SRC_DIR}/AMDiS/ +else + cmake -DCMAKE_CXX_COMPILER=mpic++ \ + -DCMAKE_C_COMPILER=mpicc \ + -DCMAKE_BUILD_TYPE:String=${BUILD_TYPE} \ + -DCMAKE_INSTALL_PREFIX:PATH=${INSTALL_PREFIX} \ + -DCMAKE_CXX_FLAGS:STRING="${CXX_FLAGS}" \ + -DENABLE_EXTENSIONS:BOOL=${ENABLE_EXTENSIONS} \ + -DENABLE_COMPRESSION:BOOL=${ENABLE_COMPRESSION} \ + -DENABLE_UMFPACK:BOOL=${ENABLE_UMFPACK} \ + -DCMAKE_VERBOSE_MAKEFILE:BOOL=${VERBOSE} \ + -DENABLE_PARALLEL_DOMAIN:BOOL=ON \ + -DPETSC_DIR:PATH=${PETSC_PREFIX} \ + -DENABLE_ZOLTAN:BOOL=${ENABLE_ZOLTAN} \ + -DZOLTAN_DIR:PATH=${ZOLTAN_PREFIX} \ + -DPARMETIS_DIR:PATH=${PARMETIS_PREFIX} ${BOOST_CONFIG} \ + ${SRC_DIR}/AMDiS/ +fi + +if [ "$?" -eq "0" ]; then + echo "Compile and install the code with... +make && make install" +fi diff --git a/tools/build_amdis.sh b/tools/build_amdis.sh index efdea80b3317a5bf2041651b34fda48cbbfeb10d..2a656ae1be1f3bbe6c9a70fe6e76674320b2743d 100755 --- a/tools/build_amdis.sh +++ b/tools/build_amdis.sh @@ -10,9 +10,9 @@ if [ "$1" == "Debug" ]; then fi # at first build AMDiS +cmake -E remove_directory ${ROOT}/build_${POSTFIX} cmake -E make_directory ${ROOT}/build_${POSTFIX} cmake -E chdir ${ROOT}/build_${POSTFIX} cmake \ - -DUSE_NEW_CMAKE:BOOL=ON \ -DCMAKE_INSTALL_PREFIX=${ROOT}/install_${POSTFIX} \ -DCMAKE_BUILD_TYPE=${CONFIURATION} \ -DENABLE_CXX11:BOOL=ON \ @@ -20,10 +20,11 @@ cmake -E chdir ${ROOT}/build_${POSTFIX} cmake \ -DENABLE_UMFPACK:BOOL=OFF \ -DBOOST_ROOT:PATH=${ROOT}/install/boost \ ${ROOT}/AMDiS -cmake --build ${ROOT}/build_${POSTFIX} --target install +cmake --build ${ROOT}/build_${POSTFIX} --target install -- -j2 # now build the demos BASEDIR=${ROOT}/demo +cmake -E remove_directory ${BASEDIR}/build_${POSTFIX} cmake -E make_directory ${BASEDIR}/build_${POSTFIX} cmake -E chdir ${BASEDIR}/build_${POSTFIX} cmake \ -DAMDIS_DIR=${ROOT}/install_${POSTFIX}/share/amdis \ @@ -33,7 +34,8 @@ cmake -E chdir ${BASEDIR}/build_${POSTFIX} cmake \ cmake --build ${BASEDIR}/build_${POSTFIX} # now build and run the test_suite -BASEDIR=${ROOT}/tools/test_suite +BASEDIR=${ROOT}/test +cmake -E remove_directory ${BASEDIR}/build_${POSTFIX} cmake -E make_directory ${BASEDIR}/build_${POSTFIX} cmake -E chdir ${BASEDIR}/build_${POSTFIX} cmake \ -DAMDIS_DIR=${ROOT}/install_${POSTFIX}/share/amdis \ diff --git a/tools/build_parallel_amdis.sh b/tools/build_parallel_amdis.sh index c7fa5f56716fd54e46f082a56e9c2050de4bc1bc..98d0261b137b28511d25aab79e8f3dc3c324500a 100755 --- a/tools/build_parallel_amdis.sh +++ b/tools/build_parallel_amdis.sh @@ -13,9 +13,9 @@ if [ "$1" == "Debug" ]; then fi # at first build AMDiS +cmake -E remove_directory ${ROOT}/build_${POSTFIX} cmake -E make_directory ${ROOT}/build_${POSTFIX} cmake -E chdir ${ROOT}/build_${POSTFIX} cmake \ - -DUSE_NEW_CMAKE:BOOL=ON \ -DCMAKE_INSTALL_PREFIX=${ROOT}/install_${POSTFIX} \ -DCMAKE_BUILD_TYPE=${CONFIURATION} \ -DENABLE_CXX11:BOOL=ON \ @@ -25,10 +25,11 @@ cmake -E chdir ${ROOT}/build_${POSTFIX} cmake \ -DBOOST_ROOT:PATH=${ROOT}/install/boost \ -DPETSC_DIR:PATH=${ROOT}/install/petsc \ ${ROOT}/AMDiS -cmake --build ${ROOT}/build_${POSTFIX} --target install +cmake --build ${ROOT}/build_${POSTFIX} --target install -- -j2 # now build the demos BASEDIR=${ROOT}/demo +cmake -E remove_directory ${BASEDIR}/build_${POSTFIX} cmake -E make_directory ${BASEDIR}/build_${POSTFIX} cmake -E chdir ${BASEDIR}/build_${POSTFIX} cmake \ -DAMDIS_DIR=${ROOT}/install_${POSTFIX}/share/amdis \ @@ -39,7 +40,8 @@ cmake -E chdir ${BASEDIR}/build_${POSTFIX} cmake \ cmake --build ${BASEDIR}/build_${POSTFIX} # now build and run the test_suite -BASEDIR=${ROOT}/tools/test_suite +BASEDIR=${ROOT}/tests +cmake -E remove_directory ${BASEDIR}/build_${POSTFIX} cmake -E make_directory ${BASEDIR}/build_${POSTFIX} cmake -E chdir ${BASEDIR}/build_${POSTFIX} cmake \ -DAMDIS_DIR=${ROOT}/install_${POSTFIX}/share/amdis \ diff --git a/tools/install_boost.sh b/tools/install_boost.sh index 6bcfb1611458b5ac26389bf0e07f10153f2c128d..004d5972707a2c59c548a3c2d5b0cf54d569ff3e 100755 --- a/tools/install_boost.sh +++ b/tools/install_boost.sh @@ -5,20 +5,22 @@ set -x ROOT=${PWD} -if [ ! -d install/ ]; then - mkdir -p install -fi -cd install +BOOST_VERSION="1.62.0" +BOOST_FILENAME="boost_${BOOST_VERSION//[.]/_}.tar.gz" + +INSTALL_PREFIX=${ROOT}/install +mkdir -p ${INSTALL_PREFIX} -#install current boost version -if [ ! -d boost ]; then - curl -o boost.tar.gz "http://netcologne.dl.sourceforge.net/project/boost/boost/1.60.0/boost_1_60_0.tar.gz" - mkdir boost_tmp - tar --strip-components=1 -xf boost.tar.gz -C boost_tmp - rm boost.tar.gz - cd boost_tmp - ./bootstrap.sh --prefix=${ROOT}/install/boost --with-libraries=system,iostreams,filesystem,program_options,date_time - ./b2 -s NO_BZIP2=1 cxxflags="-std=c++11" --build-type=minimal install - cd ${ROOT}/install - rm -rf boost_tmp -fi \ No newline at end of file +BUILD_DIR=/tmp/$USER/boost_build +mkdir -p ${BUILD_DIR} + +# install boost +if [ ! -d ${INSTALL_PREFIX}/boost ]; then + curl -SL "http://netcologne.dl.sourceforge.net/project/boost/boost/${BOOST_VERSION}/${BOOST_FILENAME}" \ + | tar --strip-components=1 -xzC ${BUILD_DIR} + cd ${BUILD_DIR} + ./bootstrap.sh --prefix=${INSTALL_PREFIX}/boost/${BOOST_VERSION}/ \ + --with-libraries=system,iostreams,filesystem,program_options,date_time,unit_test_framework + ./b2 -s NO_BZIP2=1 cxxflags="-std=c++11" --build-type=minimal variant=release -j 4 install + rm -rf ${BUILD_DIR} +fi diff --git a/tools/install_petsc.sh b/tools/install_petsc.sh index bca6bde8d8c99b439497b561ccb01d3e8ed1f587..de9793cf4d228395cf5aee5182d0fc203ee80b37 100755 --- a/tools/install_petsc.sh +++ b/tools/install_petsc.sh @@ -5,25 +5,26 @@ set -x ROOT=${PWD} -if [ ! -d install/ ]; then - mkdir -p install -fi -cd install +PETSC_VERSION="3.5.4" +PETSC_FILENAME="petsc-lite-${PETSC_VERSION}.tar.gz" + +INSTALL_PREFIX=${ROOT}/install +mkdir -p ${INSTALL_PREFIX} + +BUILD_DIR=/tmp/$USER/petsc_build +mkdir -p ${BUILD_DIR} # install petsc -if [ ! -d petsc ]; then - curl -o petsc.tar.gz "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-lite-3.5.4.tar.gz" - mkdir petsc_tmp - tar --strip-components=1 -xf petsc.tar.gz -C petsc_tmp - rm petsc.tar.gz - cd petsc_tmp +if [ ! -d ${INSTALL_PREFIX}/petsc ]; then + curl -SL "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/${PETSC_FILENAME}" \ + | tar --strip-components=1 -xzC ${BUILD_DIR} + cd ${BUILD_DIR} # minimal petsc configuration, just for test purposes - ./configure --prefix=${ROOT}/install/petsc --with-pic=1 --with-debugging=0 \ - --with-clanguage=c++ --with-cxx-dialect=c++11 \ - --with-metis=1 --download-metis=yes \ - --with-parmetis=1 --download-parmetis=yes \ + ./configure --prefix=${INSTALL_PREFIX}/petsc/${PETSC_VERSION}/ --with-pic=1 \ + --with-clanguage=c++ --with-debugging=0 \ + --with-metis=1 --download-metis=yes \ + --with-parmetis=1 --download-parmetis=yes \ --with-fblaslapack=1 --download-fblaslapack=yes make && make install - cd ${ROOT}/install - rm -rf petsc_tmp + rm -rf ${BUILD_DIR} fi