cupti.cmake 1.3 KB
Newer Older
1
if(NOT WITH_GPU)
2
  return()
3 4
endif()

5 6 7 8 9 10 11 12 13
set(CUPTI_ROOT
    "/usr"
    CACHE PATH "CUPTI ROOT")
find_path(
  CUPTI_INCLUDE_DIR cupti.h
  PATHS ${CUPTI_ROOT}
        ${CUPTI_ROOT}/include
        $ENV{CUPTI_ROOT}
        $ENV{CUPTI_ROOT}/include
14
        ${CUDA_TOOLKIT_ROOT_DIR}/extras/CUPTI/include
W
wangchaochaohu 已提交
15
        ${CUDA_TOOLKIT_ROOT_DIR}/targets/x86_64-linux/include
F
feng_shuai 已提交
16
        ${CUDA_TOOLKIT_ROOT_DIR}/targets/aarch64-linux/include
17
  NO_DEFAULT_PATH)
18 19 20 21 22

get_filename_component(__libpath_hist ${CUDA_CUDART_LIBRARY} PATH)

set(TARGET_ARCH "x86_64")
if(NOT ${CMAKE_SYSTEM_PROCESSOR})
23
  set(TARGET_ARCH ${CMAKE_SYSTEM_PROCESSOR})
24 25
endif()

26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
list(
  APPEND
  CUPTI_CHECK_LIBRARY_DIRS
  ${CUPTI_ROOT}
  ${CUPTI_ROOT}/lib64
  ${CUPTI_ROOT}/lib
  ${CUPTI_ROOT}/lib/${TARGET_ARCH}-linux-gnu
  $ENV{CUPTI_ROOT}
  $ENV{CUPTI_ROOT}/lib64
  $ENV{CUPTI_ROOT}/lib
  /usr/lib
  ${CUDA_TOOLKIT_ROOT_DIR}/targets/x86_64-linux/lib64
  ${CUDA_TOOLKIT_ROOT_DIR}/extras/CUPTI/lib64)
find_library(
  CUPTI_LIBRARY
  NAMES libcupti.so libcupti.dylib # libcupti_static.a
  PATHS ${CUPTI_CHECK_LIBRARY_DIRS} ${CUPTI_INCLUDE_DIR} ${__libpath_hist}
  NO_DEFAULT_PATH
  DOC "Path to cuPTI library.")
45 46 47

get_filename_component(CUPTI_LIBRARY_PATH ${CUPTI_LIBRARY} DIRECTORY)
if(CUPTI_INCLUDE_DIR AND CUPTI_LIBRARY)
48
  set(CUPTI_FOUND ON)
49
else()
50
  set(CUPTI_FOUND OFF)
51
endif()