What is a GPU?

A GPU, as the initialism suggests, is an electronic circuit that serves as a processor for handling graphical information to output on a display. The scope of this book is to go beyond just handling graphical information and stepping into the general purpose computing with GPUs (GPGPU) arena. GPGPU is all about the use of what is typically performed with central processing units (CPUs), which we are going to discuss in detail in the next section. The terms GPU and graphics card are used interchangeably very frequently. But both are in fact quite different. The graphics card is a platform that serves as an interface to the GPU. Just like a CPU is seated over a motherboard socket, a GPU is seated over a socket on the graphics card (comparably to a motherboard, we may think of it as a mini-motherboard but only to facilitate the GPU and its cooling).

What about computing? The word computing is most obviously derived from the word compute. To compute is simply to harness your own hardware to deploy applications with the help of your own programmable processes. Programmable processes are a set of rules defined by you that are always ready to operate at your disposal. They are, of course, based on your own algorithms, which allow you to address your own specific requirements, depending on the application at hand.

If you look at computing on a universal scale, you'd find that the specific requirement that we speak of in the previous paragraph isn't just limited to computer science. Computing can be inferred as a technique to calculate any measurable entity that can belong to any field, be it the field of science or even art. Now that we have described the terms GPU and computing individually, let's go ahead with an introduction to our primary topic: GPU computing.

As we can comprehend by now, GPU computing is all about the use of a GPGPU with program code that executes on GPUs. When a GPU programmer writes a GPU program, the primary motive is to handover a certain workload that is computationally much more intensive for a CPU to handle.

Within the code, the CPU is instructed to hand over those particular operations to the GPU, which are then computed by the GPU. When these computations are done, the GPU sends back all of this information to the CPU and shows that output to you. Since the results are computed many times faster, such work can also be called GPU-accelerated computing.