Skip to content

Commit 813e54e

Browse files
authored
Merge pull request #14328 from PaddlePaddle/revert-14046-windows/debug
Revert "cherry picked windows patches."
2 parents 0804bf3 + ba8b561 commit 813e54e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+199
-519
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ message(STATUS "C compiler: ${CMAKE_C_COMPILER}, version: "
2626
"${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}")
2727
if(WIN32)
2828
set(CMAKE_STATIC_LIBRARY_PREFIX lib)
29-
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "/MT") #create multithread dynamic library
3029
endif(WIN32)
3130

3231
if(NOT CMAKE_CROSSCOMPILING)
3332
find_package(CUDA QUIET)
3433
endif(NOT CMAKE_CROSSCOMPILING)
3534
find_package(Git REQUIRED)
3635
find_package(Threads REQUIRED)
36+
3737
include(simd)
3838

3939
################################ Configurations #######################################
@@ -178,10 +178,10 @@ include(external/eigen) # download eigen3
178178
include(external/pybind11) # download pybind11
179179
include(external/cares)
180180
include(external/cub)
181+
include(external/xxhash) # download xxhash
181182

182183
if (NOT WIN32)
183184
# there is no official support of snappystream, warpctc, nccl, cupti in windows
184-
include(external/xxhash) # download xxhash
185185
include(external/snappy) # download snappy
186186
include(external/snappystream) # download snappystream
187187
include(external/warpctc) # download, build, install warpctc

cmake/cuda.cmake

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -169,21 +169,18 @@ set(CUDA_PROPAGATE_HOST_FLAGS OFF)
169169

170170
# Release/Debug flags set by cmake. Such as -O3 -g -DNDEBUG etc.
171171
# So, don't set these flags here.
172-
173172
if (NOT WIN32) # windows msvc2015 support c++11 natively.
174-
# -std=c++11 -fPIC not recoginize by msvc
173+
# -std=c++11 -fPIC not recoginize by msvc, -Xcompiler will be added by cmake.
175174
list(APPEND CUDA_NVCC_FLAGS "-std=c++11")
176-
# in cuda9, suppress cuda warning on eigen with "-w"
177-
list(APPEND CUDA_NVCC_FLAGS "-w" "-Xcompiler -fPIC")
178-
else(NOT WIN32)
179-
list(APPEND CUDA_NVCC_FLAGS "-w" "-Xcompiler -fPIC" "-Xcompiler /w")
175+
list(APPEND CUDA_NVCC_FLAGS "-Xcompiler -fPIC")
180176
endif(NOT WIN32)
181177

182178
if(WITH_FAST_MATH)
183179
# Make use of fast math library. https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html
184180
list(APPEND CUDA_NVCC_FLAGS "--use_fast_math")
185-
endif(WITH_FAST_MATH)
186-
181+
endif()
182+
# in cuda9, suppress cuda warning on eigen
183+
list(APPEND CUDA_NVCC_FLAGS "-w")
187184
# Set :expt-relaxed-constexpr to suppress Eigen warnings
188185
list(APPEND CUDA_NVCC_FLAGS "--expt-relaxed-constexpr")
189186

cmake/cudnn.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ find_library(CUDNN_LIBRARY NAMES ${CUDNN_LIB_NAME} # libcudnn_static.a
4848
NO_DEFAULT_PATH
4949
DOC "Path to cuDNN library.")
5050

51+
5152
if(CUDNN_INCLUDE_DIR AND CUDNN_LIBRARY)
5253
set(CUDNN_FOUND ON)
5354
else()
@@ -82,7 +83,7 @@ if(CUDNN_FOUND)
8283

8384
if(NOT CUDNN_MAJOR_VERSION)
8485
set(CUDNN_VERSION "???")
85-
else()
86+
else()
8687
math(EXPR CUDNN_VERSION
8788
"${CUDNN_MAJOR_VERSION} * 1000 +
8889
${CUDNN_MINOR_VERSION} * 100 + ${CUDNN_PATCHLEVEL_VERSION}")

cmake/external/boost.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ ExternalProject_Add(
4848
DOWNLOAD_DIR ${BOOST_DOWNLOAD_DIR}
4949
DOWNLOAD_COMMAND wget --no-check-certificate ${BOOST_URL} -c -q -O ${BOOST_TAR}.tar.gz
5050
&& tar zxf ${BOOST_TAR}.tar.gz
51-
DOWNLOAD_NO_PROGRESS 1
51+
DOWNLOAD_NO_PROGRESS 1
5252
PREFIX ${BOOST_SOURCES_DIR}
5353
CONFIGURE_COMMAND ""
5454
BUILD_COMMAND ""

cmake/external/gflags.cmake

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ ExternalProject_Add(
3535
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
3636
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
3737
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
38-
-DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE}
3938
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
40-
-DBUILD_STATIC_LIBS=ON
4139
-DCMAKE_INSTALL_PREFIX=${GFLAGS_INSTALL_DIR}
4240
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
4341
-DBUILD_TESTING=OFF
@@ -47,17 +45,16 @@ ExternalProject_Add(
4745
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
4846
-DCMAKE_BUILD_TYPE:STRING=${THIRD_PARTY_BUILD_TYPE}
4947
)
50-
51-
ADD_LIBRARY(gflags STATIC IMPORTED GLOBAL)
52-
SET_PROPERTY(TARGET gflags PROPERTY IMPORTED_LOCATION ${GFLAGS_LIBRARIES})
53-
ADD_DEPENDENCIES(gflags extern_gflags)
5448
IF(WIN32)
5549
IF(NOT EXISTS "${GFLAGS_INSTALL_DIR}/lib/libgflags.lib")
5650
add_custom_command(TARGET extern_gflags POST_BUILD
5751
COMMAND cmake -E rename ${GFLAGS_INSTALL_DIR}/lib/gflags_static.lib ${GFLAGS_INSTALL_DIR}/lib/libgflags.lib
5852
)
5953
ENDIF()
6054
ENDIF(WIN32)
55+
ADD_LIBRARY(gflags STATIC IMPORTED GLOBAL)
56+
SET_PROPERTY(TARGET gflags PROPERTY IMPORTED_LOCATION ${GFLAGS_LIBRARIES})
57+
ADD_DEPENDENCIES(gflags extern_gflags)
6158

6259
LIST(APPEND external_project_dependencies gflags)
6360

cmake/external/glog.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ ELSE()
3434
SET(GLOG_REPOSITORY "https://github.com/google/glog.git")
3535
SET(GLOG_TAG "v0.3.5")
3636
ENDIF()
37+
3738
ExternalProject_Add(
3839
extern_glog
3940
${EXTERNAL_PROJECT_LOG_ARGS}
@@ -45,7 +46,6 @@ ExternalProject_Add(
4546
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
4647
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
4748
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
48-
-DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE}
4949
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
5050
-DCMAKE_INSTALL_PREFIX=${GLOG_INSTALL_DIR}
5151
-DCMAKE_INSTALL_LIBDIR=${GLOG_INSTALL_DIR}/lib

cmake/external/gtest.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ IF(WITH_TESTING)
5151
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
5252
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
5353
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
54-
-DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE}
5554
-DCMAKE_INSTALL_PREFIX=${GTEST_INSTALL_DIR}
5655
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
5756
-DBUILD_GMOCK=ON
@@ -71,5 +70,6 @@ IF(WITH_TESTING)
7170
ADD_LIBRARY(gtest_main STATIC IMPORTED GLOBAL)
7271
SET_PROPERTY(TARGET gtest_main PROPERTY IMPORTED_LOCATION ${GTEST_MAIN_LIBRARIES})
7372
ADD_DEPENDENCIES(gtest_main extern_gtest)
73+
7474
LIST(APPEND external_project_dependencies gtest gtest_main)
7575
ENDIF(WITH_TESTING)

cmake/external/openblas.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ INCLUDE_DIRECTORIES(${CBLAS_INC_DIR})
124124
# linear algebra libraries for cc_library(xxx SRCS xxx.c DEPS cblas)
125125
SET(dummyfile ${CMAKE_CURRENT_BINARY_DIR}/cblas_dummy.c)
126126
FILE(WRITE ${dummyfile} "const char *dummy_cblas = \"${dummyfile}\";")
127-
128127
ADD_LIBRARY(cblas STATIC ${dummyfile})
129128

130129
IF("${CBLAS_PROVIDER}" STREQUAL "MKLML")

cmake/flags.cmake

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,11 @@ set(GPU_COMMON_FLAGS
144144
-Wno-error=unused-function # Warnings in Numpy Header.
145145
-Wno-error=array-bounds # Warnings in Eigen::array
146146
)
147+
147148
else(NOT WIN32)
148149
set(COMMON_FLAGS
149-
-fPIC
150-
-fno-omit-frame-pointer
151150
"/w") #disable all warnings.
152151
set(GPU_COMMON_FLAGS
153-
-fPIC
154-
-fno-omit-frame-pointer
155152
"/w") #disable all warnings
156153
endif(NOT WIN32)
157154

@@ -167,8 +164,8 @@ endif(APPLE)
167164
if(LINUX)
168165
set(GPU_COMMON_FLAGS
169166
-Wall
170-
-Werror
171167
-Wextra
168+
-Werror
172169
${GPU_COMMON_FLAGS})
173170
endif(LINUX)
174171

cmake/generic.cmake

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,6 @@ function(cc_library TARGET_NAME)
238238
# add libxxx.lib prefix in windows
239239
set(${TARGET_NAME}_LIB_NAME "${CMAKE_STATIC_LIBRARY_PREFIX}${TARGET_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}" CACHE STRING "output library name for target ${TARGET_NAME}")
240240
endif(WIN32)
241-
242241
if(cc_library_SRCS)
243242
if(cc_library_SHARED OR cc_library_shared) # build *.so
244243
add_library(${TARGET_NAME} SHARED ${cc_library_SRCS})
@@ -308,11 +307,7 @@ function(cc_test TARGET_NAME)
308307
set(multiValueArgs SRCS DEPS ARGS)
309308
cmake_parse_arguments(cc_test "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
310309
add_executable(${TARGET_NAME} ${cc_test_SRCS})
311-
if(WIN32) # in windows deps. shlwapi library.
312-
target_link_libraries(${TARGET_NAME} ${cc_test_DEPS} paddle_gtest_main lod_tensor memory gtest gflags glog shlwapi)
313-
else(WIN32)
314310
target_link_libraries(${TARGET_NAME} ${cc_test_DEPS} paddle_gtest_main lod_tensor memory gtest gflags glog)
315-
endif(WIN32)
316311
add_dependencies(${TARGET_NAME} ${cc_test_DEPS} paddle_gtest_main lod_tensor memory gtest gflags glog)
317312
add_test(NAME ${TARGET_NAME}
318313
COMMAND ${TARGET_NAME} ${cc_test_ARGS}
@@ -383,11 +378,7 @@ function(nv_test TARGET_NAME)
383378
set(multiValueArgs SRCS DEPS)
384379
cmake_parse_arguments(nv_test "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
385380
cuda_add_executable(${TARGET_NAME} ${nv_test_SRCS})
386-
if(WIN32)
387-
target_link_libraries(${TARGET_NAME} ${nv_test_DEPS} paddle_gtest_main lod_tensor memory gtest gflags glog shlwapi)
388-
else(WIN32)
389381
target_link_libraries(${TARGET_NAME} ${nv_test_DEPS} paddle_gtest_main lod_tensor memory gtest gflags glog)
390-
endif(WIN32)
391382
add_dependencies(${TARGET_NAME} ${nv_test_DEPS} paddle_gtest_main lod_tensor memory gtest gflags glog)
392383
add_test(${TARGET_NAME} ${TARGET_NAME})
393384
if (nv_test_SERIAL)

0 commit comments

Comments
 (0)