Day 26 — CS Fundamentals December — Graphic Processing Unit — GPU
GPUs have become an integral part of computer industry considering their application and even necessity in the fields like gaming, AI, healthcare, etc.
So, it is quite recommended to know about GPUs and how they work considering the efficiency and throughput they bring in, in performing intensive computations.
So, this article is going to be about that and let’s start with it.
Let’s dive in!
So, we know that CPUs are made up of a few cores like 2, 4, 8.
But on the other hand, GPUs are made of 100s of cores.
But, that also is not the big difference! The big difference is that the CPU performs computations sequentially, like one computation at a time.
On the other hand, GPU performs computation in a parallelized manner.
So imagine, how faster GPU is than CPU by utilising 100s of its cores for parallel computation at the same time.
“So, when exactly to use GPU?”
It makes sense to use GPUs at the time of intense computations. For example, you have a simple app but at some part of its usage, it involves a graphic intensive 3D simulation.
So, initially the app can be loaded in the CPU but when the 3D simulation starts getting used by the user, then the app can start utilising the GPU considering how compute intensive that 3D simulation is.
“So, everyone should use only GPUs right? Why still use CPUs?”
Umm no actually because a CPU is good at handling multiple tasks but a GPU is good at handling few specific very quickly and efficiently. For example, 3D animations is one of the most prominent use cases of GPU which isn’t satisfied perfectly with CPU alone. So, to utilise both of the functionalities of handling multiple tasks with also handling heavy compute tasks, people tend to use both CPU and GPU.
Let’s talk about use cases
A cardinal part of AI is working with deep learning which involves creating neural networks. They are basically complex algorithms which feed in a huge amount of data and make predictions by learning from that data.
Now, that “learning” part is the one which involves incredibly intense computations and hence, GPUs come to the rescue. The GPUs divide the intense computations amongst its 100s of cores and those cores perform the computations parallelly.
Gaming, Animations and Rendering
Most of the people have heard GPU through gaming, atleast that’s how I heard about them XD.
Anyways, we all know that how graphic intensive can games can get considering the uncountable number of visual objects being animated and rendered every second on the screen. From player to cars, buildings, sky, water, motions, etc. everything requires to be rendered on the screen as smoothly as possible.
And that rendering requires highly intensive computations and for that GPUs are the ones who save the day.
Even for the same reason, the animators and 3D design creators and other people who work with animations and editing, require GPUs for their work.
Let’s say, you are a doctor and you got a patient who’s brain’s condition has to be shown to a world-famous doctor in America.
Now, one solution can be just call doctor from America to come to that patient.
Other solution can be to take the patient to America to that doctor.
But the best solution would be to go through advanced simulation techniques, the brain’s 3D image can be generated and streamed to the doctor in America on his computer.
This streaming is going to be very compute intensive considering the imaging to be live and of very very high resolution and quality causing the need of GPUs.
GPUs on cloud
One of the best ways to use GPUs, in my opinion, is to subscribe to servers on the cloud with GPUs.
So, the thing is that GPU industry is very quickly evolving and with that, in a matter of months, it is very possible that your GPU hardware might become outdated.
And considering the costs of GPUs, you can’t just regularly buy a new GPU every time the original one becomes outdated.
So, you can simply go to a cloud provider like AWS or GCP and buy/subscribe to a virtual server which will have a lot of GPU power in the cloud.
Now, it has many benefits:
- You can use only the amount of GPU power you want to.
- And the best one, you pay only for the time and usage you make. So, when you are not using the GPU, you won’t be needed to pay for it.
- The cloud providers provide the service to update the hardware of yours on the cloud. So, for example, if a new and better GPU comes into the market, then I can just simply reconfigure my server in AWS Cloud to start using that GPU.
- You don’t need to deal with setting up the entire computer in the cloud with installing OS and stuff.
- Physical space gets saved because well, you are not buying a physical computer.
- You can access from anywhere in the world and from any computer or even mobile through SSH or RDP.
Thank you for reaching till here!
I hope you understood the article and got a basic idea about GPUs.
If you liked the article, do give it some claps :)
Stay tuned for another article which is going to come tomorrow associated with some other interesting CS fundamental.
Email — firstname.lastname@example.org