CMakeLists.txt 1.9 KB
Newer Older
1 2 3 4
cc_library(
  dynamic_loader
  SRCS dynamic_loader.cc
  DEPS glog gflags enforce phi_dynamic_loader)
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 19
if(NOT WITH_NV_JETSON)
  list(APPEND CUDA_SRCS nvjpeg.cc)
20
endif()
21

22
if(WITH_ROCM)
23
  list(APPEND HIP_SRCS rocblas.cc miopen.cc hiprand.cc hipfft.cc)
Y
Y_Xuan 已提交
24
endif()
Y
Yi Wang 已提交
25 26

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

41
if(TENSORRT_FOUND)
Y
Yan Chunwei 已提交
42 43 44
  list(APPEND CUDA_SRCS tensorrt.cc)
endif()

45
configure_file(cupti_lib_path.h.in ${CMAKE_CURRENT_BINARY_DIR}/cupti_lib_path.h)
46 47
if(CUPTI_FOUND)
  list(APPEND CUDA_SRCS cupti.cc)
48
endif(CUPTI_FOUND)
49
if(WITH_ROCM)
50 51 52 53 54 55 56 57 58 59 60 61 62
  hip_library(
    dynload_cuda
    SRCS ${HIP_SRCS}
    DEPS dynamic_loader phi_dynload_cuda)
  cc_library(
    dynload_warpctc
    SRCS warpctc.cc
    DEPS dynamic_loader warpctc phi_dynload_warpctc)
elseif(WITH_ASCEND_CL)
  cc_library(
    dynload_warpctc
    SRCS warpctc.cc
    DEPS dynamic_loader warpctc npu_hccl phi_dynload_warpctc)
Y
Y_Xuan 已提交
63
else()
64 65 66 67 68 69 70 71
  nv_library(
    dynload_cuda
    SRCS ${CUDA_SRCS}
    DEPS dynamic_loader phi_dynload_cuda)
  cc_library(
    dynload_warpctc
    SRCS warpctc.cc
    DEPS dynamic_loader warpctc phi_dynload_warpctc)
Y
Y_Xuan 已提交
72
endif()
73 74 75 76 77
if(WITH_MKLML)
  cc_library(
    dynload_mklml
    SRCS mklml.cc
    DEPS dynamic_loader mklml phi_dynload_mklml)
78
endif()
79

80
# TODO(TJ): add iomp, mkldnn?
81

82
if(MKL_FOUND AND WITH_ONEMKL)
83
  message("ONEMKL INCLUDE directory is ${MKL_INCLUDE}")
84 85 86 87
  cc_library(
    dynload_mklrt
    SRCS mklrt.cc
    DEPS dynamic_loader phi_dynload_mklrt)
88 89
  target_include_directories(dynload_mklrt PRIVATE ${MKL_INCLUDE})
endif()