From b96a21df4e7a42b2445104426e2be407534705e6 Mon Sep 17 00:00:00 2001 From: pangyoki Date: Thu, 10 Nov 2022 15:14:27 +0800 Subject: [PATCH] change cudnn error to cuda error if compiled cuda version is incompatible with installed cuda version (#47743) * fix cudnn error * fix * fix * fix --- paddle/phi/backends/gpu/gpu_resources.cc | 30 +++++++++++++----------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/paddle/phi/backends/gpu/gpu_resources.cc b/paddle/phi/backends/gpu/gpu_resources.cc index 4d2621cb6a0..4a16480101a 100644 --- a/paddle/phi/backends/gpu/gpu_resources.cc +++ b/paddle/phi/backends/gpu/gpu_resources.cc @@ -97,6 +97,22 @@ void InitGpuProperties(Place place, (*driver_version / 1000) * 10 + (*driver_version % 100) / 10; auto compile_cuda_version = (CUDA_VERSION / 1000) * 10 + (CUDA_VERSION % 100) / 10; +#if defined(__linux__) + PADDLE_ENFORCE_EQ( + (local_cuda_version / 10 < compile_cuda_version / 10) && + (cudnn_dso_ver / 1000 < CUDNN_VERSION / 1000), + false, + phi::errors::InvalidArgument( + "The installed Paddle is compiled with CUDA%d/cuDNN%d," + "but CUDA/cuDNN version in your machine is CUDA%d/cuDNN%d. " + "which will cause serious incompatible bug. " + "Please recompile or reinstall Paddle with compatible CUDA/cuDNN " + "version.", + compile_cuda_version / 10, + CUDNN_VERSION / 1000, + local_cuda_version / 10, + cudnn_dso_ver / 1000)); +#endif if (local_cuda_version < compile_cuda_version) { LOG_FIRST_N(WARNING, 1) << "WARNING: device: " << static_cast(place.device) @@ -108,20 +124,6 @@ void InitGpuProperties(Place place, << "Please recompile or reinstall Paddle with compatible CUDA " "version."; } - - auto local_cudnn_version = cudnn_dso_ver / 1000; - auto compile_cudnn_version = CUDNN_VERSION / 1000; - PADDLE_ENFORCE_EQ( - compile_cudnn_version, - local_cudnn_version, - phi::errors::InvalidArgument( - "The installed Paddle is compiled with CUDNN " - "%d, but CUDNN version in your machine is %d. " - "which will cause serious incompatible bug. " - "Please recompile or reinstall Paddle with compatible CUDNN " - "version.", - compile_cudnn_version, - local_cudnn_version)); #endif } -- GitLab