From 3925bd81e858d64343c6605806cbbea864bb783b Mon Sep 17 00:00:00 2001 From: Zeng Jinle <32832641+sneaxiy@users.noreply.github.com> Date: Fri, 7 Jun 2019 15:33:44 +0800 Subject: [PATCH] Fix cuda/cudnn version detection error (#17853) * fix cuda/cudnn version detection error, test=develop * fix again, test=develop --- paddle/fluid/platform/device_context.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/paddle/fluid/platform/device_context.cc b/paddle/fluid/platform/device_context.cc index 61386bdf05a..f55c4440250 100644 --- a/paddle/fluid/platform/device_context.cc +++ b/paddle/fluid/platform/device_context.cc @@ -268,12 +268,14 @@ CUDADeviceContext::CUDADeviceContext(CUDAPlace place) size_t cudnn_dso_ver = dynload::cudnnGetVersion(); LOG_FIRST_N(WARNING, 1) << "device: " << place_.device << ", cuDNN Version: " << cudnn_dso_ver / 1000 << "." - << (cudnn_dso_ver % 100) / 10 << "."; + << (cudnn_dso_ver % 1000) / 100 << "."; { // Check CUDA/CUDNN version compatiblity - auto local_cuda_version = runtime_version_ / 100; - auto compile_cuda_version = CUDA_VERSION / 100; + auto local_cuda_version = + (driver_version_ / 1000) * 10 + (driver_version_ % 100) / 10; + auto compile_cuda_version = + (CUDA_VERSION / 1000) * 10 + (CUDA_VERSION % 100) / 10; if (local_cuda_version < compile_cuda_version) { LOG_FIRST_N(WARNING, 1) << "WARNING: device: " << place_.device -- GitLab