How to Setup TensorFlow GPU 2.2 with NVIDIA GPUs
Hello world, it’s Aaron!
NOTE: This article assumes you are on a Linux distro with at least 1 CUDA-capable NVIDIA GPU.
In this article, we will be installing NVIDIA CUDA and TensorFlow GPU 2.2.0-rc2!
- Right before we install CUDA, we need to make sure that your GPU is CUDA-capable. If no results are returned after this command, sorry, your GPU doesn’t support CUDA!
lspci | grep -i nvidia
2. Check you have a supported version of Linux:
uname -m && cat /etc/*release
3. Install GNU G++.
4. Install CUDA 10.1 (not CUDA 10.2, as TensorFlow GPU currently doesn't support CUDA 10.2) by clicking the link for your Linux distro:
- Linux 18.04: https://bit.ly/3c6oEZs
- Linux 18.10: https://bit.ly/2Xj5HhI
- Linux 16.04: https://bit.ly/3c4qk5C
- Linux 14.04: https://bit.ly/34qRd0P
5. Follow the instructions for deb(local).
6. Install cuDNN for CUDA 10.1 by clicking here: https://bit.ly/cudnn-instal
Install Anaconda and TensorFlow GPU
Great job on setting up CUDA! Now for the meat of this article: Installing TensorFlow GPU.
- Right before we get started, install Anaconda so we don’t get errors while running TensorFlow GPU. To install Anaconda, go to this link here: https://bit.ly/inanaconda
- Now, create a virtual Anaconda environment.
- Create a virtual environment in Anaconda called tf-gpu:
conda create --name tf-gpu
4. Now, source into the virtual environment. Remember, every time you want to use this virtual environment, you must run this command!
conda activate tf-gpu
5. Install TensorFlow GPU with pip:
pip install tensorflow-gpu==2.2.0rc2
6. Create a new Python 3 shell:
7. Test your TensorFlow GPU installation:
import tensorflow as tf
tf.__version__ # Result should be '2.2.0-rc2'
tf.config.list_physical_devices('GPU') # should list all available GPUs
Congratulations on setting up your computer for TensorFlow GPU 2.2.0-rc2!