Skip to content

Commit fea9116

Browse files
gongweibaowopeizl
authored andcommitted
Fix windows compilation error! (#16546)
* fix compiled test=develop * follow comments test=develop
1 parent 3d939d3 commit fea9116

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

cmake/external/dgc.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ ExternalProject_Add(
3434
BUILD_IN_SOURCE 1
3535
)
3636

37-
ADD_LIBRARY(dgc SHARED IMPORTED GLOBAL)
37+
ADD_LIBRARY(dgc STATIC IMPORTED GLOBAL)
3838
SET_PROPERTY(TARGET dgc PROPERTY IMPORTED_LOCATION ${DGC_LIBRARIES})
3939
ADD_DEPENDENCIES(dgc extern_dgc)
4040

paddle/fluid/framework/details/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ if(WITH_DISTRIBUTE)
2525
endif()
2626

2727
if(WITH_GPU)
28+
set(dgc_deps "")
29+
if(NOT WIN32)
30+
set(dgc_deps dgc)
31+
endif()
2832
nv_library(all_reduce_op_handle SRCS all_reduce_op_handle.cc DEPS op_handle_base scope lod_tensor ddim memory
29-
dynload_cuda variable_visitor dgc)
33+
dynload_cuda variable_visitor ${dgc_deps})
3034
nv_library(fused_all_reduce_op_handle SRCS fused_all_reduce_op_handle.cc DEPS op_handle_base scope lod_tensor ddim memory
3135
dynload_cuda variable_visitor)
3236
if(WITH_DISTRIBUTE)

paddle/fluid/platform/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,12 @@ add_subdirectory(dynload)
4444
cc_library(cpu_helper SRCS cpu_helper.cc DEPS cblas enforce)
4545
cc_test(cpu_helper_test SRCS cpu_helper_test.cc DEPS cpu_helper)
4646

47+
set(dgc_deps "")
4748
IF(WITH_GPU)
4849
set(GPU_CTX_DEPS dynload_cuda dynamic_loader)
49-
set(dgc_deps dgc)
50+
if(NOT WIN32)
51+
set(dgc_deps dgc)
52+
endif()
5053
ELSE()
5154
set(dgc_deps)
5255
ENDIF()

0 commit comments

Comments
 (0)