diff --git a/CMakeLists.txt b/CMakeLists.txt index c2804e234d0d7cab6546dda5b14e5007c084472e..0b42e60e1753eff23713fa566800fce366ecc23d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,6 +133,8 @@ endif() if (WIN32) set(WITH_AVX OFF CACHE STRING "Disable AVX when compiling for Windows" FORCE) + set(WITH_DSO OFF CACHE STRING + "Disable DSO when compiling for Windows" FORCE) endif() set(THIRD_PARTY_PATH "${CMAKE_BINARY_DIR}/third_party" CACHE STRING diff --git a/cmake/operators.cmake b/cmake/operators.cmake index 5e8b95b3e2392e7dbdbd83532e25651a6f657ac6..985136d465efd456b1a629a0dae3640232eede2c 100644 --- a/cmake/operators.cmake +++ b/cmake/operators.cmake @@ -195,7 +195,7 @@ endfunction() function(register_operators) set(options "") set(oneValueArgs "") - set(multiValueArgs EXCLUDES) + set(multiValueArgs EXCLUDES DEPS) cmake_parse_arguments(register_operators "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) @@ -203,11 +203,16 @@ function(register_operators) string(REPLACE "_mkldnn" "" OPS "${OPS}") string(REPLACE ".cc" "" OPS "${OPS}") list(REMOVE_DUPLICATES OPS) + list(LENGTH register_operators_DEPS register_operators_DEPS_len) foreach(src ${OPS}) list(FIND register_operators_EXCLUDES ${src} _index) if (${_index} EQUAL -1) - op_library(${src}) + if (${register_operators_DEPS_len} GREATER 0) + op_library(${src} DEPS ${register_operators_DEPS}) + else() + op_library(${src}) + endif() endif() endforeach() endfunction() diff --git a/paddle/fluid/operators/CMakeLists.txt b/paddle/fluid/operators/CMakeLists.txt index 284bf5dc9e2b5507f3a24276cbd6b85fd3219458..73f44f3b67506e4d3bfffc15bca3d82ede9716fe 100644 --- a/paddle/fluid/operators/CMakeLists.txt +++ b/paddle/fluid/operators/CMakeLists.txt @@ -35,7 +35,7 @@ endif() register_operators(EXCLUDES warpctc_op) # warpctc_cudnn need cudnn 7 above -if (WITH_GPU) +if (WITH_GPU AND NOT WIN32) if (${CUDNN_MAJOR_VERSION} VERSION_LESS 7) op_library(warpctc_op DEPS dynload_warpctc sequence_padding sequence_scale SRCS warpctc_op.cc warpctc_op.cu.cc) else() diff --git a/paddle/fluid/operators/distributed_ops/CMakeLists.txt b/paddle/fluid/operators/distributed_ops/CMakeLists.txt index a071babc8227d76504b3404532146e3f0692358e..28bb90af5675b2fe14813675ad001c0cf1d71e12 100644 --- a/paddle/fluid/operators/distributed_ops/CMakeLists.txt +++ b/paddle/fluid/operators/distributed_ops/CMakeLists.txt @@ -29,11 +29,11 @@ foreach(src ${OPS}) set_source_files_properties(${src} PROPERTIES COMPILE_FLAGS ${DISTRIBUTE_COMPILE_FLAGS}) endforeach() -register_operators(EXCLUDES gen_nccl_id_op) +register_operators(EXCLUDES gen_nccl_id_op DEPS ${DISTRIBUTE_DEPS}) if(WITH_GPU AND NOT WIN32) set(DISTRIBUTE_DEPS ${DISTRIBUTE_DEPS} nccl_common) - op_library(gen_nccl_id_op) + op_library(gen_nccl_id_op ${DISTRIBUTE_DEPS} nccl_common) endif() set(OPERATOR_DEPS ${OPERATOR_DEPS} ${DISTRIBUTE_DEPS} PARENT_SCOPE)