You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 2.1 kB

6 years ago
6 years ago
6 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. file(GLOB_RECURSE DEVICE_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "common/*.cc"
  2. "kernel_info.cc" "kernel_runtime.cc" "memory_manager.cc" "kernel_runtime_manager.cc" "convert_tensor_utils.cc"
  3. )
  4. if (ENABLE_GPU)
  5. list(APPEND DEVICE_SRC_LIST "gpu/distribution/collective_init.cc")
  6. else ()
  7. list(APPEND DEVICE_SRC_LIST "gpu/distribution/collective_fake_init.cc")
  8. endif ()
  9. if (ENABLE_D)
  10. file(GLOB_RECURSE D_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "ascend/*.cc" "kernel_adjust.cc")
  11. endif ()
  12. if (ENABLE_CPU)
  13. file(GLOB_RECURSE CPU_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "cpu/*.cc")
  14. endif ()
  15. # gpu
  16. if (ENABLE_GPU)
  17. file(GLOB_RECURSE CUDA_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "gpu/*.cc" "gpu/*.cu")
  18. # gpu_queue
  19. list(REMOVE_ITEM CUDA_SRC_LIST "gpu/blocking_queue.cc" "gpu/gpu_buffer_mgr.cc")
  20. add_library(gpu_queue SHARED "gpu/blocking_queue.cc" "gpu/gpu_buffer_mgr.cc")
  21. target_link_libraries(gpu_queue ${CMAKE_THREAD_LIBS_INIT} ${CUDA_PATH}/lib64/libcudart.so)
  22. list(REMOVE_ITEM CUDA_SRC_LIST "gpu/mpi/mpi_initializer.cc"
  23. "gpu/distribution/collective_wrapper.cc"
  24. "gpu/distribution/mpi_wrapper.cc"
  25. "gpu/distribution/nccl_wrapper.cc"
  26. )
  27. if (ENABLE_MPI)
  28. include(ExternalProject)
  29. # gpu_collective
  30. add_library(gpu_collective SHARED "gpu/distribution/collective_wrapper.cc"
  31. "gpu/distribution/mpi_wrapper.cc"
  32. "gpu/distribution/nccl_wrapper.cc"
  33. )
  34. # _ms_mpi
  35. pybind11_add_module(_ms_mpi "gpu/mpi/mpi_initializer.cc")
  36. target_link_libraries(_ms_mpi PRIVATE mindspore::pybind11_module mindspore::ompi)
  37. target_link_libraries(gpu_collective PRIVATE mindspore::ompi mindspore::nccl)
  38. endif ()
  39. # add_library(_mindspore_device_cuda_obj OBJECT ${CUDA_SRC_LIST})
  40. endif ()
  41. add_library(_mindspore_device_obj OBJECT ${DEVICE_SRC_LIST} ${D_SRC_LIST} ${CPU_SRC_LIST})