CMakeLists.txt 2.2 KB
Newer Older
1 2 3 4 5
set(DYNLOAD_COMMON_SRCS dynamic_loader.cc port.cc warpctc.cc warprnnt.cc
                        lapack.cc)
if(WITH_ASCEND_CL)
  list(REMOVE_ITEM DYNLOAD_COMMON_SRCS warprnnt.cc)
endif()
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

64
if(WITH_MKLML)
65 66 67 68 69 70 71 72 73
  # Only deps libmklml.so, not link
  add_library(dynload_mklml STATIC mklml.cc)
  add_dependencies(dynload_mklml mklml)
  if(WIN32)
    target_link_libraries(dynload_mklml ${MKLML_IOMP_LIB})
  else()
    target_link_libraries(dynload_mklml
                          "-L${MKLML_LIB_DIR} -liomp5 -Wl,--as-needed")
  endif()
74 75
endif()

76 77 78 79 80 81 82
if(WITH_XPU)
  cc_library(
    phi_dynload_xpti
    SRCS xpti.cc
    DEPS phi)
endif()

83
if(WITH_FLASHATTN)
84
  list(APPEND DYNLOAD_COMMON_SRCS flashattn.cc)
85 86
endif()

87
if(MKL_FOUND AND WITH_ONEMKL)
88
  message("ONEMKL INCLUDE directory is ${MKL_INCLUDE}")
89 90 91 92 93 94 95 96 97
  list(APPEND DYNLOAD_COMMON_SRCS mklrt.cc)
endif()

if(WITH_ROCM)
  collect_srcs(backends_srcs SRCS ${DYNLOAD_COMMON_SRCS} ${HIP_SRCS})
elseif(WITH_GPU)
  collect_srcs(backends_srcs SRCS ${DYNLOAD_COMMON_SRCS} ${CUDA_SRCS})
else()
  collect_srcs(backends_srcs SRCS ${DYNLOAD_COMMON_SRCS})
98
endif()
99 100 101 102 103

if(WITH_CUDNN_FRONTEND)
  nv_test(
    cudnn_frontend_test
    SRCS cudnn_frontend_test.cc
104
    DEPS phi cudnn-frontend)
105
endif()