From 90d420b13c24283263ee31e406dcb169e64350f3 Mon Sep 17 00:00:00 2001 From: T8T9 <62922815+T8T9@users.noreply.github.com> Date: Mon, 8 Jun 2020 19:09:01 +0800 Subject: [PATCH] add -DPADDLE_CUDA_BINVER (#24928) * add -DPADDLE_CUDA_BINVER. test=develop, test=win_gpu * nvcc will use add_compile_options, avoid using it if you don't want to pass arguments to nvcc. test=develop * test=develop, test=win_gpu --- CMakeLists.txt | 4 ++-- cmake/cuda.cmake | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 80e7f5bb0c3..91639493fb8 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,8 +54,8 @@ if(WIN32) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /bigobj /MT") endif() - add_compile_options(/wd4068 /wd4129 /wd4244 /wd4267 /wd4297 /wd4530 /wd4577 /wd4819 /wd4838) - add_compile_options(/MP) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4068 /wd4129 /wd4244 /wd4267 /wd4297 /wd4530 /wd4577 /wd4819 /wd4838 /MP") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4068 /wd4129 /wd4244 /wd4267 /wd4297 /wd4530 /wd4577 /wd4819 /wd4838 /MP") message(STATUS "Using parallel compiling (/MP)") set(PADDLE_LINK_FLAGS "/IGNORE:4006 /IGNORE:4098 /IGNORE:4217 /IGNORE:4221") set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} ${PADDLE_LINK_FLAGS}") diff --git a/cmake/cuda.cmake b/cmake/cuda.cmake index 82548b8c51c..38eab3597b6 100644 --- a/cmake/cuda.cmake +++ b/cmake/cuda.cmake @@ -186,7 +186,7 @@ elseif (${CMAKE_CUDA_COMPILER_VERSION} LESS 11.0) # CUDA 10.x set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -D__STRICT_ANSI__") endif() -message(STATUS "PADDLE_CUDA_BINVER=${CUDA_VERSION_MAJOR}${CUDA_VERSION_MINOR}") +add_definitions("-DPADDLE_CUDA_BINVER=\"${CUDA_VERSION_MAJOR}${CUDA_VERSION_MINOR}\"") if(NOT WITH_DSO) if(WIN32) -- GitLab