CMakeLists.txt 3.0 KB
Newer Older
1
if(WITH_PSLIB)
2 3 4 5 6 7
  if(WITH_PSLIB_BRPC)
    set(BRPC_DEPS pslib_brpc)
  else()
    if(NOT WITH_HETERPS)
      set(BRPC_DEPS brpc)
    endif()
W
Wilber 已提交
8
  endif()
9 10 11 12 13 14 15 16 17 18
  cc_library(
    fleet_wrapper
    SRCS fleet_wrapper.cc
    DEPS framework_proto
         proto_desc
         op_registry
         variable_helper
         scope
         ${BRPC_DEPS}
         pslib)
T
Thunderbrook 已提交
19
else()
20 21 22 23
  cc_library(
    fleet_wrapper
    SRCS fleet_wrapper.cc
    DEPS framework_proto variable_helper scope)
W
Wilber 已提交
24
endif()
T
Thunderbrook 已提交
25 26

if(WITH_HETERPS)
27
  if(WITH_NCCL AND WITH_GPU)
D
danleifeng 已提交
28 29 30 31
    if(WITH_PSCORE)
      nv_library(
        ps_gpu_wrapper
        SRCS ps_gpu_wrapper.cu ps_gpu_wrapper.cc
32
        DEPS heter_ps gloo_wrapper ps_framework_proto graph_gpu_wrapper fleet
L
lxsbupt 已提交
33
             ${BRPC_DEPS})
D
danleifeng 已提交
34 35 36 37 38 39
    else()
      nv_library(
        ps_gpu_wrapper
        SRCS ps_gpu_wrapper.cu ps_gpu_wrapper.cc
        DEPS heter_ps gloo_wrapper ${BRPC_DEPS})
    endif()
40 41 42 43 44 45 46 47 48 49 50 51 52 53
    add_subdirectory(heter_ps)
  elseif(WITH_XPU_KP)
    xpu_library(
      ps_gpu_wrapper
      SRCS ps_gpu_wrapper.kps ps_gpu_wrapper.cc
      DEPS heter_ps gloo_wrapper ${BRPC_DEPS})
    add_subdirectory(heter_ps)
  elseif(WITH_RCCL)
    hip_library(
      ps_gpu_wrapper
      SRCS ps_gpu_wrapper.cu ps_gpu_wrapper.cc
      DEPS heter_ps gloo_wrapper ${BRPC_DEPS})
    add_subdirectory(heter_ps)
  endif()
54
else()
55 56 57 58
  cc_library(
    ps_gpu_wrapper
    SRCS ps_gpu_wrapper.cc
    DEPS gloo_wrapper)
W
Wilber 已提交
59
endif()
D
dongdaxiang 已提交
60

61
if(WITH_NCCL OR WITH_RCCL)
62 63 64 65
  cc_library(
    nccl_wrapper
    SRCS nccl_wrapper.cc
    DEPS framework_proto variable_helper scope)
66
endif()
H
hutuxian 已提交
67
if(WITH_BOX_PS)
68 69 70 71 72 73 74 75 76 77 78 79
  if(WITH_GPU)
    nv_library(
      box_wrapper
      SRCS box_wrapper.cc box_wrapper.cu
      DEPS framework_proto lod_tensor box_ps)
  endif()
  if(WITH_ROCM)
    hip_library(
      box_wrapper
      SRCS box_wrapper.cc box_wrapper.cu
      DEPS framework_proto lod_tensor box_ps)
  endif()
H
hutuxian 已提交
80
else()
81 82 83 84
  cc_library(
    box_wrapper
    SRCS box_wrapper.cc
    DEPS framework_proto lod_tensor)
W
Wilber 已提交
85
endif()
86 87

if(WITH_GLOO)
88 89 90 91 92 93 94 95
  cc_library(
    gloo_wrapper
    SRCS gloo_wrapper.cc
    DEPS framework_proto variable_helper scope gloo)
  cc_library(
    metrics
    SRCS metrics.cc
    DEPS gloo_wrapper)
96
else()
97 98 99 100 101 102 103 104
  cc_library(
    gloo_wrapper
    SRCS gloo_wrapper.cc
    DEPS framework_proto variable_helper scope)
  cc_library(
    metrics
    SRCS metrics.cc
    DEPS gloo_wrapper)
W
Wilber 已提交
105
endif()
106

T
Thunderbrook 已提交
107
if(WITH_PSLIB)
108 109 110 111 112 113 114 115
  set(DISTRIBUTE_COMPILE_FLAGS
      "-Wno-non-virtual-dtor -Wno-error=non-virtual-dtor -Wno-error=delete-non-virtual-dtor"
  )
  if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
    set(DISTRIBUTE_COMPILE_FLAGS "${DISTRIBUTE_COMPILE_FLAGS} -faligned-new")
  endif()
  set_source_files_properties(
    heter_wrapper.cc PROPERTIES COMPILE_FLAGS ${DISTRIBUTE_COMPILE_FLAGS})
T
Thunderbrook 已提交
116 117
endif()

118 119 120 121
cc_library(
  heter_wrapper
  SRCS heter_wrapper.cc
  DEPS framework_proto device_context heter_service_proto ${BRPC_DEPS})
T
Thunderbrook 已提交
122

123 124 125 126
cc_test(
  test_fleet_cc
  SRCS test_fleet.cc
  DEPS fleet_wrapper gloo_wrapper fs shell)
127

128
if(WITH_ASCEND OR WITH_ASCEND_CL)
129 130 131 132
  cc_library(
    ascend_wrapper
    SRCS ascend_wrapper.cc
    DEPS framework_proto lod_tensor ascend_ge ascend_graph)
133
endif()