@@ -100,8 +100,16 @@ if (WITH_GPU)
100100endif ()
101101cc_test (var_type_traits_test SRCS var_type_traits_test.cc DEPS var_type_traits )
102102
103+ set (BRPC_DEPS "" )
104+ if (WITH_PSLIB OR WITH_PSCORE)
105+ set (BRPC_DEPS brpc)
106+ if (WITH_PSLIB_BRPC)
107+ set (BRPC_DEPS pslib_brpc)
108+ endif ()
109+ endif ()
110+
103111cc_library (scope SRCS scope.cc DEPS glog threadpool xxhash var_type_traits )
104- cc_library (device_worker SRCS device_worker.cc DEPS trainer_desc_proto lod_tensor scope )
112+ cc_library (device_worker SRCS device_worker.cc DEPS trainer_desc_proto lod_tensor scope ${BRPC_DEPS} )
105113cc_test (device_worker_test SRCS device_worker_test.cc DEPS device_worker )
106114
107115cc_library (scope_pool SRCS scope_pool.cc DEPS scope )
@@ -243,9 +251,16 @@ if(WITH_DISTRIBUTE)
243251 fleet_wrapper heter_wrapper ps_gpu_wrapper box_wrapper lodtensor_printer
244252 lod_rank_table feed_fetch_method collective_helper ${GLOB_DISTRIBUTE_DEPS}
245253 graph_to_program_pass variable_helper data_feed_proto timer monitor
246- heter_service_proto pslib_brpc )
254+ heter_service_proto ${BRPC_DEP} )
247255 set (DISTRIBUTE_COMPILE_FLAGS "-Wno-non-virtual-dtor -Wno-error=non-virtual-dtor -Wno-error=delete-non-virtual-dtor" )
256+ if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
257+ set (DISTRIBUTE_COMPILE_FLAGS
258+ "${DISTRIBUTE_COMPILE_FLAGS} -faligned-new" )
259+ endif ()
248260 set_source_files_properties (executor.cc PROPERTIES COMPILE_FLAGS ${DISTRIBUTE_COMPILE_FLAGS} )
261+ set_source_files_properties (device_worker.cc PROPERTIES COMPILE_FLAGS ${DISTRIBUTE_COMPILE_FLAGS} )
262+ set_source_files_properties (hetercpu_worker.cc PROPERTIES COMPILE_FLAGS ${DISTRIBUTE_COMPILE_FLAGS} )
263+ set_source_files_properties (heterxpu_trainer.cc PROPERTIES COMPILE_FLAGS ${DISTRIBUTE_COMPILE_FLAGS} )
249264 elseif (WITH_PSCORE)
250265 cc_library (executor SRCS executor.cc multi_trainer.cc pipeline_trainer.cc dataset_factory.cc
251266 dist_multi_trainer.cc trainer_factory.cc trainer.cc data_feed_factory.cc
@@ -280,7 +295,7 @@ elseif(WITH_PSLIB)
280295 pull_dense_worker.cc section_worker.cc device_worker_factory.cc data_set.cc DEPS op_registry
281296 device_context scope framework_proto data_feed_proto heter_service_proto trainer_desc_proto glog
282297 lod_rank_table fs shell fleet_wrapper heter_wrapper ps_gpu_wrapper box_wrapper lodtensor_printer feed_fetch_method
283- graph_to_program_pass variable_helper timer monitor pslib_brpc )
298+ graph_to_program_pass variable_helper timer monitor ${BRPC_DEP} )
284299else ()
285300 cc_library (executor SRCS executor.cc multi_trainer.cc pipeline_trainer.cc dataset_factory.cc
286301 dist_multi_trainer.cc trainer_factory.cc trainer.cc data_feed_factory.cc
0 commit comments