Commit 4e161587 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

Merge branch 'feature/test_backends' into 'master'

Test all backends in gitlabci

Closes #16

See merge request !256
parents f6fb3225 a896e522
...@@ -15,18 +15,46 @@ dune-2.7: ...@@ -15,18 +15,46 @@ dune-2.7:
- duneci-standard-test - duneci-standard-test
- dunecontrol --current make -j2 examples - dunecontrol --current make -j2 examples
dune-git: dune-git-clang:
image: registry.dune-project.org/docker/ci/dune:git-debian-10-gcc-8-17 image: registry.dune-project.org/docker/ci/dune:git-ubuntu-18.04-clang-6-17
script:
- duneci-standard-test
- dunecontrol --current make -j2 examples
dune-git-istl-gcc:
image: registry.dune-project.org/docker/ci/dune-pdelab-deps:git-debian-10-gcc-8-17
variables:
DUNECI_CMAKE_FLAGS: "-DBACKEND=ISTL"
DUNECI_CXXFLAGS: "-Wno-deprecated-declarations -Wno-cpp"
script:
- duneci-standard-test
- dunecontrol --current make -j2 examples
dune-git-petsc-gcc:
image: registry.dune-project.org/docker/ci/dune-pdelab-deps:git-debian-10-gcc-8-17
variables:
DUNECI_CMAKE_FLAGS: "-DBACKEND=PETSC"
DUNECI_CXXFLAGS: "-Wno-deprecated-declarations -Wno-cpp"
script:
- duneci-standard-test
- dunecontrol --current make -j2 examples
dune-git-eigen-gcc:
image: registry.dune-project.org/docker/ci/dune-pdelab-deps:git-debian-10-gcc-8-17
variables: variables:
DUNECI_CMAKE_FLAGS: "-DBACKEND=EIGEN"
DUNECI_CXXFLAGS: "-Wno-deprecated-declarations -Wno-cpp" DUNECI_CXXFLAGS: "-Wno-deprecated-declarations -Wno-cpp"
script: script:
- duneci-standard-test - duneci-standard-test
- dunecontrol --current make -j2 examples - dunecontrol --current make -j2 examples
dune-git-full: dune-git-mtl-gcc:
image: registry.dune-project.org/docker/ci/dune-pdelab-deps:git-debian-10-gcc-8-17 image: registry.dune-project.org/docker/ci/dune-pdelab-deps:git-debian-10-gcc-8-17
variables: variables:
DUNECI_CMAKE_FLAGS: "-DBACKEND=MTL -DMTL_INCLUDE_DIR=/duneci/libs/mtl4"
DUNECI_CXXFLAGS: "-Wno-deprecated-declarations -Wno-cpp" DUNECI_CXXFLAGS: "-Wno-deprecated-declarations -Wno-cpp"
before_script:
- git clone https://gitlab.mn.tu-dresden.de/spraetor/mtl4.git /duneci/libs/mtl4
script: script:
- duneci-standard-test - duneci-standard-test
- dunecontrol --current make -j2 examples - dunecontrol --current make -j2 examples
...@@ -26,7 +26,6 @@ dune_target_link_libraries(amdis fmt) ...@@ -26,7 +26,6 @@ dune_target_link_libraries(amdis fmt)
if (MTL_FOUND) if (MTL_FOUND)
dune_target_link_libraries(amdis MTL::MTL) dune_target_link_libraries(amdis MTL::MTL)
target_compile_definitions(amdis PUBLIC ENABLE_MTL)
endif (MTL_FOUND) endif (MTL_FOUND)
if (HYPRE_FOUND) if (HYPRE_FOUND)
...@@ -36,14 +35,13 @@ endif(HYPRE_FOUND) ...@@ -36,14 +35,13 @@ endif(HYPRE_FOUND)
if (EIGEN3_FOUND) if (EIGEN3_FOUND)
dune_target_link_libraries(amdis Eigen3::Eigen) dune_target_link_libraries(amdis Eigen3::Eigen)
target_compile_definitions(amdis PUBLIC ENABLE_EIGEN)
endif (EIGEN3_FOUND) endif (EIGEN3_FOUND)
if (PETSc_FOUND) if (PETSc_FOUND)
dune_target_link_libraries(amdis PETSc::PETSc) dune_target_link_libraries(amdis PETSc::PETSc)
target_compile_definitions(amdis PUBLIC ENABLE_PETSC)
endif (PETSc_FOUND) endif (PETSc_FOUND)
option(ENABLE_ALL_WARNINGS "enable all meaningful warnings" OFF) option(ENABLE_ALL_WARNINGS "enable all meaningful warnings" OFF)
if (ENABLE_ALL_WARNINGS) if (ENABLE_ALL_WARNINGS)
target_compile_options(amdis PUBLIC "-Wall" "-Wpedantic" target_compile_options(amdis PUBLIC "-Wall" "-Wpedantic"
......
#pragma once #pragma once
#if AMDIS_HAS_MTL #if AMDIS_BACKEND == AMDIS_BACKEND_MTL
#include <amdis/linearalgebra/mtl/Constraints.hpp> #include <amdis/linearalgebra/mtl/Constraints.hpp>
#include <amdis/linearalgebra/mtl/ITL_Solver.hpp> #include <amdis/linearalgebra/mtl/ITL_Solver.hpp>
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include <amdis/linearalgebra/mtl/MatrixBackend.hpp> #include <amdis/linearalgebra/mtl/MatrixBackend.hpp>
#include <amdis/linearalgebra/mtl/VectorBackend.hpp> #include <amdis/linearalgebra/mtl/VectorBackend.hpp>
#elif AMDIS_HAS_EIGEN #elif AMDIS_BACKEND == AMDIS_BACKEND_EIGEN
#include <amdis/linearalgebra/eigen/Constraints.hpp> #include <amdis/linearalgebra/eigen/Constraints.hpp>
#include <amdis/linearalgebra/eigen/SolverCreator.hpp> #include <amdis/linearalgebra/eigen/SolverCreator.hpp>
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include <amdis/linearalgebra/eigen/MatrixBackend.hpp> #include <amdis/linearalgebra/eigen/MatrixBackend.hpp>
#include <amdis/linearalgebra/eigen/VectorBackend.hpp> #include <amdis/linearalgebra/eigen/VectorBackend.hpp>
#elif AMDIS_HAS_PETSC #elif AMDIS_BACKEND == AMDIS_BACKEND_PETSC
#include <amdis/linearalgebra/petsc/Constraints.hpp> #include <amdis/linearalgebra/petsc/Constraints.hpp>
#include <amdis/linearalgebra/petsc/SolverCreator.hpp> #include <amdis/linearalgebra/petsc/SolverCreator.hpp>
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <amdis/linearalgebra/petsc/MatrixBackend.hpp> #include <amdis/linearalgebra/petsc/MatrixBackend.hpp>
#include <amdis/linearalgebra/petsc/VectorBackend.hpp> #include <amdis/linearalgebra/petsc/VectorBackend.hpp>
#else // ISTL #elif AMDIS_BACKEND == AMDIS_BACKEND_ISTL
#include <amdis/linearalgebra/istl/Constraints.hpp> #include <amdis/linearalgebra/istl/Constraints.hpp>
#include <amdis/linearalgebra/istl/ISTLSolver.hpp> #include <amdis/linearalgebra/istl/ISTLSolver.hpp>
......
...@@ -9,12 +9,19 @@ endif () ...@@ -9,12 +9,19 @@ endif ()
if (NOT BACKEND) if (NOT BACKEND)
set(BACKEND "ISTL" CACHE STRING "LinearAlgebra backend. One of MTL, EIGEN, PETSC, ISTL") set(BACKEND "ISTL" CACHE STRING "LinearAlgebra backend. One of MTL, EIGEN, PETSC, ISTL")
set_property(CACHE BACKEND PROPERTY STRINGS "MTL" "EIGEN" "ISTL" "PETSC") set_property(CACHE BACKEND PROPERTY STRINGS "MTL" "EIGEN" "PETSC" "ISTL")
endif (NOT BACKEND) endif (NOT BACKEND)
if (BACKEND STREQUAL "MTL" OR BACKEND STREQUAL "MTL4") if (BACKEND STREQUAL "ISTL")
set(AMDIS_BACKEND 1)
if (NOT dune-istl_FOUND)
message(FATAL_ERROR "Need dune-istl for backend ISTL. Either install the dune-istl module, or change the BACKEND!")
endif ()
elseif (BACKEND STREQUAL "MTL" OR BACKEND STREQUAL "MTL4")
find_package(MTL REQUIRED) find_package(MTL REQUIRED)
set(AMDIS_HAS_MTL TRUE) set(AMDIS_HAS_MTL TRUE)
set(AMDIS_BACKEND 2)
find_package(HYPRE) find_package(HYPRE)
set(AMDIS_HAS_HYPRE ${HYPRE_FOUND}) set(AMDIS_HAS_HYPRE ${HYPRE_FOUND})
...@@ -22,16 +29,14 @@ if (BACKEND STREQUAL "MTL" OR BACKEND STREQUAL "MTL4") ...@@ -22,16 +29,14 @@ if (BACKEND STREQUAL "MTL" OR BACKEND STREQUAL "MTL4")
elseif (BACKEND STREQUAL "EIGEN" OR BACKEND STREQUAL "EIGEN3") elseif (BACKEND STREQUAL "EIGEN" OR BACKEND STREQUAL "EIGEN3")
find_package(Eigen3 REQUIRED 3.3.5) find_package(Eigen3 REQUIRED 3.3.5)
set(AMDIS_HAS_EIGEN TRUE) set(AMDIS_HAS_EIGEN TRUE)
set(AMDIS_BACKEND 3)
message(STATUS " Found Eigen3, version: ${Eigen3_VERSION}") message(STATUS " Found Eigen3, version: ${Eigen3_VERSION}")
elseif (BACKEND STREQUAL "PETSC") elseif (BACKEND STREQUAL "PETSC")
find_package(PETSc REQUIRED) find_package(PETSc REQUIRED)
set(AMDIS_HAS_PETSC TRUE) set(AMDIS_HAS_PETSC TRUE)
set(AMDIS_BACKEND 4)
elseif (BACKEND STREQUAL "ISTL")
if (NOT dune-istl_FOUND)
message(FATAL_ERROR "Need dune-istl, MTL, PETSc, or Eigen3 as linear algebra backend. Change flag BACKEND!")
endif ()
else () else ()
message(FATAL_ERROR "BACKEND must be one of MTL, EIGEN, PETSC, ISTL") message(FATAL_ERROR "BACKEND must be one of MTL, EIGEN, PETSC, ISTL, ISTL_BLOCKED")
endif () endif ()
...@@ -52,6 +52,14 @@ ...@@ -52,6 +52,14 @@
/* Define to true if the PETSc library is available */ /* Define to true if the PETSc library is available */
#cmakedefine AMDIS_HAS_PETSC 1 #cmakedefine AMDIS_HAS_PETSC 1
#define AMDIS_BACKEND_ISTL 1
#define AMDIS_BACKEND_MTL 2
#define AMDIS_BACKEND_EIGEN 3
#define AMDIS_BACKEND_PETSC 4
/* Define one of the IDs defined above representing the AMDiS backend*/
#define AMDIS_BACKEND @AMDIS_BACKEND@
/* some detected compiler features may be used in AMDiS */ /* some detected compiler features may be used in AMDiS */
#cmakedefine AMDIS_HAS_EXPANSION_STATEMENTS 1 #cmakedefine AMDIS_HAS_EXPANSION_STATEMENTS 1
......
...@@ -299,6 +299,7 @@ void test2(Grid& grid, BasisFactory&& basis) ...@@ -299,6 +299,7 @@ void test2(Grid& grid, BasisFactory&& basis)
template <class GridView> template <class GridView>
void test3(GridView const& gridView) void test3(GridView const& gridView)
{ {
#if AMDIS_BACKEND == AMDIS_BACKEND_ISTL
using namespace Dune::Functions::BasisFactory; using namespace Dune::Functions::BasisFactory;
auto blockedBasis = makeBasis(gridView, power<2>(lagrange<2>())); auto blockedBasis = makeBasis(gridView, power<2>(lagrange<2>()));
...@@ -315,6 +316,7 @@ void test3(GridView const& gridView) ...@@ -315,6 +316,7 @@ void test3(GridView const& gridView)
ISTLBlockVector<double> vec4(flatBasis); ISTLBlockVector<double> vec4(flatBasis);
DiscreteFunction u4{vec4, flatBasis}; DiscreteFunction u4{vec4, flatBasis};
#endif
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment