CMakeLists.txt 4.2 KB
Newer Older
1 2 3 4
include(operators)

set(COLLECTIVE_DEPS "")

5 6 7
set(COLLECTIVE_COMPILE_FLAGS
    "-Wno-non-virtual-dtor -Wno-error=non-virtual-dtor -Wno-error=delete-non-virtual-dtor"
)
8

9 10 11 12
file(
  GLOB OPS
  RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
  "*_op.cc")
13 14 15
list(REMOVE_DUPLICATES OPS)

foreach(src ${OPS})
16 17
  set_source_files_properties(${src} PROPERTIES COMPILE_FLAGS
                                                ${COLLECTIVE_COMPILE_FLAGS})
18 19
endforeach()

20 21 22 23 24 25 26 27 28 29 30
register_operators(
  EXCLUDES
  c_gen_bkcl_id_op
  gen_bkcl_id_op
  c_gen_nccl_id_op
  gen_nccl_id_op
  c_gen_hccl_id_op
  gen_hccl_id_op
  c_gen_cncl_id_op
  DEPS
  ${COLLECTIVE_DEPS})
31

32
if(WITH_NCCL OR WITH_RCCL)
33 34 35
  set(COLLECTIVE_DEPS ${COLLECTIVE_DEPS} nccl_common collective_helper)
  op_library(c_gen_nccl_id_op DEPS ${COLLECTIVE_DEPS})
  op_library(gen_nccl_id_op DEPS ${COLLECTIVE_DEPS})
36 37
endif()

38
if(WITH_GLOO)
39
  set(COLLECTIVE_DEPS ${COLLECTIVE_DEPS} gloo_wrapper)
40 41
endif()

42
if(WITH_XPU_BKCL)
43 44 45
  set(COLLECTIVE_DEPS ${COLLECTIVE_DEPS} collective_helper)
  op_library(c_gen_bkcl_id_op DEPS ${COLLECTIVE_DEPS})
  op_library(gen_bkcl_id_op DEPS ${COLLECTIVE_DEPS})
46 47
endif()

48
if(WITH_CNCL)
49 50
  set(COLLECTIVE_DEPS ${COLLECTIVE_DEPS} collective_helper)
  op_library(c_gen_cncl_id_op DEPS ${COLLECTIVE_DEPS})
51 52
endif()

53
if(WITH_ASCEND_CL)
54 55 56 57 58 59 60 61
  cc_library(
    gen_hccl_id_op_helper
    SRCS gen_hccl_id_op_helper.cc
    DEPS dynload_warpctc dynamic_loader scope)
  set(COLLECTIVE_DEPS ${COLLECTIVE_DEPS} collective_helper
                      gen_hccl_id_op_helper)
  op_library(c_gen_hccl_id_op DEPS ${COLLECTIVE_DEPS})
  op_library(gen_hccl_id_op DEPS ${COLLECTIVE_DEPS})
62 63
endif()

64 65 66 67 68 69
set(OPERATOR_DEPS
    ${OPERATOR_DEPS} ${COLLECTIVE_DEPS}
    PARENT_SCOPE)
set(GLOB_COLLECTIVE_DEPS
    ${COLLECTIVE_DEPS}
    CACHE INTERNAL "collective dependency")
70 71

if(WITH_ASCEND_CL)
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
  set(COMMON_TEST_DEPS_FOR_HCOM
      c_comm_init_hccl_op
      c_gen_hccl_id_op
      gen_hccl_id_op_helper
      gen_hccl_id_op
      op_registry
      ascend_hccl
      flags
      dynamic_loader
      dynload_warpctc
      scope
      device_context
      enforce
      executor)
  cc_test(
    c_broadcast_op_npu_test
    SRCS c_broadcast_op_npu_test.cc
    DEPS c_broadcast_op ${COLLECTIVE_DEPS} ${COMMON_TEST_DEPS_FOR_HCOM})
  cc_test(
    c_allreduce_sum_op_npu_test
    SRCS c_allreduce_sum_op_npu_test.cc
    DEPS c_allreduce_sum_op ${COLLECTIVE_DEPS} ${COMMON_TEST_DEPS_FOR_HCOM})
  cc_test(
    c_reducescatter_op_npu_test
    SRCS c_reducescatter_op_npu_test.cc
    DEPS c_reducescatter_op ${COLLECTIVE_DEPS} ${COMMON_TEST_DEPS_FOR_HCOM})
  cc_test(
    c_allgather_op_npu_test
    SRCS c_allgather_op_npu_test.cc
    DEPS c_allgather_op ${COLLECTIVE_DEPS} ${COMMON_TEST_DEPS_FOR_HCOM})
  cc_test(
    c_reduce_sum_op_npu_test
    SRCS c_reduce_sum_op_npu_test.cc
    DEPS c_reduce_sum_op ${COLLECTIVE_DEPS} ${COMMON_TEST_DEPS_FOR_HCOM})
  cc_test(
    c_allreduce_max_op_npu_test
    SRCS c_allreduce_max_op_npu_test.cc
    DEPS c_allreduce_max_op ${COLLECTIVE_DEPS} ${COMMON_TEST_DEPS_FOR_HCOM})
  cc_test(
    send_v2_op_npu_test
    SRCS send_v2_op_npu_test.cc
    DEPS send_v2_op ${COLLECTIVE_DEPS} ${COMMON_TEST_DEPS_FOR_HCOM})
  cc_test(
    recv_v2_op_npu_test
    SRCS recv_v2_op_npu_test.cc
    DEPS recv_v2_op ${COLLECTIVE_DEPS} ${COMMON_TEST_DEPS_FOR_HCOM})
  cc_test(
    checknumeric
    SRCS checknumeric_npu_test.cc
    DEPS c_allreduce_sum_op ${COLLECTIVE_DEPS} ${COMMON_TEST_DEPS_FOR_HCOM})
  cc_test(
    c_sync_comm_stream_op_npu_test
    SRCS c_sync_comm_stream_op_npu_test.cc
    DEPS op_registry
         c_broadcast_op
         c_comm_init_hccl_op
         c_sync_comm_stream_op
         c_gen_hccl_id_op
         gen_hccl_id_op_helper
         ${COLLECTIVE_DEPS}
         ascend_hccl
         dynamic_loader
         dynload_warpctc
         scope
         device_context
         enforce
         executor)
  cc_test(
    c_sync_calc_stream_op_npu_test
    SRCS c_sync_calc_stream_op_npu_test.cc
    DEPS op_registry
         elementwise_add_op
         c_sync_calc_stream_op
         c_gen_hccl_id_op
         gen_hccl_id_op_helper
         ${COLLECTIVE_DEPS}
         ascend_hccl
         dynamic_loader
         dynload_warpctc
         scope
         device_context
         enforce
         executor)
155
endif()