From ab0274b236bcabbe9dc6e081abe91b8da21cef00 Mon Sep 17 00:00:00 2001 From: Pratik Nayak Date: Sat, 19 Dec 2020 12:11:42 +0100 Subject: [PATCH] Update Ginkgo cmake detection and tests. --- cmake/configure/configure_2_ginkgo.cmake | 19 --------- cmake/modules/FindGINKGO.cmake | 49 +++++------------------- tests/ginkgo/solver.cc | 4 +- tests/ginkgo/solver.output | 2 +- 4 files changed, 12 insertions(+), 62 deletions(-) diff --git a/cmake/configure/configure_2_ginkgo.cmake b/cmake/configure/configure_2_ginkgo.cmake index 32e912e8e7..c2a1950cbc 100644 --- a/cmake/configure/configure_2_ginkgo.cmake +++ b/cmake/configure/configure_2_ginkgo.cmake @@ -17,23 +17,4 @@ # Configuration for the Ginkgo library: # -MACRO(FEATURE_GINKGO_ERROR_MESSAGE) - MESSAGE(FATAL_ERROR "\n" - "Could not find Ginkgo and supporting libraries!\n" - "Please ensure that the libraries are installed on your computer.\n" - "If the libraries are not at a default location, either provide some hints\n" - "for the autodetection:\n" - " $ GINKGO_DIR=\"...\" cmake <...>\n" - " $ cmake -DGINKGO_DIR=\"...\" <...>\n" - "or set the relevant variables by hand in ccmake.\n" - "Relevant hints for GINKGO are GINKGO_DIR.\n" - ) -ENDMACRO() - -MACRO(FEATURE_GINKGO_CONFIGURE_EXTERNAL) - SET(DEAL_II_GINKGO_BUILT_REFERENCE ${GINKGO_BUILT_REFERENCE}) - SET(DEAL_II_GINKGO_BUILT_OPENMP ${GINKGO_BUILT_OMP}) - SET(DEAL_II_GINKGO_BUILT_CUDA ${GINKGO_BUILT_CUDA}) -ENDMACRO() - CONFIGURE_FEATURE(GINKGO) diff --git a/cmake/modules/FindGINKGO.cmake b/cmake/modules/FindGINKGO.cmake index 66fe7357ba..a81b5cfbd6 100644 --- a/cmake/modules/FindGINKGO.cmake +++ b/cmake/modules/FindGINKGO.cmake @@ -19,54 +19,23 @@ # This module exports # # GINKGO_INCLUDE_DIRS +# GINKGO_INTERFACE_LINK_FLAGS # SET(GINKGO_DIR "" CACHE PATH "An optional hint to a GINKGO installation") SET_IF_EMPTY(GINKGO_DIR "$ENV{GINKGO_DIR}") -DEAL_II_FIND_LIBRARY(GINKGO_LIBRARY - NAMES ginkgo - HINTS ${GINKGO_DIR} - PATH_SUFFIXES - lib${LIB_SUFFIX} lib64 lib - # This is a hint, isn't it? - build/${CMAKE_CXX_PLATFORM_ID}-${CMAKE_SYSTEM_PROCESSOR}/libginkgo - ) -DEAL_II_FIND_LIBRARY(GINKGO_REFERENCE_LIBRARY - NAMES ginkgo_reference - HINTS ${GINKGO_DIR} - PATH_SUFFIXES - lib${LIB_SUFFIX} lib64 lib - # This is a hint, isn't it? - build/${CMAKE_CXX_PLATFORM_ID}-${CMAKE_SYSTEM_PROCESSOR}/libginkgo_reference - ) -DEAL_II_FIND_LIBRARY(GINKGO_OMP_LIBRARY - NAMES ginkgo_omp - HINTS ${GINKGO_DIR} - PATH_SUFFIXES - lib${LIB_SUFFIX} lib64 lib - # This is a hint, isn't it? - build/${CMAKE_CXX_PLATFORM_ID}-${CMAKE_SYSTEM_PROCESSOR}/libginkgo_omp - ) -DEAL_II_FIND_LIBRARY(GINKGO_CUDA_LIBRARY - NAMES ginkgo_cuda - HINTS ${GINKGO_DIR} - PATH_SUFFIXES - lib${LIB_SUFFIX} lib64 lib - # This is a hint, isn't it? - build/${CMAKE_CXX_PLATFORM_ID}-${CMAKE_SYSTEM_PROCESSOR}/libginkgo_cuda - ) - -DEAL_II_FIND_PATH(GINKGO_INCLUDE_DIR ginkgo/ginkgo.hpp - HINTS ${GINKGO_DIR} - PATH_SUFFIXES include +find_package(Ginkgo + HINTS ${GINKGO_DIR} ${Ginkgo_DIR} $ENV{Ginkgo_DIR} ) DEAL_II_PACKAGE_HANDLE(GINKGO LIBRARIES - REQUIRED GINKGO_LIBRARY GINKGO_REFERENCE_LIBRARY GINKGO_OMP_LIBRARY GINKGO_CUDA_LIBRARY - INCLUDE_DIRS REQUIRED GINKGO_INCLUDE_DIR - USER_INCLUDE_DIRS REQUIRED GINKGO_INCLUDE_DIR + REQUIRED GINKGO_INTERFACE_LINK_FLAGS + INCLUDE_DIRS + REQUIRED GINKGO_INSTALL_INCLUDE_DIR + USER_INCLUDE_DIRS + REQUIRED GINKGO_INSTALL_INCLUDE_DIR CLEAR - GINKGO_LIBRARY GINKGO_REFERENCE_LIBRARY GINKGO_OMP_LIBRARY GINKGO_CUDA_LIBRARY GINKGO_INCLUDE_DIR + GINKGO_INSTALL_INCLUDE_DIR GINKGO_INTERFACE_LINK_FLAGS ) diff --git a/tests/ginkgo/solver.cc b/tests/ginkgo/solver.cc index ff7af116a1..b8f69375dc 100644 --- a/tests/ginkgo/solver.cc +++ b/tests/ginkgo/solver.cc @@ -101,8 +101,8 @@ main(int argc, char **argv) u = 0.; check_solver_within_range(gmres_solver.solve(A, u, f), control.last_step(), - 23, - 29); + 20, + 49); u = 0.; check_solver_within_range(ir_solver_cg.solve(A, u, f), control.last_step(), diff --git a/tests/ginkgo/solver.output b/tests/ginkgo/solver.output index dda157582e..631b3778ff 100644 --- a/tests/ginkgo/solver.output +++ b/tests/ginkgo/solver.output @@ -4,6 +4,6 @@ DEAL::Solver stopped within 35 - 39 iterations DEAL::Solver stopped within 53 - 65 iterations DEAL::Solver stopped within 72 - 79 iterations DEAL::Solver stopped within 33 - 39 iterations -DEAL::Solver stopped within 23 - 29 iterations +DEAL::Solver stopped within 20 - 49 iterations DEAL::Solver stopped within 0 - 2 iterations DEAL::Solver stopped within 29 - 33 iterations -- 2.39.5