335

I have noticed that some newer TensorFlow versions are incompatible with older CUDA and cuDNN versions. Does an overview of the compatible versions or even a list of officially tested combinations exist? I can't find it in the TensorFlow documentation.

8
  • 34
    The question was addressing compatibility and (officially) tested combinations which, in my view, are not provided in the instructions for installation. Also, I cannot find the section you're referring to. These observations result in my overall view that the requested information is hard to find and therefore justifies providing easy access to the link posted in the answer.
    – whiletrue
    Commented May 31, 2018 at 11:44
  • You will find that the CUDA and cuDNN versions on the page you mention match the one of the installation instructions.
    – P-Gn
    Commented May 31, 2018 at 11:46
  • To find the installation instructions, go to the page I linked above then follow the link for your OS.
    – P-Gn
    Commented May 31, 2018 at 11:47
  • 1
    The section you're referring to just gives me the compatible version for CUDA and cuDNN --ONCE-- I have found out about my desired TensorFlow version. In the common case (for example in .edu lab environments) where CUDA and cuDNN are already installed but TF not, the necessity for an overview becomes apparent. My claim is that it's quite hidden and hard to find (I wasn't apple to find it via googling).
    – whiletrue
    Commented May 31, 2018 at 12:00
  • 1
    Oh I see what you mean -- trying to see which tensorflow version fits a particular CUDA/cuDNN combination. You could browse TF's release notes but the table you link to is indeed a good summary.
    – P-Gn
    Commented May 31, 2018 at 13:15

7 Answers 7

397

TL;DR) See this table: https://www.tensorflow.org/install/source#gpu

Generally:

Check the CUDA version:

cat /usr/local/cuda/version.txt

and cuDNN version:

grep CUDNN_MAJOR -A 2 /usr/local/cuda/include/cudnn.h

and install a combination as given below in the images or here.

The following images and the link provide an overview of the officially supported/tested combinations of CUDA and TensorFlow on Linux, macOS and Windows:

Minor configurations:

Since the given specifications below in some cases might be too broad, here is one specific configuration that works:

  • tensorflow-gpu==1.12.0
  • cuda==9.0
  • cuDNN==7.1.4

The corresponding cudnn can be downloaded here.

Tested build configurations

Please refer to https://www.tensorflow.org/install/source#gpu for a up-to-date compatibility chart (for official TF wheels).

(figures updated May 20, 2020)

Linux GPU

enter image description here

Linux CPU

enter image description here

macOS GPU

enter image description here

macOS CPU

enter image description here

Windows GPU

enter image description here

Windows CPU

enter image description here

Updated as of Dec 5 2020: For the updated information please refer Link for Linux and Link for Windows.

11
  • 1
    I did notice though that TensorFlow versions < 1.0 have been excluded from the overview. Does somebody have an idea where to find the same list for older versions?
    – whiletrue
    Commented May 31, 2018 at 10:49
  • 3
    Looks like they don't specify minor versions for cuda and cudnn,
    – mrgloom
    Commented Nov 30, 2018 at 0:58
  • 1
    UPDATE: tested TF-GPU 1.12, Windows 10, CUDA 9.0, CuDNN 7.3.1, Python 3.6.6
    – mjaniec
    Commented Feb 14, 2019 at 7:03
  • 4
    Don't update the figures, link to the documentation. The link changes less often than the tables
    – Trylks
    Commented Nov 7, 2019 at 14:51
  • 1
    @Fábio: Updated your answer with the Latest Links as per your request.
    – user11530462
    Commented Jan 14, 2020 at 10:48
32

The compatibility table given in the tensorflow site does not contain specific minor versions for cuda and cuDNN. However, if the specific versions are not met, there will be an error when you try to use tensorflow.

For tensorflow-gpu==1.12.0 and cuda==9.0, the compatible cuDNN version is 7.1.4, which can be downloaded from here after registration.

You can check your cuda version using
nvcc --version

cuDNN version using
cat /usr/include/cudnn.h | grep CUDNN_MAJOR -A 2

tensorflow-gpu version using
pip freeze | grep tensorflow-gpu

UPDATE: Since tensorflow 2.0, has been released, I will share the compatible cuda and cuDNN versions for it as well (for Ubuntu 18.04).

  • tensorflow-gpu = 2.0.0
  • cuda = 10.0
  • cuDNN = 7.6.0
1
  • Is it possible to train a TF1.4 model on a CUDA10 gpu card?
    – ivan866
    Commented Aug 11, 2020 at 13:45
5

if you are coding in jupyter notebook, and want to check which cuda version tf is using, run the follow command directly into jupyter cell:

!conda list cudatoolkit

!conda list cudnn

and to check if the gpu is visible to tf:

tf.test.is_gpu_available(
    cuda_only=False, min_cuda_compute_capability=None
)
5

Thanks for the first answer.

Something about backward compatibility.

I can successfully install tensorflow-2.4.0 with cuda-11.1 and cudnn 8.0.5.

TensorFlow GPU Compatibility Table

Source: https://www.tensorflow.org/install/source#gpu

3
  • Hello, can you tell me where did you find this chart please? When I click on the link provided in the messages above the chart stops at Tensorflow 2.6... Commented Apr 22, 2022 at 12:31
  • tensorflow.org/install/source#gpu
    – one
    Commented Apr 22, 2022 at 13:11
  • This link is now broken :-( Commented May 9 at 11:49
3

You can use this configuration for cuda 10.0 (10.1 does not work as of 3/18), this runs for me:

  • tensorflow>=1.12.0
  • tensorflow_gpu>=1.4

Install version tensorflow gpu:

pip install tensorflow-gpu==1.4.0
1
  • So, that effectively means that newer gpu cards do NOT support older software stacks, meaning the backwards compatibility is broken indeed? #NVIDIA
    – ivan866
    Commented Aug 11, 2020 at 13:51
1

I had installed CUDA 10.1 and CUDNN 7.6 by mistake. You can use following configurations (This worked for me - as of 9/10). :

  • Tensorflow-gpu == 1.14.0
  • CUDA 10.1
  • CUDNN 7.6
  • Ubuntu 18.04

But I had to create symlinks for it to work as tensorflow originally works with CUDA 10.

sudo ln -s /opt/cuda/targets/x86_64-linux/lib/libcublas.so /opt/cuda/targets/x86_64-linux/lib/libcublas.so.10.0
sudo cp /usr/lib/x86_64-linux-gnu/libcublas.so.10 /usr/local/cuda-10.1/lib64/
sudo ln -s /usr/local/cuda-10.1/lib64/libcublas.so.10 /usr/local/cuda-10.1/lib64/libcublas.so.10.0
sudo ln -s /usr/local/cuda/targets/x86_64-linux/lib/libcusolver.so.10 /usr/local/cuda/lib64/libcusolver.so.10.0
sudo ln -s /usr/local/cuda/targets/x86_64-linux/lib/libcurand.so.10 /usr/local/cuda/lib64/libcurand.so.10.0
sudo ln -s /usr/local/cuda/targets/x86_64-linux/lib/libcufft.so.10 /usr/local/cuda/lib64/libcufft.so.10.0
sudo ln -s /usr/local/cuda/targets/x86_64-linux/lib/libcudart.so /usr/local/cuda/lib64/libcudart.so.10.0
sudo ln -s /usr/local/cuda/targets/x86_64-linux/lib/libcusparse.so.10 /usr/local/cuda/lib64/libcusparse.so.10.0

And add the following to my ~/.bashrc -

export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
export PATH=/usr/local/cuda-10.1/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/cuda/targets/x86_64-linux/lib/
1
  • I believe utilising nvidia-docker software layer can deal with the problem of incompatible cuda-tf combinations. Describing how you found out which libs need to be rerouted with symlinks will also be good.
    – ivan866
    Commented Aug 11, 2020 at 13:47
-2

I had a similar problem after upgrading to TF 2.0. The CUDA version that TF was reporting did not match what Ubuntu 18.04 thought I had installed. It said I was using CUDA 7.5.0, but apt thought I had the right version installed.

What I eventually had to do was grep recursively in /usr/local for CUDNN_MAJOR, and I found that /usr/local/cuda-10.0/targets/x86_64-linux/include/cudnn.h did indeed specify the version as 7.5.0.
/usr/local/cuda-10.1 got it right, and /usr/local/cuda pointed to /usr/local/cuda-10.1, so it was (and remains) a mystery to me why TF was looking at /usr/local/cuda-10.0.

Anyway, I just moved /usr/local/cuda-10.0 to /usr/local/old-cuda-10.0 so TF couldn't find it any more and everything then worked like a charm.

It was all very frustrating, and I still feel like I just did a random hack. But it worked :) and perhaps this will help someone with a similar issue.

1
  • 10.0 is CUDA SDK version; 7.5 is Compute Capability of the GPU itself
    – ivan866
    Commented Aug 11, 2020 at 13:36

Not the answer you're looking for? Browse other questions tagged or ask your own question.