File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
paddle/fluid/operators/distributed_ops Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -196,19 +196,24 @@ endfunction()
196
196
function (register_operators )
197
197
set (options "" )
198
198
set (oneValueArgs "" )
199
- set (multiValueArgs EXCLUDES )
199
+ set (multiValueArgs EXCLUDES DEPS )
200
200
cmake_parse_arguments (register_operators "${options} " "${oneValueArgs} "
201
201
"${multiValueArgs} " ${ARGN} )
202
202
203
203
file (GLOB OPS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR} " "*_op.cc" )
204
204
string (REPLACE "_mkldnn" "" OPS "${OPS} " )
205
205
string (REPLACE ".cc" "" OPS "${OPS} " )
206
206
list (REMOVE_DUPLICATES OPS )
207
+ list (LENGTH register_operators_DEPS register_operators_DEPS_len )
207
208
208
209
foreach (src ${OPS} )
209
210
list (FIND register_operators_EXCLUDES ${src} _index )
210
211
if (${_index} EQUAL -1 )
211
- op_library (${src} )
212
+ if (${register_operators_DEPS_len} GREATER 0 )
213
+ op_library (${src} DEPS ${register_operators_DEPS} )
214
+ else ()
215
+ op_library (${src} )
216
+ endif ()
212
217
endif ()
213
218
endforeach ()
214
219
endfunction ()
Original file line number Diff line number Diff line change @@ -29,11 +29,11 @@ foreach(src ${OPS})
29
29
set_source_files_properties (${src} PROPERTIES COMPILE_FLAGS ${DISTRIBUTE_COMPILE_FLAGS} )
30
30
endforeach ()
31
31
32
- register_operators (EXCLUDES gen_nccl_id_op )
32
+ register_operators (EXCLUDES gen_nccl_id_op DEPS ${DISTRIBUTE_DEPS} )
33
33
34
34
if (WITH_GPU AND NOT WIN32 )
35
35
set (DISTRIBUTE_DEPS ${DISTRIBUTE_DEPS} nccl_common )
36
- op_library (gen_nccl_id_op )
36
+ op_library (gen_nccl_id_op ${DISTRIBUTE_DEPS} nccl_common )
37
37
endif ()
38
38
39
39
set (OPERATOR_DEPS ${OPERATOR_DEPS} ${DISTRIBUTE_DEPS} PARENT_SCOPE )
You can’t perform that action at this time.
0 commit comments