CMakeLists.txt 2.5 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 28 29 30
  list(
    APPEND
    HIP_SRCS
    rocblas.cc
    miopen.cc
    hiprand.cc
    hipfft.cc
    rocsparse.cc)
31 32 33
endif()

# There is no macOS version of NCCL.
C
co63oc 已提交
34
# Disable nvrtc and cuda_driver api on macOS, and only do an early test on Linux and Windows.
35
if(NOT APPLE)
36
  list(APPEND CUDA_SRCS nvrtc.cc cuda_driver.cc)
37
  if(WITH_NCCL)
38 39
    list(APPEND CUDA_SRCS nccl.cc)
  endif()
40
  if(WITH_ROCM)
41
    list(APPEND HIP_SRCS hiprtc.cc rocm_driver.cc)
42
    if(WITH_RCCL)
43 44
      list(APPEND HIP_SRCS rccl.cc)
    endif()
45 46 47
    if(CUPTI_FOUND)
      list(APPEND HIP_SRCS cupti.cc)
    endif()
48 49 50
  endif()
endif()

51
if(TENSORRT_FOUND)
52 53 54
  list(APPEND CUDA_SRCS tensorrt.cc)
endif()

55 56 57 58
if(CUSPARSELT_FOUND)
  list(APPEND CUDA_SRCS cusparseLt.cc)
endif()

59
configure_file(cupti_lib_path.h.in ${CMAKE_CURRENT_BINARY_DIR}/cupti_lib_path.h)
60
if(CUPTI_FOUND)
61
  list(APPEND CUDA_SRCS cupti.cc)
62
endif()
63
if(WITH_ROCM)
64 65 66 67 68 69 70 71
  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 已提交
72 73 74 75
  cc_library(
    phi_dynload_warprnnt
    SRCS warprnnt.cc
    DEPS phi_dynamic_loader warprnnt)
76
else()
77 78 79 80 81 82 83 84
  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 已提交
85 86 87 88
  cc_library(
    phi_dynload_warprnnt
    SRCS warprnnt.cc
    DEPS phi_dynamic_loader warprnnt)
89
endif()
90 91 92 93 94
if(WITH_MKLML)
  cc_library(
    phi_dynload_mklml
    SRCS mklml.cc
    DEPS phi_dynamic_loader mklml)
95 96
endif()

97 98 99 100 101 102 103
if(WITH_FLASHATTN)
  cc_library(
    phi_dynload_flashattn
    SRCS flashattn.cc
    DEPS phi_dynamic_loader flashattn)
endif()

104 105 106 107
cc_library(
  phi_dynload_lapack
  SRCS lapack.cc
  DEPS phi_dynamic_loader)
108
add_dependencies(phi_dynload_lapack extern_lapack)
109 110
# TODO(TJ): add iomp, mkldnn?

111
if(MKL_FOUND AND WITH_ONEMKL)
112
  message("ONEMKL INCLUDE directory is ${MKL_INCLUDE}")
113 114 115 116
  cc_library(
    phi_dynload_mklrt
    SRCS mklrt.cc
    DEPS phi_dynamic_loader)
117
  target_include_directories(phi_dynload_mklrt PRIVATE ${MKL_INCLUDE})
118
endif()
119 120 121 122 123 124 125

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