CMakeLists.txt 2.0 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 38 39 40
      list(APPEND HIP_SRCS rccl.cc)
    endif()
  endif()
endif()

41
if(TENSORRT_FOUND)
42 43 44
  list(APPEND CUDA_SRCS tensorrt.cc)
endif()

45 46 47 48
if(CUSPARSELT_FOUND)
  list(APPEND CUDA_SRCS cusparseLt.cc)
endif()

49
configure_file(cupti_lib_path.h.in ${CMAKE_CURRENT_BINARY_DIR}/cupti_lib_path.h)
50
if(CUPTI_FOUND)
51
  list(APPEND CUDA_SRCS cupti.cc)
52
endif()
53
if(WITH_ROCM)
54 55 56 57 58 59 60 61 62 63 64 65 66
  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)
elseif(WITH_ASCEND_CL)
  cc_library(
    phi_dynload_warpctc
    SRCS warpctc.cc
    DEPS phi_dynamic_loader warpctc npu_hccl)
67
else()
68 69 70 71 72 73 74 75
  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)
76
endif()
77 78 79 80 81
if(WITH_MKLML)
  cc_library(
    phi_dynload_mklml
    SRCS mklml.cc
    DEPS phi_dynamic_loader mklml)
82 83
endif()

84 85 86 87
cc_library(
  phi_dynload_lapack
  SRCS lapack.cc
  DEPS phi_dynamic_loader)
88
add_dependencies(phi_dynload_lapack extern_lapack)
89 90
# TODO(TJ): add iomp, mkldnn?

91
if(MKL_FOUND AND WITH_ONEMKL)
92
  message("ONEMKL INCLUDE directory is ${MKL_INCLUDE}")
93 94 95 96
  cc_library(
    phi_dynload_mklrt
    SRCS mklrt.cc
    DEPS phi_dynamic_loader)
97
  target_include_directories(phi_dynload_mklrt PRIVATE ${MKL_INCLUDE})
98
endif()