From fea91164b71bbeeb2268de1698e099e5162e925e Mon Sep 17 00:00:00 2001 From: gongweibao Date: Sat, 30 Mar 2019 09:24:52 +0800 Subject: [PATCH] Fix windows compilation error! (#16546) * fix compiled test=develop * follow comments test=develop --- cmake/external/dgc.cmake | 2 +- paddle/fluid/framework/details/CMakeLists.txt | 6 +++++- paddle/fluid/platform/CMakeLists.txt | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/cmake/external/dgc.cmake b/cmake/external/dgc.cmake index 199ca88b47..a58b8c68d7 100644 --- a/cmake/external/dgc.cmake +++ b/cmake/external/dgc.cmake @@ -34,7 +34,7 @@ ExternalProject_Add( BUILD_IN_SOURCE 1 ) -ADD_LIBRARY(dgc SHARED IMPORTED GLOBAL) +ADD_LIBRARY(dgc STATIC IMPORTED GLOBAL) SET_PROPERTY(TARGET dgc PROPERTY IMPORTED_LOCATION ${DGC_LIBRARIES}) ADD_DEPENDENCIES(dgc extern_dgc) diff --git a/paddle/fluid/framework/details/CMakeLists.txt b/paddle/fluid/framework/details/CMakeLists.txt index d4939779a2..f1ce744a93 100644 --- a/paddle/fluid/framework/details/CMakeLists.txt +++ b/paddle/fluid/framework/details/CMakeLists.txt @@ -25,8 +25,12 @@ if(WITH_DISTRIBUTE) endif() if(WITH_GPU) + set(dgc_deps "") + if(NOT WIN32) + set(dgc_deps dgc) + endif() 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 dgc) + dynload_cuda variable_visitor ${dgc_deps}) 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) if(WITH_DISTRIBUTE) diff --git a/paddle/fluid/platform/CMakeLists.txt b/paddle/fluid/platform/CMakeLists.txt index c3db59563f..f889e2e965 100644 --- a/paddle/fluid/platform/CMakeLists.txt +++ b/paddle/fluid/platform/CMakeLists.txt @@ -44,9 +44,12 @@ add_subdirectory(dynload) cc_library(cpu_helper SRCS cpu_helper.cc DEPS cblas enforce) cc_test(cpu_helper_test SRCS cpu_helper_test.cc DEPS cpu_helper) +set(dgc_deps "") IF(WITH_GPU) set(GPU_CTX_DEPS dynload_cuda dynamic_loader) - set(dgc_deps dgc) + if(NOT WIN32) + set(dgc_deps dgc) + endif() ELSE() set(dgc_deps) ENDIF() -- GitLab