CMakeLists.txt 10.7 KB
Newer Older
1 2 3 4 5 6 7 8
cc_library(
  var_handle
  SRCS var_handle.cc
  DEPS place framework_proto node)
cc_library(
  op_handle_base
  SRCS op_handle_base.cc
  DEPS var_handle device_context lod_tensor)
9

10 11 12 13 14 15 16 17 18 19 20 21
cc_library(
  scale_loss_grad_op_handle
  SRCS scale_loss_grad_op_handle.cc
  DEPS op_handle_base scope lod_tensor ddim memory)
cc_library(
  fetch_op_handle
  SRCS fetch_op_handle.cc
  DEPS op_handle_base scope lod_tensor ddim memory)
cc_library(
  fetch_async_op_handle
  SRCS fetch_async_op_handle.cc
  DEPS op_handle_base scope lod_tensor ddim memory)
22

23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
cc_library(
  share_tensor_buffer_functor
  SRCS share_tensor_buffer_functor.cc
  DEPS framework_proto scope place operator op_registry)
cc_library(
  computation_op_handle
  SRCS computation_op_handle.cc
  DEPS framework_proto scope place operator op_registry)
cc_library(
  share_tensor_buffer_op_handle
  SRCS share_tensor_buffer_op_handle.cc
  DEPS op_handle_base scope computation_op_handle share_tensor_buffer_functor)
cc_library(
  rpc_op_handle
  SRCS rpc_op_handle.cc
  DEPS framework_proto scope place operator op_registry)
cc_library(
  fetch_barrier_op_handle
  SRCS fetch_barrier_op_handle.cc
  DEPS framework_proto scope place operator op_registry)
cc_library(
  multi_devices_helper
  SRCS multi_devices_helper.cc
  DEPS graph graph_helper)
Z
Zeng Jinle 已提交
47

48 49 50 51
cc_library(
  variable_visitor
  SRCS variable_visitor.cc
  DEPS lod_tensor selected_rows_utils)
C
chengduoZH 已提交
52

T
tangwei12 已提交
53
if(WITH_PSCORE)
54 55 56
  set(DISTRIBUTE_COMPILE_FLAGS
      "-Wno-non-virtual-dtor -Wno-error=non-virtual-dtor -Wno-error=delete-non-virtual-dtor"
  )
57 58 59
  if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
    set(DISTRIBUTE_COMPILE_FLAGS "${DISTRIBUTE_COMPILE_FLAGS} -faligned-new")
  endif()
60 61 62 63 64 65 66 67
  set_source_files_properties(
    reduce_op_handle.cc PROPERTIES COMPILE_FLAGS ${DISTRIBUTE_COMPILE_FLAGS})
  set_source_files_properties(
    threaded_ssa_graph_executor.cc PROPERTIES COMPILE_FLAGS
                                              ${DISTRIBUTE_COMPILE_FLAGS})
  set_source_files_properties(
    async_ssa_graph_executor.cc PROPERTIES COMPILE_FLAGS
                                           ${DISTRIBUTE_COMPILE_FLAGS})
68 69
endif()

Y
Yu Yang 已提交
70
if(WITH_GPU)
71 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
  nv_library(
    nan_inf_utils
    SRCS nan_inf_utils_detail.cc nan_inf_utils_detail.cu
    DEPS framework_proto scope place)
  nv_library(
    all_reduce_op_handle
    SRCS all_reduce_op_handle.cc
    DEPS op_handle_base
         scope
         lod_tensor
         ddim
         memory
         dynload_cuda
         variable_visitor)
  nv_library(
    fused_all_reduce_op_handle
    SRCS fused_all_reduce_op_handle.cc
    DEPS op_handle_base
         scope
         lod_tensor
         ddim
         memory
         dynload_cuda
         variable_visitor
         place
         device_memory_aligment)
  nv_library(
    grad_merge_all_reduce_op_handle
    SRCS grad_merge_all_reduce_op_handle.cc
    DEPS op_handle_base
         scope
         lod_tensor
         ddim
         memory
         dynload_cuda
         variable_visitor
         place
         device_memory_aligment
         all_reduce_op_handle
         fused_all_reduce_op_handle)

  if(WITH_DGC)
    nv_library(
      sparse_all_reduce_op_handle
      SRCS sparse_all_reduce_op_handle.cc
      DEPS op_handle_base
           scope
           lod_tensor
           ddim
           memory
           dynload_cuda
           variable_visitor
           dgc
           all_reduce_op_handle)
  endif()

  if(WITH_DISTRIBUTE)
    nv_library(
      reduce_op_handle
      SRCS reduce_op_handle.cc
      DEPS op_handle_base variable_visitor scope ddim dynload_cuda
           selected_rows_functor)
  else()
    nv_library(
      reduce_op_handle
      SRCS reduce_op_handle.cc
      DEPS op_handle_base variable_visitor scope ddim dynload_cuda
           selected_rows_functor)
  endif()
  nv_library(
    broadcast_op_handle
    SRCS broadcast_op_handle.cc
    DEPS op_handle_base scope ddim memory variable_visitor dynload_cuda)
  nv_library(
    fused_broadcast_op_handle
    SRCS fused_broadcast_op_handle.cc
    DEPS broadcast_op_handle)
148
elseif(WITH_ROCM)
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
  hip_library(
    nan_inf_utils
    SRCS nan_inf_utils_detail.cc nan_inf_utils_detail.cu
    DEPS framework_proto scope place)
  hip_library(
    all_reduce_op_handle
    SRCS all_reduce_op_handle.cc
    DEPS op_handle_base
         scope
         lod_tensor
         ddim
         memory
         dynload_cuda
         variable_visitor)
  hip_library(
    fused_all_reduce_op_handle
    SRCS fused_all_reduce_op_handle.cc
    DEPS op_handle_base
         scope
         lod_tensor
         ddim
         memory
         dynload_cuda
         variable_visitor
         place
         device_memory_aligment)
  hip_library(
    grad_merge_all_reduce_op_handle
    SRCS grad_merge_all_reduce_op_handle.cc
    DEPS op_handle_base
         scope
         lod_tensor
         ddim
         memory
         dynload_cuda
         variable_visitor
         place
         device_memory_aligment
         all_reduce_op_handle
         fused_all_reduce_op_handle)

  if(WITH_DISTRIBUTE)
    hip_library(
      reduce_op_handle
      SRCS reduce_op_handle.cc
      DEPS op_handle_base variable_visitor scope ddim dynload_cuda
           selected_rows_functor)
  else()
    hip_library(
      reduce_op_handle
      SRCS reduce_op_handle.cc
      DEPS op_handle_base variable_visitor scope ddim dynload_cuda
           selected_rows_functor)
  endif()
  hip_library(
    broadcast_op_handle
    SRCS broadcast_op_handle.cc
    DEPS op_handle_base scope ddim memory variable_visitor dynload_cuda)
  hip_library(
    fused_broadcast_op_handle
    SRCS fused_broadcast_op_handle.cc
    DEPS broadcast_op_handle)
Y
Yu Yang 已提交
211
else()
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269
  if(WITH_ASCEND_CL)
    cc_library(
      nan_inf_utils
      SRCS nan_inf_utils_detail.cc
      DEPS npu_op_runner framework_proto scope place)
  else()
    cc_library(
      nan_inf_utils
      SRCS nan_inf_utils_detail.cc
      DEPS framework_proto scope place)
  endif()
  cc_library(
    all_reduce_op_handle
    SRCS all_reduce_op_handle.cc
    DEPS op_handle_base scope lod_tensor ddim memory variable_visitor)
  cc_library(
    fused_all_reduce_op_handle
    SRCS fused_all_reduce_op_handle.cc
    DEPS op_handle_base
         scope
         lod_tensor
         ddim
         memory
         variable_visitor
         place
         device_memory_aligment)
  cc_library(
    grad_merge_all_reduce_op_handle
    SRCS grad_merge_all_reduce_op_handle.cc
    DEPS op_handle_base
         scope
         lod_tensor
         ddim
         memory
         variable_visitor
         place
         device_memory_aligment
         all_reduce_op_handle
         fused_all_reduce_op_handle)
  if(WITH_DISTRIBUTE)
    cc_library(
      reduce_op_handle
      SRCS reduce_op_handle.cc
      DEPS op_handle_base variable_visitor scope ddim selected_rows_functor)
  else()
    cc_library(
      reduce_op_handle
      SRCS reduce_op_handle.cc
      DEPS op_handle_base variable_visitor scope ddim selected_rows_functor)
  endif()
  cc_library(
    broadcast_op_handle
    SRCS broadcast_op_handle.cc
    DEPS op_handle_base scope ddim memory variable_visitor)
  cc_library(
    fused_broadcast_op_handle
    SRCS fused_broadcast_op_handle.cc
    DEPS broadcast_op_handle)
Y
Yu Yang 已提交
270
endif()
C
chengduoZH 已提交
271

272 273 274 275
cc_library(
  gather_op_handle
  SRCS gather_op_handle.cc
  DEPS op_handle_base scope ddim memory variable_visitor)
C
chengduoZH 已提交
276

277 278 279 280
cc_library(
  eager_deletion_op_handle
  SRCS eager_deletion_op_handle.cc
  DEPS lod_tensor selected_rows_utils reference_count_pass_helper)
Y
yuyang18 已提交
281

282 283 284
set(SSA_GRAPH_EXECUTOR_DEPS
    graph
    framework_proto
285
    multi_devices_helper
286 287 288
    reference_count_pass
    eager_deletion_pass
    buffer_shared_inplace_op_pass
289
    buffer_shared_cross_op_memory_reuse_pass
290
    inplace_addto_op_pass
291
    set_reader_device_info_utils)
292 293 294 295
cc_library(
  ssa_graph_executor
  SRCS ssa_graph_executor.cc
  DEPS ${SSA_GRAPH_EXECUTOR_DEPS})
S
sneaxiy 已提交
296

297 298 299 300 301
cc_library(
  threaded_ssa_graph_executor
  SRCS threaded_ssa_graph_executor.cc
  DEPS fetch_op_handle ssa_graph_executor scope simple_threadpool
       device_context)
302

303 304 305 306
cc_library(
  parallel_ssa_graph_executor
  SRCS parallel_ssa_graph_executor.cc
  DEPS threaded_ssa_graph_executor)
Y
Yancey1989 已提交
307

308
set(ASYNC_SSA_GRAPH_EXECUTOR_DEPS threaded_ssa_graph_executor)
T
tangwei12 已提交
309

310 311 312 313
cc_library(
  async_ssa_graph_executor
  SRCS async_ssa_graph_executor.cc
  DEPS ${ASYNC_SSA_GRAPH_EXECUTOR_DEPS})
Q
can run  
Qiao Longfei 已提交
314

315 316 317 318 319 320 321 322 323 324
cc_test(
  broadcast_op_test
  SRCS broadcast_op_handle_test.cc
  DEPS var_handle
       op_handle_base
       scope
       ddim
       memory
       device_context
       broadcast_op_handle)
325
cc_test_old(
326
  gather_op_test
327 328 329 330 331 332 333 334 335 336
  SRCS
  gather_op_handle_test.cc
  DEPS
  var_handle
  op_handle_base
  scope
  ddim
  memory
  device_context
  gather_op_handle)
337

338 339 340 341 342 343 344 345
cc_library(
  scope_buffered_monitor
  SRCS scope_buffered_monitor.cc
  DEPS scope profiler selected_rows_utils)
cc_library(
  scope_buffered_ssa_graph_executor
  SRCS scope_buffered_ssa_graph_executor.cc
  DEPS ssa_graph_executor scope_buffered_monitor)
Y
yuyang18 已提交
346 347
#cc_test(reduce_op_handle_test SRCS reduce_op_handle_test.cc DEPS var_handle op_handle_base scope ddim memory
#        device_context reduce_op_handle )
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373
cc_library(
  bind_threaded_ssa_graph_executor
  SRCS bind_threaded_ssa_graph_executor.cc
  DEPS fetch_op_handle gflags ssa_graph_executor scope simple_threadpool
       device_context)
cc_library(
  fast_threaded_ssa_graph_executor
  SRCS fast_threaded_ssa_graph_executor.cc
  DEPS fetch_async_op_handle ssa_graph_executor scope simple_threadpool
       device_context)
cc_test(
  fused_broadcast_op_test
  SRCS fused_broadcast_op_handle_test.cc
  DEPS fused_broadcast_op_handle)

cc_test(exception_holder_test SRCS exception_holder_test.cc)

set(IR_PASS_DEPS
    graph_viz_pass
    multi_devices_graph_pass
    multi_devices_graph_print_pass
    multi_devices_graph_check_pass
    fuse_elewise_add_act_pass
    fuse_bn_act_pass
    fuse_bn_add_act_pass
    multi_batch_merge_pass
374 375
    fuse_relu_depthwise_conv_pass
    lock_free_optimize_pass
376 377 378 379
    sequential_execution_pass
    all_reduce_deps_pass
    add_reader_dependency_pass
    modify_op_lock_and_record_event_pass
380 381 382 383 384 385 386 387 388 389
    coalesce_grad_tensor_pass
    fuse_all_reduce_op_pass
    backward_optimizer_op_deps_pass
    fuse_adam_op_pass
    fuse_sgd_op_pass
    fuse_momentum_op_pass
    sync_batch_norm_pass
    runtime_context_cache_pass
    graph_to_program_pass
    fix_op_run_order_pass
390 391
    fuse_gemm_epilogue_pass
    delete_dropout_op_pass)
392

393
if(WITH_CINN)
394 395 396
  set(IR_PASS_DEPS ${IR_PASS_DEPS} build_cinn_pass)
endif()

397 398 399
if(NOT APPLE
   AND NOT WIN32
   AND (WITH_GPU OR WITH_ROCM))
400 401
  set(IR_PASS_DEPS ${IR_PASS_DEPS} fusion_group_pass)
endif()
402 403 404 405 406 407 408 409
cc_library(
  build_strategy
  SRCS build_strategy.cc
  DEPS pass_builder ${IR_PASS_DEPS})
cc_test(
  build_strategy_test
  SRCS build_strategy_test.cc
  DEPS build_strategy op_registry op_proto_maker graph string_helper)
Z
Zeng Jinle 已提交
410

411
if(WITH_MKLDNN)
Z
Zeng Jinle 已提交
412 413
  target_link_libraries(build_strategy mkldnn_placement_pass)
endif()