From: Pratik Nayak Date: Wed, 30 Jan 2019 11:47:50 +0000 (+0100) Subject: Detect Ginkgo and compile the ginkgo files: CMake. X-Git-Tag: v9.1.0-rc1~387^2~4 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f90725fe6839f1f3d636c4463c90ec0a51f41dc;p=dealii.git Detect Ginkgo and compile the ginkgo files: CMake. --- diff --git a/cmake/configure/configure_2_ginkgo.cmake b/cmake/configure/configure_2_ginkgo.cmake new file mode 100644 index 0000000000..5b778ae75a --- /dev/null +++ b/cmake/configure/configure_2_ginkgo.cmake @@ -0,0 +1,39 @@ +## --------------------------------------------------------------------- +## +## Copyright (C) 2018 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE.md at +## the top level directory of deal.II. +## +## --------------------------------------------------------------------- + +# +# 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 new file mode 100644 index 0000000000..d05c2528bf --- /dev/null +++ b/cmake/modules/FindGINKGO.cmake @@ -0,0 +1,72 @@ +## --------------------------------------------------------------------- +## +## Copyright (C) 2018 by the deal.II authors +## +## This file is part of the deal.II library. +## +## The deal.II library is free software; you can use it, redistribute +## it, and/or modify it under the terms of the GNU Lesser General +## Public License as published by the Free Software Foundation; either +## version 2.1 of the License, or (at your option) any later version. +## The full text of the license can be found in the file LICENSE.md at +## the top level directory of deal.II. +## +## --------------------------------------------------------------------- + +# +# Try to find the GINKGO library +# +# This module exports +# +# GINKGO_INCLUDE_DIRS +# + +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 + ) + +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 + CLEAR + GINKGO_INCLUDE_DIR + ) diff --git a/include/deal.II/base/config.h.in b/include/deal.II/base/config.h.in index 7801a2397f..84e17b3384 100644 --- a/include/deal.II/base/config.h.in +++ b/include/deal.II/base/config.h.in @@ -1,6 +1,6 @@ // --------------------------------------------------------------------- // -// Copyright (C) 2012 - 2016 by the deal.II authors +// Copyright (C) 2012 - 2018 by the deal.II authors // // This file is part of the deal.II library. // @@ -43,6 +43,7 @@ #cmakedefine DEAL_II_WITH_CUDA_AWARE_MPI #cmakedefine DEAL_II_WITH_CXX14 #cmakedefine DEAL_II_WITH_CXX17 +#cmakedefine DEAL_II_WITH_GINKGO #cmakedefine DEAL_II_WITH_GSL #cmakedefine DEAL_II_WITH_GMSH #cmakedefine DEAL_II_WITH_HDF5 diff --git a/source/lac/CMakeLists.txt b/source/lac/CMakeLists.txt index 2cecfbc24f..a6ce60360f 100644 --- a/source/lac/CMakeLists.txt +++ b/source/lac/CMakeLists.txt @@ -112,6 +112,13 @@ IF(DEAL_II_WITH_SLEPC) ) ENDIF() +IF(DEAL_II_WITH_GINKGO) + SET(_unity_include_src + ${_unity_include_src} + ginkgo_solver.cc + ) +ENDIF() + # Also add Trilinos wrapper files IF(DEAL_II_WITH_TRILINOS) SET(_unity_include_src diff --git a/tests/run_testsuite.cmake b/tests/run_testsuite.cmake index 713c31b614..688ae9da65 100644 --- a/tests/run_testsuite.cmake +++ b/tests/run_testsuite.cmake @@ -1,6 +1,6 @@ ## --------------------------------------------------------------------- ## -## Copyright (C) 2013 - 2016 by the deal.II authors +## Copyright (C) 2013 - 2018 by the deal.II authors ## ## This file is part of the deal.II library. ## @@ -273,7 +273,7 @@ FOREACH(_var ${_variables}) IF( _var MATCHES "^(TEST|DEAL_II|ALLOW|WITH|FORCE|COMPONENT)_" OR _var MATCHES "^(DOCUMENTATION|EXAMPLES)" OR _var MATCHES "^(ADOLC|ARPACK|BOOST|OPENCASCADE|MUPARSER|HDF5|METIS|MPI)_" OR - _var MATCHES "^(NETCDF|P4EST|PETSC|SCALAPACK|SLEPC|THREADS|TBB|TRILINOS)_" OR + _var MATCHES "^(GINKGO|NETCDF|P4EST|PETSC|SCALAPACK|SLEPC|THREADS|TBB|TRILINOS)_" OR _var MATCHES "^(UMFPACK|ZLIB|LAPACK|MUPARSER|CUDA)_" OR _var MATCHES "^(CMAKE|DEAL_II)_(C|CXX|Fortran|BUILD)_(COMPILER|FLAGS)" OR _var MATCHES "^CMAKE_BUILD_TYPE$" OR