CMakeLists.txt 2.4 KB
Newer Older
1 2
cc_library(
  phi_dynamic_loader
R
Ruibiao Chen 已提交
3
  SRCS dynamic_loader.cc port.cc
4
  DEPS enforce glog gflags)
5

6 7 8 9 10 11 12 13 14 15 16
list(
  APPEND
  CUDA_SRCS
  cublas.cc
  cublasLt.cc
  cudnn.cc
  curand.cc
  cusolver.cc
  cusparse.cc
  nvtx.cc
  cufft.cc)
17

18
if(NOT WITH_NV_JETSON)
19 20 21
  list(APPEND CUDA_SRCS nvjpeg.cc)
endif()

22
if(WITH_ROCM)
23 24 25 26 27
  list(APPEND HIP_SRCS rocblas.cc miopen.cc hiprand.cc hipfft.cc)
endif()

# There is no macOS version of NCCL.
# Disable nvrtc and cuda_driver api on MacOS, and only do a early test on Linux and Windows.
28
if(NOT APPLE)
29
  list(APPEND CUDA_SRCS nvrtc.cc cuda_driver.cc)
30
  if(WITH_NCCL)
31 32
    list(APPEND CUDA_SRCS nccl.cc)
  endif()
33
  if(WITH_ROCM)
34
    list(APPEND HIP_SRCS hiprtc.cc rocm_driver.cc)
35
    if(WITH_RCCL)
36 37
      list(APPEND HIP_SRCS rccl.cc)
    endif()
38 39 40
    if(CUPTI_FOUND)
      list(APPEND HIP_SRCS cupti.cc)
    endif()
41 42 43
  endif()
endif()

44
if(TENSORRT_FOUND)
45 46 47
  list(APPEND CUDA_SRCS tensorrt.cc)
endif()

48 49 50 51
if(CUSPARSELT_FOUND)
  list(APPEND CUDA_SRCS cusparseLt.cc)
endif()

52
configure_file(cupti_lib_path.h.in ${CMAKE_CURRENT_BINARY_DIR}/cupti_lib_path.h)
53
if(CUPTI_FOUND)
54
  list(APPEND CUDA_SRCS cupti.cc)
55
endif()
56
if(WITH_ROCM)
57 58 59 60 61 62 63 64
  hip_library(
    phi_dynload_cuda
    SRCS ${HIP_SRCS}
    DEPS phi_dynamic_loader)
  cc_library(
    phi_dynload_warpctc
    SRCS warpctc.cc
    DEPS phi_dynamic_loader warpctc)
H
Hui Zhang 已提交
65 66 67 68
  cc_library(
    phi_dynload_warprnnt
    SRCS warprnnt.cc
    DEPS phi_dynamic_loader warprnnt)
69
else()
70 71 72 73 74 75 76 77
  nv_library(
    phi_dynload_cuda
    SRCS ${CUDA_SRCS}
    DEPS phi_dynamic_loader)
  cc_library(
    phi_dynload_warpctc
    SRCS warpctc.cc
    DEPS phi_dynamic_loader warpctc)
H
Hui Zhang 已提交
78 79 80 81
  cc_library(
    phi_dynload_warprnnt
    SRCS warprnnt.cc
    DEPS phi_dynamic_loader warprnnt)
82
endif()
83 84 85 86 87
if(WITH_MKLML)
  cc_library(
    phi_dynload_mklml
    SRCS mklml.cc
    DEPS phi_dynamic_loader mklml)
88 89
endif()

90 91 92 93 94 95 96
if(WITH_FLASHATTN)
  cc_library(
    phi_dynload_flashattn
    SRCS flashattn.cc
    DEPS phi_dynamic_loader flashattn)
endif()

97 98 99 100
cc_library(
  phi_dynload_lapack
  SRCS lapack.cc
  DEPS phi_dynamic_loader)
101
add_dependencies(phi_dynload_lapack extern_lapack)
102 103
# TODO(TJ): add iomp, mkldnn?

104
if(MKL_FOUND AND WITH_ONEMKL)
105
  message("ONEMKL INCLUDE directory is ${MKL_INCLUDE}")
106 107 108 109
  cc_library(
    phi_dynload_mklrt
    SRCS mklrt.cc
    DEPS phi_dynamic_loader)
110
  target_include_directories(phi_dynload_mklrt PRIVATE ${MKL_INCLUDE})
111
endif()
112 113 114 115 116 117 118

if(WITH_CUDNN_FRONTEND)
  nv_test(
    cudnn_frontend_test
    SRCS cudnn_frontend_test.cc
    DEPS phi_dynload_cuda cudnn-frontend)
endif()