I want to run the project using Anaconda, TensorFlow 2.3, Keras 2.4.3 (CNN example). OS Windows 10.
I installed Visual Studio 2019 Community Edition, CUDA 10.1 and cudnn 8.0.5 for CUDA 10.1.
Using Anaconda I created an environment with TensorFlow (tensorflow-gpu didn't help), Keras, matplotlib, scikit-learn. I tried to run it on CPU but it takes a lot of time (20 minutes for just 1 epoch when there are 35).
I need to run it using GPU, but TensorFlow doesn't see my GPU device (GeForce GTX 1060). Can someone help me find the problem? I tried to solve the problem using this guide tensorflow but it didn't help me.
This works 100%, no need to install anything manually (cuda for example)
conda create --name tf_gpu tensorflow-gpu
Ok so I tried to install all the components into new anaconda environment. But instead of "conda install tensorflow-gpu" I decided to write "pip install tensorflow-gpu" and now it works via GPU...
Just a heads up, the Cudnn version you were trying to use was incompatible.
Listing Versions and compatible CUDA+Cudnn
You can go here and then scroll down to the bottom to see what versions of CUDA and Cudnn were used to build TensorFlow.
Related
I'm trying to use tensorflow with my PC's GPU (Nvidia RTX 3070Ti) in python-conda environment. I'm solving a small image-classification problem from kaggle. I've solved it in google-collab, but now I'm intrested in solving it on my local machine. However TF doesn't work properly locally and I have no idea why. I've read tons of solutions but it didn't help yet.
I'm following this guide and always install proper versions of TF and CUDA: https://www.tensorflow.org/install/source_windows
cuda-toolkit 10.1, cudnn 7.6, tf-gpu 2.3, python 3.8
Also I've installed latest NVidia drivers for videocard.
What I've tried:
I've installed proper version CUDA-toolkit and CUDnn from nvidia site. I've installed it properly and included everything that was needed into PATH. I've checked it - MS Visiual Studio finds both CUDA and CUDnn and can work with it. I've installed proper version of Tensorflow-GPU using conda into my environment.
Result: TF can't find my GPU and uses only CPU.
I've removed all CUDA and CUDAnn drivers. I've installed CUDA-toolkit, CUDnn and Tensorflow-GPU python packages into my conda environment.
Result: TF recognizes my GPU and uses it! But during DNN training happens error: Failed to launch ptxas Relying on driver to perform ptx compilation. Modify $PATH to customize ptxas location. And training goes very bad - accuracy is very low and doesn't improving.
When I use absolutely same code and data on google-collab, everything is going smoothly - I get ~90% accuracy on 5th epoch.
I've tried tf 2.1 and relevant cuda and cudnn, but it's still same result!
I've tried to install cudatoolkit-dev, but it didn't help to solve ptxas problem.
I'm about to give up and use PyTorch instead of Tensorflow.
So here is what worked for me:
Create 3.9 python environment
Install cuda and tensorflow packages from "Esri":
conda install -c esri cudatoolkit
conda install -c esri cudnn
conda install -c esri tensorflow-gpu
Then install tensorflow-hub:
conda install -c conda-forge tensorflow-hub
It will downgrade installations from previous steps, but it works. Maybe installing tensorflow-hub first could help to avoid it, but I didn't test it.
This weekend I have been trying a lot to install and get Tensorflow with GPU support to work on my computer, but I am not very experienced in using pip/conda and are now quite confused after watching and trying a lot of different tutorials/approaches from the web.
I have a GeForce GTX 1650 graphics card, and I have installed Cuda 10.0 (also 11.2, but I removed it from "PATH" and are only using the 10.0 version, I don't think that's a problem).
I have downloaded cuDNN 7.5.0 for CUDA 10, and I think that I have copied and placed the files correctly (installed cuDNN).
I am just trying to get some version of Tensorflow-gpu to work, but you can see the Tensorflow version i have been trying for now on the image.
I have tried to install and uninstall Python from my computer (I've also reinstalled Anaconda a lot of times), because I am not sure if I need to have a Python version installed (on my system) if I install a version of Python inside my Anaconda environment (in my example Python 3.7).
Does anyone know how to install Tensorflow GPU on Windows 10 with my settings (cuDNN 7.5.0, CUDA 10), or maybe have encountered some trouble with Python versions or Anaconda problems similar to mine?
Follow these steps to install Tensorflow GPU on windows system.
Make sure right version of Visual studio is installed. Check here.
Follow the instructions mentioned here to setup CUDA for windows system
Install Tensorflow
#check current python version
python --version
#Create the virtual environment
conda create -n tf python=PYTHON_VERSION
#Activate the tf environment
conda activate tf
#Install Tensorflow
pip install tensorflow
#Install CUDA and cuDNN using conda and make sure CUDA and cuDNN version should match the Tensorflow version
conda install -c anaconda cudatoolkit=10.0 cudnn=7.5
I want to use Tensorflow on GPU. So I install all the needed tool and installed as below-
CUDA-11.2
CUDNN-11.1
Anaconda-2020.11
Tensorflow-GPU-2.3.0
I tested that my cuda,cudnn is working using deviseQuery example.
But Tensorflow not used GPU. Then i find that version compatibility issue is possible so i innstalled CudaToolkit,cudnn using conda environment checking with version compatibility on Tensorflow website which is given below.
CUDA-10.2.89
CUDNN-7.6.5
Tensorflow-GPU-2.3.0
But after this try Tensorflow-GPU not used GPU,yet. so what i am doing now? Any steps or suggestion require.
The installation engine has a problem for tensorflow-gpu 2.3 in Anaconda on Windows 10.
Workaround is to explicitly specify the correct tensorflow build:
conda install tensorflow-gpu=2.3 tensorflow=2.3=mkl_py38h1fcfbd6_0
I got a new pc recently with a windows 10 and an RTX 2070. I installed anaconda in order to use python and the deep learning frameworks available as keras. I install with anaconda navigator the keras-gpu package. It seems that installing this package will install a "cuda-toolkit 10" and "cudnn" package on anaconda.
I was wondering if my gpu will be used in a optimize way during the training on keras. In fact, in the past, when I installed keras gpu , I had to install microsoft community 2015 and cuda toolkit 9.0/Cudnn on my own in order to make keras gpu working. So, it seems a bit weird that I had no error.
Thank for the help !
It depends on what backends your keras is using.
e.g. If you are using tensorflow, the following statement will give you the answer.
print(tf.test.is_gpu_available())
in a few days I will setup my new computer with a RTX 2070.
I would like to user tensorflow GPU but I can't find compatible versions of CUDA and Tensorflow GPU.
As far as I know, I need CUDA 10 to benefit from the additional computing power of the RTX's Turing architecture. But regarding to the Tensorflow website the newest version of tf (tensorflow_gpu-1.12.0) only works with CUDA 9.
I would prefer to get it all working on windows 10 but if there is no other way, linux would work as well.
Somewhere on the internet I read about two rumors:
1. there is some way to compile an unpublished version of tf-gpu which works with CUDA 10
2. they will publish an official version of tf-gpu in january 2019 (which is almost over now) which will support CUDA 10.
Can someone confirm one of those rumors (with source would be the best) or tell me how I will be able to get it all working?
You're correct that you need cuda 10 and that tensorflow-gpu currently doesn't support it. What you need to do is compile tensorflow from source like your first rumor.
Installation steps:
Install CUDA 10 and cuDNN 7.3.1
Configure Tensorflow and compile it
Install the .whl package with pip
Here are some tutorials to compile tensorflow.
Windows:
https://www.pytorials.com/how-to-install-tensorflow-gpu-with-cuda-10-0-for-python-on-windows/2/
Ubuntu:
https://medium.com/#saitejadommeti/building-tensorflow-gpu-from-source-for-rtx-2080-96fed102fcca
https://towardsdatascience.com/how-to-make-tensorflow-work-on-rtx-20xx-series-73eb409bd3c0
Alternatively
you can find the pre-built tensorflow wheels here, thus skipping step 2:
https://github.com/fo40225/tensorflow-windows-wheel