Skip to content
Latchkey

Check the cuDNN Version in CI

The cuDNN version lives in cudnn_version.h (CUDNN_MAJOR/MINOR/PATCHLEVEL) and can be read from the header, ldconfig, or the framework that loads it.

Deep learning frameworks need a cuDNN whose version matches their build. When kernels fail to initialize, confirming the cuDNN version is the first step.

What it does

cuDNN is NVIDIA\u0027s deep neural network primitives library. Its version is defined by CUDNN_MAJOR, CUDNN_MINOR, and CUDNN_PATCHLEVEL macros in cudnn_version.h. Frameworks report the runtime cuDNN they loaded, which must be compatible with both the CUDA toolkit and the driver.

Common usage

Terminal
# read the version macros from the header
grep "#define CUDNN_MAJOR" -A 2 \
  /usr/include/cudnn_version.h
# find the installed shared library
ldconfig -p | grep libcudnn
# what cuDNN did PyTorch load?
python -c "import torch; print(torch.backends.cudnn.version())"

Options

MethodWhat it shows
cudnn_version.hCUDNN_MAJOR/MINOR/PATCHLEVEL at build time
ldconfig -p | grep libcudnnThe installed shared library and path
torch.backends.cudnn.version()cuDNN version PyTorch loaded at runtime
LD_LIBRARY_PATHWhere the runtime searches for libcudnn

In CI

Log the cuDNN version alongside the CUDA and driver versions so an incompatibility is obvious in the build record. The header lives in cudnn_version.h on cuDNN 8+ (older releases put the macros in cudnn.h). The runtime library must be findable via LD_LIBRARY_PATH.

Common errors in CI

"Could not load library libcudnn.so.8 ... cannot open shared object file" means cuDNN is not installed or not on LD_LIBRARY_PATH. "RuntimeError: cuDNN error: CUDNN_STATUS_NOT_INITIALIZED" or "CUDNN_STATUS_VERSION_MISMATCH" means the loaded cuDNN is incompatible with the framework or driver. A grep finding nothing in cudnn_version.h usually means the dev headers package is not installed, only the runtime.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →