File: FindCUDA.cmake

package info (click to toggle)
deal.ii 9.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 181,876 kB
  • sloc: cpp: 265,739; ansic: 52,054; python: 1,507; perl: 645; sh: 506; xml: 437; makefile: 73
file content (71 lines) | stat: -rw-r--r-- 2,138 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
## ---------------------------------------------------------------------
##
## Copyright (C) 2014 - 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 at
## the top level of the deal.II distribution.
##
## ---------------------------------------------------------------------

#
# Try to find cuda
#
# This module exports:
#
#     CUDA_FOUND
#     CUDA_INCLUDE_DIRS
#     CUDA_LIBRARIES
#     CUDA_NVCC_EXECUTABLE
#     CUDA_VERSION
#     CUDA_VERSION_MAJOR
#     CUDA_VERSION_MINOR
#

SET(CUDA_DIR "" CACHE PATH "An optional hint to a CUDA installation")
SET_IF_EMPTY(CUDA_DIR "$ENV{CUDA_DIR}")

IF(NOT "${CUDA_DIR}" STREQUAL "")
  SET(CUDA_TOOLKIT_ROOT_DIR "${CUDA_DIR}")
ENDIF()

# temporarily disable ${CMAKE_SOURCE_DIR}/cmake/modules for module lookup
LIST(REMOVE_ITEM CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules/)
FIND_PACKAGE(CUDA)
LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules/)

IF(CUDA_FOUND)
  MESSAGE(STATUS "Configured to use CUDA installation at ${CUDA_TOOLKIT_ROOT_DIR}")
ENDIF()

# cuSOLVER requires OpenMP
FIND_PACKAGE(OpenMP)
SET(_cuda_libraries ${CUDA_LIBRARIES} ${CUDA_cusparse_LIBRARY}
  ${CUDA_cusolver_LIBRARY} ${OpenMP_CXX_FLAGS})
SET(_cuda_include_dirs ${CUDA_INCLUDE_DIRS})
DEAL_II_PACKAGE_HANDLE(CUDA
  LIBRARIES REQUIRED _cuda_libraries
  INCLUDE_DIRS REQUIRED  _cuda_include_dirs
  USER_INCLUDE_DIRS REQUIRED _cuda_include_dirs
  CLEAR
    CUDA_cublas_device_LIBRARY
    CUDA_cublas_LIBRARY
    CUDA_cudadevrt_LIBRARY
    CUDA_cudart_static_LIBRARY
    CUDA_cufft_LIBRARY
    CUDA_cupti_LIBRARY
    CUDA_curand_LIBRARY
    CUDA_HOST_COMPILER
    CUDA_nppc_LIBRARY
    CUDA_nppi_LIBRARY
    CUDA_npps_LIBRARY
    CUDA_rt_LIBRARY
    CUDA_SDK_ROOT_DIR
    CUDA_TOOLKIT_ROOT_DIR
    CUDA_USE_STATIC_CUDA_RUNTIME
  )