We have the answers to your questions! - Don't miss our next open house about the data universe!

Harnessing the Power of GPUs in Data Science: What You Need to Know

- Reading Time: 6 minutes
gpu

A GPU, or Graphics Processing Unit, is the computer component that displays images on the screen. It is the graphics processing unit.

If we compare a computer to a brain, we could say that the CPU is the section dedicated to logical thinking, while the GPU is devoted to the creative aspect. It converts raw binary data into visually appealing images.

A simple GPU integrated into the CPU is enough to manage the display of an operating system like Windows on a screen.

On the other hand, for more graphically intensive tasks such as video rendering or design, an independent, more powerful GPU in the form of a graphics card is generally required.

The two main graphics card manufacturers are Nvidia and AMD. In the field of integrated GPUs, Intel dominates the market. Smartphones and tablets are also equipped with SoC (System-on-a-Chip) chips, combining a CPU and GPU, generally manufactured by Qualcomm and MediaTek.

The different types of GPU

There are two main types of GPU in modern PCs: integrated and dedicated. The first type is directly integrated into the processor, while the second is separate.

In general, graphics cards for desktop PCs are large components with fans for cooling. These cards house the graphics processing chip, and dedicated RAM for heavier graphics loads such as video games.

It’s very easy to replace a graphics card on a desktop PC. Simply slide it into a PCIe x16 slot, connect it to the power supply and install the drivers. You can even install several GPUs on the same computer.

Laptops equipped with dedicated GPUs don’t have quite the same type of GPU. Generally speaking, it’s a simple chip soldered to the motherboard. This type of GPU is more complicated, if not impossible, to replace.

What’s more, they are difficult to maintain at the right temperature under intensive load (e.g. while training a Deep Learning model) due to the computer’s poor ventilation. For this reason, laptop GPUs are often limited in power to keep the computer’s temperature under control. It is therefore not recommended to invest in a laptop for training Deep Learning models.

Integrated GPUs are built directly into the CPU processor. Some processors, such as AMD’s Ryzen CPUs, are not equipped with GPUs. On the other hand, AMD manufactures processors with integrated graphics cards called Accelerated Processing Units (APUs).

Similarly, Intel Core chips with model numbers ending in F have no GPUs. This is also the case for Core X CPUs with model numbers ending in X. These processors are offered at a reduced price.

Modern processors with integrated GPUs can be surprisingly powerful. However, for an intensive use case such as data science, a dedicated GPU is essential.

What's a GPU for?

The term GPU was democratized by Nvidia in the 1990s. Its GeForce range of graphics cards was the first to become popular, and enabled technologies such as hardware acceleration, programmable shading and stream processing to evolve.

For basic computer use, such as surfing the web or using office software, the role of a GPU is simply to display images on screen.

However, for other uses, such as gaming or data science, a GPU offers numerous possibilities.

For example, it can be used for video encoding or 3D rendering, and is even used to train Deep Learning models, as well as assembly models such as LightGBM.

Computer-generated graphics, such as those used in video games or other animated media, require a large amount of power to draw each frame individually, with refresh rates that can go well beyond 100 frames per second.

Similarly, video editing requires the editing of large volumes of high-definition files. A powerful GPU is essential to transcode files at an acceptable speed.

GPUs were originally designed to accelerate the rendering of 3D graphics. Over time, they have become more flexible and programmable. Their capabilities have expanded.

This enabled designers to create more realistic visual effects, with light and shadow techniques.

In addition, developers have begun to harness the power of GPUs to accelerate workloads in the fields of Deep Learning and High-Performance Computing (physical simulations, file compression, etc.). Here are the main use cases for GPUs.

1. Video games

In the case of video games, it’s the GPU that displays images of characters, landscapes or 3D objects modeled in the finest detail. Indeed, video games require numerous mathematical calculations to be carried out in parallel with the display of images on screen.

The GPU is specifically designed to process graphic information such as image geometry, color, tint and texture. RAM also supports the large volume of information transmitted to the GPU and the video data directed to the screen.

All instructions are transmitted from the CPU to the GPU, which then executes them to display the images on screen. This process is called rendering or graphics pipeline.

The basic unit of 3D graphics is the polygon. All the images we see in a video game are based on a large cluster of polygons.

These basic shapes are called “primitives”, along with other lines and points. They are assembled to form concrete, recognizable objects, such as a table, a tree or a wizard. The greater the number of polygons, the more detailed the final images.

Each object has its own set of coordinates enabling the GPU to know where to place it in a scene. This is why objects are sometimes placed anywhere in games, in the event of a bug.

The GPU then performs calculations to determine the camera’s perspective. Finally, the images are given the textures, shadows and colors that make them so realistic.

This graphic processing is carried out at lightning speed. This requires heavy calculations, which is why a dedicated, high-performance GPU is indispensable.

It is technically possible to use a CPU for graphics, but this will be less efficient and the end result will not be as visually impressive. This component is already busy running the operating system, other programs and background processes.

2. Video editing

For many years, video editors, graphic designers and other creative professionals were limited by slow rendering speeds.

Today, the parallel processing offered by GPUs makes video rendering much easier and faster in higher-definition formats. This shortens video production and iteration times.

3. Cryptocurrency

A GPU is designed specifically for graphics processing. This task requires numerous mathematical calculations to be carried out in parallel.

This focus on parallel calculations and operations makes GPUs particularly well-suited to the mining of Ethereum and other Ethereum-derived cryptocurrencies. Crypto miners have been quick to turn to these components, abandoning CPUs that are too generalist and less efficient for this use case.

GPU and Data Science

Data Science refers to all the methods and techniques used to extract information from raw data. This information can then be used by Machine Learning algorithms to produce artificial intelligence systems.

This discipline requires considerable computing power, and GPUs are particularly well-suited to the task, as many of the mathematical operations used in Machine Learning are easily parallelizable.

One of the most recent and important use cases for GPUs is the creation of artificial intelligence neural networks. This is also one of the most demanding use cases in Data Science.

Modern artificial intelligence relies heavily on the ability to process massive volumes of data in parallel using specialized hardware. GPUs have played a major role in the development of these new technologies.

Without GPUs, we wouldn’t have the hardware needed to train high-performance neural networks.

In general, a CPU completes tasks sequentially. It can be divided into a few cores (typically 8 or 16 cores), and each core can perform a different task, whereas a GPU has hundreds or thousands of cores dedicated simultaneously to a single task. Parallelization of processing is fundamental to the design of GPU algorithms, which is why programming instructions on a GPU is completely different from traditional CPU programming.

Deep Learning libraries such as TensorFlow and PyTorch take care of the GPU programming in the background, making the development of Deep Learning models on GPUs much simpler.

Using GPUs with these libraries requires the installation of drivers dedicated to high-performance computing. Instructions on how to install these drivers can be found in the library documentation.

How to choose the right GPU?

The best way to objectively assess a GPU’s performance is through benchmarks: tests designed to test the limits of GPUs and assign them a score. These scores enable us to compare all the GPUs on the market, and thus choose the one that best meets our expectations. Depending on the field of application, the benchmark will be different.

For video games, benchmarks are very popular. A GPU capable of generating 70 frames per second on Tomb Raider will be better than a GPU capable of generating 55 frames per second.

For video editing, numerous benchmarks exist to compare the rendering performance of a GPU on software such as Adobe Photoshop, Adobe Premiere Pro, Sony Vegas and so on. In this case, we’ll be comparing the time needed to finish rendering a video, and the shorter the time, the better the GPU.

For Deep Learning, there are benchmarks comparing the training time needed to train well-known models such as VGG-16, Inception, EfficientNet on well-known databases such as ImageNet, CIFAR-10, MNIST, etc.

The GPUs best supported by Deep Learning libraries are NVidia GPUs. It is not recommended to use an AMD GPU for Deep Learning, as the TensorFlow and PyTorch libraries do not offer native support for GPUs from this brand.

How do I take a Data Science and Machine Learning course?

To learn how to harness the power of GPUs for data processing, choose DataScientest. Our Data Analyst, Data Scientist and Data Engineer training courses include modules dedicated to Machine Learning and Data Science.

Other modules cover Big Data, databases, Python programming, Dataviz and Business Intelligence. By the end of these courses, you’ll have all the skills you need for a career in Data Science.

Our innovative Blended Learning approach combines online learning and collective Masterclasses. All courses are entirely distance learning.

Depending on your situation, you can choose between continuing education and the intensive BootCamp mode. 80% of our alumni have found a job immediately after completing the course.

For financing, our courses are eligible for state financing. Don’t wait any longer and discover the DataScientest programs!

Now you know all about GPUs. For more information on the subject, take a look at our complete dossier on Data Science and our dossier on Machine Learning.

You are not available?

Leave us your e-mail, so that we can send you your new articles when they are published!
icon newsletter

DataNews

Get monthly insider insights from experts directly in your mailbox