0

I am trying to use in tensorflow to train a CNN network for some image classification. Obviously, the training running on my CPU is incredibly slow and so I need to use my GPU to do the training. I've found many similar questions on StackOverflow, none of which have helped me get the GPU to work, hence I am asking this question separately.

I've got an NVIDIA GeForce GTX 1060 3GB and the 466.47 NVIDIA driver installed. I've installed the CUDA toolkit from the NVIDIA website (installation is confirmed with nvcc -V command outputting my version 11.3), and downloaded the CUDNN library. I unzipped the CUDNN file and copied the files to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3, as stated on the NVIDIA website. Finally, I've checked that it's on PATH (C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\bin and C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3\libnvvp are both in the environment variable 'Path').

I then set up an environment using conda, downloading some packages that I need, like , as well as tensorflow-gpu=2.3 After booting my environment into Jupyter Notebook, I run this code to check to see if it's picking up the GPU:

import tensorflow as tf
print(tf.__version__)
print(tf.config.list_physical_devices())

And get this:

2.3.0 [PhysicalDevice(name='/physical_device:CPU:0', device_type='CPU')]

I have tried literally everything I have come across on this topic, but I am not having any success getting it to work. Any help would be appreciated.

2
  • Get CUDA to work, then install tensorflow-gpu (not tensorflow only) Commented May 26, 2021 at 6:07
  • Yes, I did that Commented May 26, 2021 at 6:13

4 Answers 4

2

First, you have to install all CUDA requirements. If you have Ubuntu 20.04, here is how you can install the requirements. Then, it's the right time to install . As you intend to utilize your GPU, you have to install the library, not alone.

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, as I stated in the question, I installed all CUDA requirements and THEN instaleld tensorflow gpu.
0

I'm guessing you have installed TensorFlow correctly using pip install tensorflow. NVIDIA GPU cards with CUDA architectures 3.5, 5.0, 6.0, 7.0, 7.5, 8.0 and higher than 8.0 are currently supported by TensorFlow. If you have the supported cards but TensorFlow cannot detect your GPU, you have to install the following software:

You can optionally install TensorRT 6.0 to improve latency and throughput for inference on some models. For more info, please refer to the TensorFlow documentation: https://www.tensorflow.org/install/gpu

2 Comments

Sorry, can you explain the compatability? Why do I need cuDNN SDK 8.0.4 for CUDA 11.3, can I not use the latest version of cuDNN, 8.2.0, as [developer.nvidia.com/rdp/cudnn-download](NVIDIA) states that 8.2.0 works for 11.x?
Sorry for the late reply, cuDNN 8.2.0 works for 11.x, therefore you can also use cuDNN 8.2.0
-1

I recommend to use conda to install the CUDA Toolkit packages as well as CUDNN, which will avoid wasting time downloading the right packages (or making changes in the system folders)

conda install -c conda-forge cudatoolkit=11.0 cudnn=8.1

Then you can install keras and tensorflow-gpu by typing

conda install keras==2.7
pip install tensorflow-gpu==2.7

and it will work directly.

Based on this issue

Comments

-1

you don't say what platform you are on. If it is windows, only tensorflow 2.10 and no higher will work.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.