All you need to know about GPUs as a beginner in Machine Learning

Source: Deep Learning on Medium

All you need to know about GPUs as a beginner in Machine Learning

Let me take you to the world of GPUs.

You may have heard of GPUs as a newbie in this Artificial Intelligence field. You may have never heard of GPU even. But GPUs are a thing and knowledge about it and which to use is going to help you in the long run as an AI developer.

Now, what is this GPU?

A graphics processing unit (GPU) is a specialized electronic circuit designed to rapidly manipulate and alter memory to accelerate the creation of images in a frame buffer intended for output to a display device. GPUs are used in embedded systems, mobile phones, personal computers, workstations, and game consoles.

Now you may be wondering, how does that fit into Machine Learning and is it different a CPU? The answer to the second question is yes, a GPU is different from a CPU. To answer the first question, I will give you my definition of a GPU.

A GPU is a type of AI accelerator used to enable faster processing of artificial intelligence (AI) tasks.

Now this definition explains how GPUs and Machine Learning fit each other.

Why do we use GPUs?

Training a deep learning model is compute-intensive. GPUs, thanks to their parallel computing capabilities — or ability to do many things at once — are good at both training and inference of a model. Simply put, we use GPUs to train models faster.

Now as a newbie, you should know a lot of platforms offer free GPUs to train your models. Platforms such as Kaggle and Google Colaboratory provide a single 12GB NVIDIA Tesla K80 GPU for free for its users. This GPU is shown to perform 12.5 times better than Kernels run on CPU.

How to activate this GPU when working with Google Colaboratory, follow these steps:

  1. Visit Google Colaboratory, and click on NEW PYTHON 3 NOTEBOOK to create a new notebook.

2. After a notebook is created, at the top left, you will see Edit, click on it and make your way to Notebook Settings. As in this photo.

3. Click on it and you’d see Hardware Accelerator, click on it and you will see None, GPU and TPU. Select GPU as the Hardware accelerator.

4. We’re almost set. After you’ve saved this Notebook setting, you will see Connect at the top right corner of the screen, select it and your notebook will be powered by a free GPU on Google Cloud Compute Engine.

Voila! That is how to activate a GPU on colaboratory. You’re well on your way to being a Machine Learning Engineer. Please note that this GPU lasts for 12 hours after which all progress will be lost. So endeavour to save everything in your Google Drive while coding. I will write an article to explain how to link Google Drive, Kaggle and Colab all in one Notebook at a later date.

To activate a GPU on Kaggle, follow the instructions here.

When you advance in your machine learning journey, GPU will become clear to you. Cloud platforms such as Intel, IBM, Google, Azure, Amazon, etc provide faster GPUs than the Tesla K80 GPU and their prices are relatively cheap. You should check out the platform that interests you the most.

Thanks for reading! Don’t forget to clap if you enjoyed the article. Cheers!!