CMakeLists.txt 4.4 KB
Newer Older
1 2 3 4 5 6 7
cc_library(
  imperative_flag
  SRCS flags.cc
  DEPS gflags flags)
cc_library(
  var_helper
  SRCS var_helper.cc
8
  DEPS tensor selected_rows)
9 10 11 12 13 14 15 16 17 18 19 20 21 22
if(WITH_XPU)
  cc_library(
    prepared_operator
    SRCS prepared_operator.cc
    DEPS xpu_op_list
         proto_desc
         operator
         device_context
         lod_tensor
         selected_rows_utils
         var_type_traits
         op_kernel_type
         data_transform
         nan_inf_utils
23 24
         scalar
         int_array
C
chenjian 已提交
25 26
         var_helper
         profiler)
27 28 29 30 31 32 33 34 35 36 37 38 39
else()
  cc_library(
    prepared_operator
    SRCS prepared_operator.cc
    DEPS proto_desc
         operator
         device_context
         lod_tensor
         selected_rows_utils
         var_type_traits
         op_kernel_type
         data_transform
         nan_inf_utils
40 41
         scalar
         int_array
C
chenjian 已提交
42 43
         var_helper
         profiler)
44 45 46 47
endif()
cc_library(
  layer
  SRCS layer.cc
48 49
  DEPS prepared_operator math_function imperative_flag variable_helper
       op_registry var_helper)
50
add_subdirectory(jit)
51 52 53 54 55
if(WITH_GPU)
  cc_library(
    layout_autotune
    SRCS layout_autotune.cc
    DEPS op_info phi_gpu_info)
56
else()
57 58 59 60
  cc_library(
    layout_autotune
    SRCS layout_autotune.cc
    DEPS op_info)
61
endif()
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
cc_library(
  amp
  SRCS amp_auto_cast.cc
  DEPS layer var_helper)
cc_library(
  tracer
  SRCS tracer.cc
  DEPS layer
       engine
       program_desc_tracer
       amp
       denormal
       garbage_collector
       var_helper
       layout_autotune)
cc_library(
  basic_engine
  SRCS basic_engine.cc
  DEPS layer gradient_accumulator switch_autotune)
cc_library(
  engine
  SRCS basic_engine.cc partial_grad_engine.cc
  DEPS layer gradient_accumulator switch_autotune)
cc_library(
  imperative_profiler
  SRCS profiler.cc
  DEPS flags)
89
if(NOT WIN32)
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
  if(WITH_NCCL OR WITH_RCCL)
    cc_library(
      imperative_all_reduce
      SRCS all_reduce.cc
      DEPS collective_helper device_context selected_rows_utils tensor)
    cc_library(
      nccl_context
      SRCS nccl_context.cc
      DEPS collective_helper device_context imperative_all_reduce
           var_type_traits)
    if(WITH_NCCL)
      nv_library(
        reducer
        SRCS reducer.cc reducer.cu
        DEPS layer imperative_all_reduce)
105
    endif()
106 107 108 109 110
    if(WITH_RCCL)
      hip_library(
        reducer
        SRCS reducer.cc reducer.cu
        DEPS layer imperative_all_reduce)
111
    endif()
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 155
  endif()
  if(WITH_XPU_BKCL)
    cc_library(
      bkcl_context
      SRCS bkcl_context.cc
      DEPS collective_helper device_context tensor var_type_traits)
    cc_library(
      reducer
      SRCS reducer.cc
      DEPS layer)
  endif()
  if(WITH_ASCEND_CL)
    cc_library(
      hccl_context
      SRCS hccl_context.cc
      DEPS collective_helper device_context tensor var_type_traits)
    cc_library(
      reducer
      SRCS reducer.cc
      DEPS layer)
  endif()
  if(WITH_CNCL)
    cc_library(
      cncl_context
      SRCS cncl_context.cc
      DEPS collective_helper device_context tensor var_type_traits)
    cc_library(
      reducer
      SRCS reducer.cc
      DEPS layer)
  endif()
  if(WITH_NCCL
     OR WITH_RCCL
     OR WITH_XPU_BKCL
     OR WITH_ASCEND_CL)
    cc_library(
      heter_ccl_context
      SRCS heter_ccl_context.cc
      DEPS collective_helper device_context tensor var_type_traits)
  endif()
  cc_library(
    data_loader
    SRCS data_loader.cc
    DEPS enforce)
156
endif()
157
if(WITH_GLOO)
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
  cc_library(
    imperative_gloo_context
    SRCS gloo_context.cc
    DEPS collective_helper device_context tensor var_type_traits)
  if(WIN32
     OR (NOT
         (WITH_NCCL
          OR WITH_RCCL
          OR WITH_XPU_BKCL
          OR WITH_ASCEND_CL
          OR WITH_CNCL)
        ))
    cc_library(
      reducer
      SRCS reducer.cc
      DEPS layer)
  endif()
175
endif()
J
Jiabin Yang 已提交
176

Q
qipengh 已提交
177
if(WITH_MLU)
178
  set(MLU_DEPS mlu_baseop)
Q
qipengh 已提交
179 180
endif()

181
if(NOT WITH_ASCEND_CL)
182 183 184 185 186 187 188 189 190 191 192 193 194
  cc_library(
    gradient_accumulator
    SRCS gradient_accumulator.cc
    DEPS blas
         operator
         lod_tensor
         selected_rows_utils
         selected_rows_functor
         var_type_traits
         layer
         math_function
         phi_tensor
         ${MLU_DEPS})
195
else()
196 197 198 199 200 201 202 203 204 205 206 207 208
  cc_library(
    gradient_accumulator
    SRCS gradient_accumulator.cc
    DEPS blas
         operator
         lod_tensor
         selected_rows_utils
         selected_rows_functor
         var_type_traits
         layer
         math_function
         npu_op_runner
         phi_tensor)
209
endif()
210

J
Jiabin Yang 已提交
211
add_subdirectory(tests)