I have tried to get my laptop gpu to work with tensorflow, however I keep encountering this issue
I had tensorflow installed through pip (on anaconda env) with CUDA 11.2 and CUDnn 8.1, and it won't work!
I then tried a previously known version to work (tensorflow 2.4 with CUDA 11.0 and so on.
-but pip will not install tensorflow 2.4.0 (I am assuming it is no longer supported)
I have included a photo with proof of my cuda and cudnn versions
I believe the issue may lie in the folder you extract your cuDNN to.
Personally, I've extracted my cuDNN to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2.
When you open the zip cuDNN file, open the "cuda" file in the zip, and then extract the rest (bin etc.) into the above mentioned directory.
Make sure you restart the program/kernel so it can detect the new files.
Also, don't forget to add the CUDA path to your environment variables, though as it knows to look for cudnn64_8.dll I expect this is fine.
Related
What are the steps to get tensorflow-gpu 2.x Python package working on Windows with an NVidia GPU?
I.e. how can I get rid of Could not find 'cudart64_101.dll' and then Could not find 'cudnn64_7.dll'?
Steps
Requires specific versions according to the error messages you see, not latest versions!
1. Download and install latest NVidia driver
https://www.nvidia.com/Download/index.aspx
2. Install Tensorflow Python package
pip uninstall tensorflow
pip install tensorflow-gpu
(*) For newer versions, tensorflow and tensorflow-gpu are the same package, so just update tensorflow using:
pip install --upgrade tensforflow
3. Test
At first the following test will fail, pay attention to version of missing file e.g. Could not find 'cudart64_101.dll'
import tensorflow
tensorflow.test.is_built_with_gpu_support() # Test install of pip package, should output True
tensorflow.test.is_gpu_available() # Should output True
tensorflow.test.gpu_device_name() # Should output something like /device:GPU:0
# update for last test:
tensorflow.config.list_physical_devices('GPU')
4. Download and install CUDA Toolkit 10.1 local setup
The version you need is the one not found e.g. cudart64_101.dll --> version 10.1.
You will need to unselect components because setup contains an older driver, in network setup this doesn't work right
https://developer.nvidia.com/cuda-10.1-download-archive-base?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exelocal
Select custom setup and:
Unselect CUDA / Visual Studio Integration
Unselect Driver components
5. Make sure these folders have been added to path:
And no other versions of CUDA
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\libnvvp;
6. Test again
Restart your IDE for it to receive new environment variables (including PATH)
Will fail, pay attention to version of missing file e.g. Could not find 'cudnn64_7.dll'
7. Download and manually install CUDNN 7.6.5 for CUDA 10.1
The version you need is the one not found e.g. cudnn64_7.dll --> version 7.x for CUDA 10.1 (or the version of CUDA you needed)
https://developer.nvidia.com/rdp/cudnn-archive
Unzip and copy content of cuda folder into: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\ (or the version you downloaded and installed)
If you have any conflicts, skip duplicate files
8. Test again
Should work this time, assuming you downloaded the correct versions
This has been asked countless times here, but I could not find solution that fits my problem.
I am trying to install tensorflow-gpu on Windows 10, Anaconda. I downloaded CUDA (Version 10.2) and CuDNN, I have moved files from CuDNN library to CUDA folders and added following variables to PATH:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\libnvvp
After running following code in anaconda, I get following response:
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())
I am guessing the main problem is "Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found", so I went to my CUDA bin folder and there is no cudart64_101.dll, but there is cudart64_102.dll. What should I do to fix this?
The last three numbers in your .dll files should point you to a solution. TensorFlow is looking for CUDA 10.1, but you have installed CUDA 10.2.
Re-installing CUDA and the compatible cuDNN should fix your problem. See the TensorFlow installation tutorial for the exact versions of CUDA and cuDNN.
You'll probably have to reinstall TF as well, after installing the correct CUDA libraries.
Hope this helps.
The machine I'm using is with Titan XP and running Ubuntu 18.10. I'm not the owner so I'm not sure how it was configured previously. The cuda version is 9.*, most likely 9.0. There is no folder like /usr/local/cuda. Though it sounds strange (because no Cuda is compatible with 18.10), previously it worked pretty well both for Tensorflow and Pytorch. Now, when running tensorflow-gpu v1.12.0 in python 2.7, cudatoolkit 9.2 and cudnn 7.2.1 (this worked well previously without any change), it reports:
ImportError: libcublas.so.9.0: cannot open shared object file: No such file of directory
But, when I change my conda env to python 3.6 with pytorch 0.4.1 , cudatoolkit 9.0 and cudnn 7.6 (they are shown in pycharm). There is:
torch.cuda.is_available() # True
This shows that GPU is running in Pytorch code. Also I've checked GPU RAM by nvidia-smi, when Pytorch is running, RAM is occupied.
Although there is no Cuda folder like /usr/local/cuda/, when I run:
nvcc - V
There is:
Cuda compilation tools, release 9.1, V9.1.85
Can someone give me a hint about how these strange things happen? What should I do to make my tensorflow-gpu works? I get totally confused orz.
Anaconda environments install their own version of the CUDA toolkit when you install things like pytorch and tensorflow-gpu with conda. That looks like it's how your Python 3.6 environment was set up. Is your 2.7 version of Python a system install or part of another Python environment? It's possible that your Tensorflow was built against a CUDA toolkit that is no longer installed, for whatever reason, or in any case that you were trying to use Tensorflow while not having the path to the libraries that it was built against in your LD_LIBRARY_PATH (perhaps because of an unusual install location)
You can type which nvcc to see which part of your PATH is currently pointing to that executable. That will tell you where your CUDA toolkit is installed. I'm guessing that your PATH was still pointing to a conda environment when you last ran nvcc, or to some version of the CUDA toolkit in an unusual install location in any case.
First, I'd suggest abandoning any effort to use your system python with Tensorflow. My suggestion is to either modify or create a new conda environment and install tensorflow-gpu with conda, which will also install the CUDA toolkit for that environment. Note that your CUDA install will not be in /usr/local/cuda if you go down this path, it'll be located inside your conda environment instead.
I have a GPU of NVIDIA GeForce 940mx GDDR5 2GB on my laptop. I want to use TensorFlow with GPU support.
I tried steps of installing tensorflow from the link
https://www.tensorflow.org/install/install_windows
I have installed :
CUDA 9.0 toolkit with all three patches updates available on https://developer.nvidia.com/cuda-90-download-archive?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exelocal
cuDNN 7.1.4 for CUDA toolkit 9.0 from https://developer.nvidia.com/rdp/cudnn-download
pip install tensorflow-gpu
While import tensorflow using:
import tensorflow as tf
I got an error:
ImportError: Could not find 'cudart64_90.dll'. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Download and install CUDA 9.0 from this URL: https://developer.nvidia.com/cuda-toolkit
I have that file in 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin' and my system environment path variable has also been configured to this directory, what else could be the issue?
I am going to speculate a little bit here so maybe I'm just wrong but I'm going to assume you've got running a command prompt, you install CUDA, you update the env.var PATH adding the CUDA paths and you forgot to restart the command prompt. If it's so, the process where you run Python won't have PATH env.var updated? To make sure about this one, just do python -c 'import os; print(os.environ["PATH"])' and confirm it.
If PATH is ok on the command prompt process, recheck again the CUDA directories, search cudart64_90.dll and make sure the path where that file lives has been added correctly to PATH.
And if the previous step failed, well, I'd say your best chance is opening the Tensorflow file where that dll is being loaded and make some debugging there.
trying to install tensorflow gpu on windows 10 since three days.
https://www.tensorflow.org/install/install_windows#requirements_to_run_tensorflow_with_gpu_support
says :
If you are installing TensorFlow with GPU support using one of the mechanisms described in this guide, then the following NVIDIA software must be installed on your system:
CUDA® Toolkit 9.0. For details, see NVIDIA's documentation Ensure that you append the relevant Cuda pathnames to the %PATH% environment variable as described in the NVIDIA documentation.
The NVIDIA drivers associated with CUDA Toolkit 9.0.
cuDNN v6.0. For details, see NVIDIA's documentation. Note that cuDNN is typically installed in a different location from the other CUDA DLLs. Ensure that you add the directory where you installed the cuDNN DLL to your %PATH% environment variable.
GPU card with CUDA Compute Capability 3.0 or higher. See NVIDIA documentation for a list of supported GPU cards.
I downloaded cuda toolkit 9.0 from archives.
but there is no cudnn 6.0 for cuda 9.0 here : https://developer.nvidia.com/rdp/cudnn-download
It's driving me mad, as only thing available there is cudnn v7.
Please help me.
Apparently I cant comment... but I am having this exact same issue! Tensorflow has conflicting requirements for install. Cuda Tookit V8.0 is the last supported version for cudnn V6.0
For everyone who comes to this thread with issues on cudNN or cudart errors, here's a few notes:
Tensorflow documentation may or may not be updated quickly enough after a new release.
Tensorflow can be compiled (built) from scratch, which allows you to decide what CUDA and cuDNN version to use, so if you are using a pre-compiled binary, you will need the version of CUDA and cuDNN it was built for.
You need to have cuDNN in the path.
Tensorflow's documentation for installing a binary will always specify the version of CUDA and cuDNN it needs.
If things don't work, try running a simple hello world tensorflow program and read the errors to know what version of CUDA / cuDNN to use.
For example, a missing cudart64_81.dll needs the 64 bit version of CUDA 8.1.
A missing cudnn64_6.dll needs cuDNN 6.0
CUDA can be downloaded from: https://developer.nvidia.com/cuda-toolkit-archive
cuDNN can be downloaded from: https://developer.nvidia.com/rdp/cudnn-archive