Jump to content
  • Advertisement
Sign in to follow this  
ynm

What is the difference between CPU and GPU?

This topic is 2049 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone,

As I understand, CPU is central processing unit which I can program it to do some works, and GPU is something you can program it do do some works, in parallel but its function is limited, e.g it can add but can not multiply. But as all computer world is based on binary bits and logic functions AND, OR, NOT, so if one tries, he can program GPU to do whatever CPU can do, right? Or there are works that CPU can do but GPU can not do?

Regards

Share this post


Link to post
Share on other sites
Advertisement
Thanks,


Can GPU do branch commands like 'if'? And I heard that some kinds of the best ray tracing engine can only do with CPU, is this true and why don't they use GPU for the maths?

Can a computer run on GPU alone? If not then why?


Regards

PS: @Radikalizm, the example of add and multiply is just an example because I don't know how to say it clearly

Share this post


Link to post
Share on other sites
You don't write whole programs for GPU. What you do is that you have it run a small set of instructions (a kernel) in paralell many times over on a set of data.

For instance, you copy a buch of vertex data to the device memory, then ask the GPU to do math on the vertices. Then for each set of vertices you output a bunch of pixels which you also run a kernel on each pixel. These are called vertex and pixel shaders and are used to generate an image to be displayed on your monitor.

Recently, people started to use this pipeline for other purposes then generating an image. Namely number crunshing.

Share this post


Link to post
Share on other sites
Yes, modern GPUs are able to do branching, but I believe CPUs are generally more efficient at doing branches, or at least it used to be like that.

You have to keep in mind that a GPU is designed to do a large amount of similar jobs at once in parallel, that's why it's so efficient at doing heavy calculations. It'd be extremely hard or maybe even impossible to build an operating system kernel which could run on this kind of architecture. Working with memory would also be a major issue.

About ray tracers, there are a lot of ray tracing implementations which run on the GPU or which at least use the GPU to accelerate the process. The problem with CPU - GPU interop is that you'll encountering latency issues when uploading data to the GPU or when reading back data. It's only worth it to upload a job to the GPU if the speed improvement you'll get from it takes into account the memory latency from the data upload and potential readback as well.

Share this post


Link to post
Share on other sites
GPUs have been Turing complete for a while, so they can theoretically perform any calculation a CPU can perform.
In practice, the GPUs don't have any way to communicate with peripherals, just with the CPU, so that should make it obvious why one can't run a computer with a GPU alone.
It would also be extremely impractical to run some types of programs on a GPU - for example, a general purpose operating system - because the GPUs lack key features such as interrupts that are critical to implementing those programs in practice.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!