Skip to content

Commit

Permalink
【Cherry-pick PR47743】change cudnn error to cuda error if compiled cud…
Browse files Browse the repository at this point in the history
…a version is incompatible with installed cuda version (#47744)

* cherry-pick pr47743

* fix

* fix

* fix
  • Loading branch information
pangyoki committed Nov 10, 2022
1 parent 51248f8 commit 76b883c
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions paddle/phi/backends/gpu/gpu_resources.cc
Expand Up @@ -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<int>(place.device)
Expand All @@ -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
}

Expand Down

0 comments on commit 76b883c

Please sign in to comment.