TensorFlow
CUDA
Machine Learning
Deep Learning
GPU Computing

Tensorflow and CUDA version

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

TensorFlow GPU support depends on matching TensorFlow, CUDA, cuDNN, platform, and installation method. The important rule is not "pick any CUDA version near your TensorFlow version," but "use the compatibility combination documented for the TensorFlow release and install path you are actually using."

The Compatibility Question Has Changed

Older TensorFlow setups often required developers to install exact CUDA and cuDNN versions manually. Current TensorFlow guidance is more nuanced:

  • for pip installs on supported Linux and WSL2 setups, tensorflow[and-cuda] is now the official path
  • for source builds, TensorFlow still publishes CUDA and cuDNN compatibility tables
  • native Windows GPU support ended after TensorFlow 2.10

So the right answer depends on whether you are installing wheels or building from source.

Current Official Source-Build Compatibility

According to TensorFlow's current official source-build compatibility table, these combinations apply for recent GPU builds:

  • TensorFlow 2.20.0: CUDA 12.5 and cuDNN 9.3
  • TensorFlow 2.19.0: CUDA 12.5 and cuDNN 9.3
  • TensorFlow 2.18.0: CUDA 12.5 and cuDNN 9.3
  • TensorFlow 2.17.0: CUDA 12.3 and cuDNN 8.9
  • TensorFlow 2.16.1: CUDA 12.3 and cuDNN 8.9
  • TensorFlow 2.15.0: CUDA 12.2 and cuDNN 8.9

These are source-build combinations, not a license to mix arbitrary package versions in an ad hoc environment.

Current Official Pip Guidance

For many Linux and WSL2 users, the official pip installation path is now:

bash
python3 -m pip install 'tensorflow[and-cuda]'
python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

This reduces manual CUDA dependency management compared with older instructions that required installing every NVIDIA library version yourself.

That said, platform still matters. TensorFlow's install page explicitly treats Linux, macOS, Windows native, and WSL2 differently.

Windows Native Is a Special Case

This is the rule many older answers miss: TensorFlow 2.10 was the last release with GPU support on native Windows. Starting with TensorFlow 2.11, official guidance is to use WSL2 for TensorFlow GPU workflows on Windows.

So if someone says "TensorFlow 2.15 plus CUDA on native Windows," the problem is not just CUDA matching. The platform itself is unsupported for official native-Windows GPU use.

Verify Instead of Guessing

After installation, verify what TensorFlow can actually see.

python
1import tensorflow as tf
2
3print("TensorFlow version:", tf.__version__)
4print("GPUs:", tf.config.list_physical_devices("GPU"))
5print("Build info:", tf.sysconfig.get_build_info())

This does not replace the compatibility table, but it tells you whether the environment is actually loading GPU support.

When a Source Build Is Necessary

You may need a source build if:

  • your GPU architecture is not well served by the published wheel
  • you need a different CUDA or cuDNN setup than the official pip path expects
  • you are working in an unusual enterprise environment with tightly controlled system libraries

TensorFlow's source-build guide also notes that starting from 2.18, GPU wheels can be built from source without a GPU present on the build machine.

Common Pitfalls

The biggest pitfall is following an old blog post that hardcodes a CUDA version without checking TensorFlow's current compatibility page. These combinations change over time.

Another issue is mixing installation models. A source-build compatibility table is not the same thing as the simplest pip installation recommendation for a standard Linux user.

Developers also waste time debugging CUDA version mismatches on native Windows with TensorFlow 2.11 and later, even though official native-Windows GPU support ended at 2.10.

Finally, do not stop at successful installation logs. Always verify GPU visibility from inside Python.

Summary

  • Match TensorFlow, CUDA, and cuDNN according to TensorFlow's official compatibility guidance for your exact install method.
  • For many Linux and WSL2 setups, tensorflow[and-cuda] is now the official pip path.
  • Current source-build tables list recent combinations such as TensorFlow 2.20.0 with CUDA 12.5 and cuDNN 9.3.
  • Native Windows GPU support officially stopped after TensorFlow 2.10.
  • Verify the final environment with tf.config.list_physical_devices("GPU") and tf.sysconfig.get_build_info().

Course illustration
Course illustration

All Rights Reserved.