How to install Tensorflow GPU on AMD GPUs.
How to install Tensorflow GPU on AMD GPUs. Now you can easily use Tensorflow GPU on AMD GPUs. In this article, I'm gonna teach you how you can install Tensorflow GPU on AMD GPUs with code for every step.
Hello Internet, I'm back with another useful & interesting article. I'm gonna show you how you can accelerate TensorFlow on AMD GPUs. to use Tensorflow-GPU, we need an Nvidia GPU with CUDA support. But now you can easily use Tensorflow GPU on AMD GPUs. for this, there is an API developed by Microsoft known as DirectML.
What is DirectML? Direct Machine Learning (DirectML) is a low-level API for machine learning (ML). Hardware-accelerated machine learning primitives (called operators) are the building blocks of DirectML.
Requirements:- 1.) Check your version of Windows:- The TensorFlow with DirectML package on native Windows works starting with Windows 10, version 1709 (Build 16299 or higher).
2.) Check for GPU driver updates:- Ensure that you have the latest GPU driver installed. Select Check for updates in the Windows Update section of the Settings app.
3.) tensorflow-directmlis only compatible with Python 3.6 - 3.7.
My System Specs:- 1.) Windows 10 2.) 12 GB RAM 3.) AMD Radeon Vega 3 Graphics Card 4.) AMD Ryzen 3 Processor
Begin the installation:-
the first step is to create a virtual environment. In my case, I'm using anaconda to create virtual environment. if you also want to install Anaconda on your local machine:- Check Out This 👉️👉️ https://tealfeed.com/anaconda-installation-less-5-minutes-ir3se
To create virtual type:-
conda create -n tensorflow-directml python=3.6
The above command will create Virtual Environment with Python=3.6. You can also use Python 3.7, but Python 3.6 is recommended. Next step is to activate the environment, to do that run this command:-
conda activate tensorflow-directml
After this, next step is to install tensorflow-directml. to install, just type:-
pip install tensorflow-directml
Congrats, You have successfully installed tensorflow with gpu acceleration on your systems. Now, to check is tensorflow using gpu follow the given instructions:-
First, Open Your CMD & activate your environment by conda activate tensorflow-directml . Then type python. after that type the following code:-
import tensorflow as tf
if you also get output as True, that means tensorflow is now using gpu. Now, You have Successfully installed Tensorflow that uses GPU. That's the end of this article, hope you enjoyed it. I will be back with another intresting article soon.
Thanks, Samradh Bhardwaj
ML Expert with experience in Computer Vision, NLP and building Chatbots.