I had to reinstall completely my python distribution lately and for some reasons I cannot run keras on GPU anymore.
I followed the instructions from Can I run Keras model on gpu? but for some reason, I do not see my GPU when trying to list the devices.
my versions are :
tensorflow & tensorflow-gpu : 2.3.0
keras : 2.3.1
cudatoolkit : 11.3.1
I have not installed cudnn yet as the instructions are a bit blurry for me : do I have to install it in the cudatoolkit directory ? Is it required to run on GPU ?
Thanks
OK so here is the solution :
Python 3.7.13 requires tensorflow-gpu 2.1.0 to detect gpu.
So the correct set of versions is :
Python 3.7.13
tensorflow 2.1.0
keras 2.3.0
cudnn 7.6.5
cudatoolkit 10.1.243
with this it works. Be careful that for some reason, in my case tensorflow downloaded tensorflow-estimator 2.6.0. I had to downgrade to 2.1.0 to get spyder running.
I have encounter "I tensorflow/stream_executor/cuda/cuda_dnn.cc:368] Loaded cuDNN version 8400
Could not load library cudnn_cnn_infer64_8.dll. Error code 193"
will working with TensorFlow.
version:
TensorFlow 2.8
CUDA 11.6
CUDNN 8.4
The versions you installed for TensorFlow and NVIDIA CUDA probably don't match.
Try using one of the versions tested here: Tensorflow GPU Source Install
Don't forget to install "tensorflow-gpu" module instead of "tensorflow" in order to use NVIDIA GPU Acceleration.
i simply used conda insted pip to install cuda and cudnn. then used pip for the tensorflow gpu instalation. vrsions that worked with each other are cuda 11.2 and tensorflow2.10. anything above 2.10 not suport gpu
I am trying to use keras 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 scikit-learn, 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 into contact with on this topic, but am not getting any success in getting it to work. Any help would be appreciated.
You, first, 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 tensorflow. Asa you intended to utilize your GPU, you have install tensorflow-gpu library, not tensorflow alone.
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:
NVIDIA GPU drivers —CUDA 11.0 requires 450.x or higher.
CUDA Toolkit —TensorFlow supports CUDA 11 (TensorFlow >= 2.4.0)
cuDNN SDK 8.0.4
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
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
Describe the problem:
Error : Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
System Information:
I am working on Spyder in Anaconda.
OS Platform: Windows 10
TensorFlow version: 1.15
Python version: 3.6
Installation command: conda create -n MRI pyrhon=3.6 Tensorflow-gpu
CUDA/cuDNN version: Cudnn- 7.5.0 , CUDA- 10.1
GPU model and memory: GeForce RTX 2060
Can anyone tell me what is the problem?? Why CuDNN is failed to initialize?
Most probably your Cuda version is too high, Only TF2.0 and above support 10.1. For lower versions, you need CUDA 10.0. So uninstall 10.1 completely and install CUDA 10.0.
Cuda 10 for tf 1.13>=
Cuda 10.1 for TF 1.14>=
I am trying to use tensorflow with gpu and installed CUDA 8.0 toolkit and cuDNn v5.1 libraries as described in nvidia website. But when I try to import tensorflow as module in python3.5, it does not load cuDNn libraries (outputs nothing, just loads tensorflow module). And I do not observe speed in processing (same speed I obtained when I use CPU) with GPU.
Fresh install is the key but there are some important points:
1. Install CUDA 8.0 toolkit
2. Install cuDNn 5.1 version (not 6.0)
3. Install from source(bazel) and configure to use ensorflow with CUDA
Above steps worked for me! Hope it helps anyone.