diff --git a/CMakeLists.txt b/CMakeLists.txt index 12f5b6f8bd8976bac599e3ca8aae2f7db6cf7e58..956f430ab045f836540a74b6ca838c62e47501e1 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,7 +55,6 @@ if(WIN32) set(CMAKE_SUPPRESS_REGENERATION ON) set(CMAKE_STATIC_LIBRARY_PREFIX lib) - add_definitions("/DGOOGLE_GLOG_DLL_DECL=") if (MSVC_STATIC_CRT) message(STATUS "Use static C runtime time, refer to https://docs.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features?view=vs-2019") diff --git a/cmake/external/boost.cmake b/cmake/external/boost.cmake index e72008354a2cad4d313297efac1efb13d555fdf6..f14195480b7dc80df0566c9b09075797010fe289 100644 --- a/cmake/external/boost.cmake +++ b/cmake/external/boost.cmake @@ -38,6 +38,10 @@ set(BOOST_INCLUDE_DIR "${BOOST_SOURCE_DIR}" CACHE PATH "boost include directory. set_directory_properties(PROPERTIES CLEAN_NO_CUSTOM 1) include_directories(${BOOST_INCLUDE_DIR}) +if(WIN32 AND MSVC_VERSION GREATER_EQUAL 1600) + add_definitions(-DBOOST_HAS_STATIC_ASSERT) +endif() + ExternalProject_Add( ${BOOST_PROJECT} ${EXTERNAL_PROJECT_LOG_ARGS} diff --git a/cmake/external/glog.cmake b/cmake/external/glog.cmake index 649152bd436361493189f422c0c1dc2381fe70a7..81d0e642f794da331769cb1b367afb069d9397fb 100644 --- a/cmake/external/glog.cmake +++ b/cmake/external/glog.cmake @@ -24,6 +24,7 @@ SET(GLOG_TAG v0.3.5) IF(WIN32) SET(GLOG_LIBRARIES "${GLOG_INSTALL_DIR}/lib/glog.lib" CACHE FILEPATH "glog library." FORCE) SET(GLOG_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267 /wd4530") + add_definitions("/DGOOGLE_GLOG_DLL_DECL=") ELSE(WIN32) SET(GLOG_LIBRARIES "${GLOG_INSTALL_DIR}/lib/libglog.a" CACHE FILEPATH "glog library." FORCE) SET(GLOG_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) diff --git a/cmake/generic.cmake b/cmake/generic.cmake index 5608a9d54d288c5338c042a580e2344bd12c376c..5475386224963b85a0d81458ec46b7a8a49deb15 100644 --- a/cmake/generic.cmake +++ b/cmake/generic.cmake @@ -448,9 +448,9 @@ function(nv_library TARGET_NAME) message(FATAL "Please specify source file or library in nv_library.") endif() endif(nv_library_SRCS) - if (WIN32) + if (WIN32 AND ${CMAKE_CUDA_COMPILER_VERSION} LESS 11.0) set_target_properties(${TARGET_NAME} PROPERTIES VS_USER_PROPS ${WIN_PROPS}) - endif(WIN32) + endif() endif() endfunction(nv_library) @@ -466,9 +466,9 @@ function(nv_binary TARGET_NAME) add_dependencies(${TARGET_NAME} ${nv_binary_DEPS}) common_link(${TARGET_NAME}) endif() - if (WIN32) + if (WIN32 AND ${CMAKE_CUDA_COMPILER_VERSION} LESS 11.0) set_target_properties(${TARGET_NAME} PROPERTIES VS_USER_PROPS ${WIN_PROPS}) - endif(WIN32) + endif() endif() endfunction(nv_binary) @@ -490,9 +490,9 @@ function(nv_test TARGET_NAME) set_property(TEST ${TARGET_NAME} PROPERTY ENVIRONMENT FLAGS_cpu_deterministic=true) set_property(TEST ${TARGET_NAME} PROPERTY ENVIRONMENT FLAGS_init_allocated_mem=true) set_property(TEST ${TARGET_NAME} PROPERTY ENVIRONMENT FLAGS_cudnn_deterministic=true) - if (WIN32) + if (WIN32 AND ${CMAKE_CUDA_COMPILER_VERSION} LESS 11.0) set_target_properties(${TARGET_NAME} PROPERTIES VS_USER_PROPS ${WIN_PROPS}) - endif(WIN32) + endif() endif() endfunction(nv_test) diff --git a/paddle/fluid/platform/dynload/dynamic_loader.cc b/paddle/fluid/platform/dynload/dynamic_loader.cc index 4d911d12e5520dc21ea6551e3a74a3fb701b8efc..03cd5814afdb52dc8d84a3c8ac0ce0f7497e5f34 100644 --- a/paddle/fluid/platform/dynload/dynamic_loader.cc +++ b/paddle/fluid/platform/dynload/dynamic_loader.cc @@ -67,16 +67,25 @@ static constexpr char cuda_lib_path[] = "/usr/local/cuda/lib64"; static PathNode s_py_site_pkg_path; #if defined(_WIN32) && defined(PADDLE_WITH_CUDA) +static constexpr char* win_cudnn_lib = "cudnn64_" CUDNN_MAJOR_VERSION ".dll"; static constexpr char* win_cublas_lib = "cublas64_" CUDA_VERSION_MAJOR CUDA_VERSION_MINOR ".dll;cublas64_" CUDA_VERSION_MAJOR ".dll"; +#if CUDA_VERSION >= 11000 +static constexpr char* win_curand_lib = + "curand64_" CUDA_VERSION_MAJOR CUDA_VERSION_MINOR + ".dll;curand64_" CUDA_VERSION_MAJOR ".dll;curand64_10.dll"; +static constexpr char* win_cusolver_lib = + "cusolver64_" CUDA_VERSION_MAJOR CUDA_VERSION_MINOR + ".dll;cusolver64_" CUDA_VERSION_MAJOR ".dll;cusolver64_10.dll"; +#else static constexpr char* win_curand_lib = "curand64_" CUDA_VERSION_MAJOR CUDA_VERSION_MINOR ".dll;curand64_" CUDA_VERSION_MAJOR ".dll"; -static constexpr char* win_cudnn_lib = "cudnn64_" CUDNN_MAJOR_VERSION ".dll"; static constexpr char* win_cusolver_lib = "cusolver64_" CUDA_VERSION_MAJOR CUDA_VERSION_MINOR ".dll;cusolver64_" CUDA_VERSION_MAJOR ".dll"; +#endif // CUDA_VERSION #endif static inline std::string join(const std::string& part1,