Accelerate your data journey. Join our AI Community!

Publication

Deep Learning

Creating a Deep Learning Environment with a TensorFlow GPU

Author(s): Buse Yaren Tekin

Deep Learning

Hi! In this article, we will talk about how we can create a deep learning environment for our machine. Before starting the article, I will give information about the operating system and graphics processor I use. So let’s start!

Photo by Christian Wiediger on Unsplash

The machine I’m working with uses Windows 10 Pro as the operating system. If you want to learn the features of your graphics card, you can learn the features of your graphics card by typing dxdiag instead of searching.

⚙️OS: Windows 10 Pro
⚙️CUDA Toolkit: 10
⚙️cuDNN: 7.4
⚙️TensorFlow GPU: 1.14.0
⚙️Keras: 2.2.5

Step 1: Get Graphics Card Information

Image by ref[1]
Image by author

If you wish, you can learn this step in a short time by writing the code below to the terminal.

https://medium.com/media/b3889c87339a3d9f5978ecff569029ae/href

Then we need to go to NVIDIA’s website and make the necessary downloads. On the output, you will see the name of your graphics cards as in the next image.

Image by author

Step 2: Checking the Graphics Processor

Determine your processor suitable for your machine at https://developer.nvidia.com/cuda-gpus#collapse4. For example, in the image below, we have learned the processing capacity by checking the processor of the machine I work actively.

Controlling the Quadro RTX 5000 Processor

Step 3: Installing CUDA Toolkit and cuDNN Tool

Now we need to act very carefully in this step. We will need to install the CUDA and cuDNN tool, which match the TensorFlow version we will use. I would like to warn you that if you download different versions, you will encounter many errors.

Source[3]

I had initially installed tensorflow-gpu==1.15.0 as I had a lot of conflict with TensorFlow 2.x versions. However, I then ran into several version conflicts while running Mask RCNN. In this article, I am here with the errors corrected. If you follow these steps exactly, your code will work without errors.

💎 The compilations required for tensorflow-gpu==1.14.0 show 7.4 for cuDNN and version 10 for the CUDA Toolkit.

To access cuDNN versions, go to the link.

Compatible cuDNN version for CUDA 10.0

👉You can download the selected versions by clicking the link.

After installing these tools, we need to add them to the path variable.

Image source
CUDA Path Settings

If it wasn’t added as a Path variable, you need to check these settings. Control of system environment variables is very important 🧷

Step 4: Creating Virtual Environment

https://medium.com/media/08a32b758ba611a6af23c63972f6c936/href

Additionally, since I use Anaconda Prompt, I created virtual environments with conda. And then we got into that virtual environment with the activate command.

Step 5: Install Tensorflow-gpu

Then we go to tensorflow-gpu setup. At this stage, let’s take care to install with conda, not pip. The reason for this is that you get your approval while installing. We will also see the CUDA and cuDNN versions installed while giving this approval.

https://medium.com/media/5f9fc65dfe04577b9d68b5a806ebfedd/href

Step 5: cuDNN and CUDA File Exchanges

When we open the cuDNN archive we downloaded, we will see the following folders.

Image by author

We copy these folders into the folders where CUDA is installed. For example, I copied it to the folder in C:\Program Files\NVIDIA GPU Computing Toolkit\ CUDA\v10.0.

After all these stages, TensorFlow GPU must be installed. If you wish, you can control the terminal with the following commands. For this, let’s not forget to write python to the terminal first!

https://medium.com/media/9e5eaedd63841530f0828ed799026fec/href

Physical GPU Control

In addition I want to make a warning. If you get a warning or error caused by the version of the Skimage library like me, run the following command.

https://medium.com/media/4bbe3e1435a65c2647f164092a4597d2/href

🔮After all these stages, your deep learning environment will work without any problems! I wish you healthy and beautiful days.

REFERENCES

  1. https://en.wikipedia.org/wiki/DxDiag
  2. https://towardsdatascience.com/tensorflow-gpu-installation-made-easy-use-conda-instead-of-pip-52e5249374bc
  3. https://www.tensorflow.org/install/source_windows
  4. https://www.tensorflow.org/
  5. https://developer.nvidia.com/cuda-toolkit-archive
  6. https://www.architectryan.com/2018/08/31/how-to-change-environment-variables-on-windows-10/


Creating a Deep Learning Environment with TensorFlow GPU was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.

Published via Towards AI

Feedback ↓