• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
ynm

What is the difference between CPU and GPU?

19 posts in this topic

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
0

Share this post


Link to post
Share on other sites
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
0

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.
2

Share this post


Link to post
Share on other sites
Many thanks guys.

Oh, and thank you Hodgman, for detailed explanation

Regards
0

Share this post


Link to post
Share on other sites
I think about it like this:

CPU does the math, GPU does the rendering.

Ta-Da :) (I'm not a smart programmer [img]http://public.gamedev.net//public/style_emoticons/default/tongue.png[/img] ).
2

Share this post


Link to post
Share on other sites
[quote name='superman3275' timestamp='1353733380' post='5003673']
I think about it like this:

CPU does the math, GPU does the rendering.

Ta-Da [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] (I'm not a smart programmer [img]http://public.gamedev.net//public/style_emoticons/default/tongue.png[/img] ).
[/quote]
GPU does the math too. I would say it's more like, CPU does the logic that brings everything together, and GPU is the powerhouse that drives rendering, and possibly physics (and perhaps other stuff too).
2

Share this post


Link to post
Share on other sites
[quote name='Bacterius' timestamp='1353737350' post='5003684']
[quote name='superman3275' timestamp='1353733380' post='5003673']
I think about it like this:

CPU does the math, GPU does the rendering.

Ta-Da [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] (I'm not a smart programmer [img]http://public.gamedev.net//public/style_emoticons/default/tongue.png[/img] ).
[/quote]
GPU does the math too. I would say it's more like, CPU does the logic that brings everything together, and GPU is the powerhouse that drives rendering, and possibly physics (and perhaps other stuff too).
[/quote] Also audio processing can be done on the GPU
2

Share this post


Link to post
Share on other sites
Hi,

I want to write some simple programs like hello world for GPU, how can I do this? I have here an old ATI card 4330 on my laptop, can I write program using it?

Regards
0

Share this post


Link to post
Share on other sites
May I ask why you wish to program onto the GPU directly? Chances are if you have an actual reason (and know this reason etc) then you already have knowledge of the GPU surpassing most of us here which (no offense intended here) it is obvious you do do not.


The actual lettering GPU stands for Graphics Processing Unit. This shows what its intended for pretty well.
Usually it has many many many cores (hundreds on several gaming cards, my own has over 300), these cores are capable of floating point maths natively (many CPU's are not and instead have additional circuitry for that). 1 processor core can only run a single task at a time, any code you ever write will also only ever use 1 core at a time (even GPU programming I believe) unless you specifically program it to make use of all the cores.
Something like a program that just takes 2 numbers, adds them together and spits the result back out will have no benefit to being parallelised. Something like graphics where you need to be doing a million things at once will see a huge benefit.
A single GPU core isn't actually very powerful with the exception of its floating point abilities, infact it wouldn't surprise me if the primary core of some of the higher end smart phones is more powerful (although I admit, I did not go online and check that). In theory as a GPU is what is referred to as turing complete it can do anything a CPU can, in practice a GPU has no way of interfacing with things like your keyboard etc, it can only spit out video data and only when its told to. In theory linux or something could be compiled to run on a GTX560, in practise though it would be running on just one of its several hundred cores with a ridiculous amount of limitations.

Some other tasks now done on the GPU are physics/biology/chemistry simulations and certain mathematical problems on large amounts of data although per core may be slower to do on the GPU than the CPU can of course be done on 100 or more pieces of data at once unlike your CPU where you can hope to do it on 4 at most maybe.


OpenCL can be hardware accelerated on both AMD and NVidia GPU's (aswell as some other more obsure hardware) or it can be run in pure CPU mode. NVidia have their CUDA library which works on NVidia GPU's and PPU's only (PPU's are rare and I don't think NVidia actually make them any more), for some things CUDA is faster, some OpenCL is faster, NVidia's PhysX physics library can use CUDA when present. The Bullet physics library can optionally use OpenCL or CUDA when possible too. OpenCV can use OpenCL aswell.

Generally any purpose you will need hardware acceleration from yourself will have a library available. GPU programming is a highly specialised field. For the majority of this post I am ignoring programmable shader pipelines because although they are still technically programming on a GPU it isn't what you appear to be after.
2

Share this post


Link to post
Share on other sites
@ all: many thanks,

I am learning about ray tracing because I love it, so I am trying to write on GPU (cast many rays at once) to test its limit. It is not my main job just hobby but I want to understand the concept. I am leaning to directcompute now but it seems tutorial on this field is very limited.

Regards
0

Share this post


Link to post
Share on other sites
[quote name='Bacterius' timestamp='1353737350' post='5003684']
[quote name='superman3275' timestamp='1353733380' post='5003673']
I think about it like this:

CPU does the math, GPU does the rendering.

Ta-Da [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] (I'm not a smart programmer [img]http://public.gamedev.net//public/style_emoticons/default/tongue.png[/img] ).
[/quote]
GPU does the math too. I would say it's more like, CPU does the logic that brings everything together, and GPU is the powerhouse that drives rendering, and possibly physics (and perhaps other stuff too).
[/quote]

Perhaps the best way to say it is that a CPU is a generalized processor, and a GPU is a processor designed to efficiently operate on graphical entities. It's more or less a very specialized CPU - what it is designed to do, it does much faster than a general CPU, and what it wasn't designed to do, it does much, much, much slower.
1

Share this post


Link to post
Share on other sites
[quote name='Cagnazzo' timestamp='1353821524' post='5003889']
... and a GPU is a processor designed to efficiently operate on graphical entities.
[/quote]

The rasterizer is pretty much the only thing that's really graphics-centered in GPUs anymore, they're good at all problems that can be solved in a massively parallel manner and with similar loop counts etc (little branching)
1

Share this post


Link to post
Share on other sites
This is a readable total-newbie-style overview: https://en.bitcoin.it/wiki/Why_a_GPU_mines_faster_than_a_CPU

BTW, there's a new class that launched in Coursera which deals with GPGPU:
https://class.coursera.org/hetero-2012-001/
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0