With a simple search in amazon one can see that the modern approach for parallel programming is to use your graphic card. However I am still a little bit skeptical about it. My last computer has an 8 core CPU which I need is enough for basic all my parallel needs, if I need more I will probably use MPI through a network using my old machines. All in all, Why and/or when should I use CUDA or another method which uses my graphic card instead of traditional methods like pthreads, java threads, boost threads or the new C++ 11 threads? What about using processes?

  • 5
    "640K ought to be enough for anybody!"...
    – Jesper
    Jun 27, 2011 at 14:31
  • 8 CPUs? What hardware are you sporting? That's far from common.
    – ashes999
    Jun 27, 2011 at 17:25

2 Answers 2


Maybe because even a mid-range Graphics card is a couple of orders of magnitude faster than an 8 core CPU at the tasks it is very good at, which is highly parallel algorithms?

8 Core CPU == 8 threads minus any OS threads that are available for your Application ( and that is only if you actually have 8 REAL cores, Hyper Threading doesn't count! )

512 Stream GPU = 512 Streams for your application to use.

Also the memory bandwidth on modern graphics cards are at least twice as wide and a few orders of magnitude faster than even the fastest chipset available for a general purpose CPU.

The question is confusing multi-threading with parallel concurrency which are not always used together.

GPUs aren't multi-threaded in the same way a general purpose CPU is.

Stream != Thread

That is they don't execute multiple instructions per stream, but streams can share data that they work on, which general purpose CPUs can't do well, at least not without compromising in space over time issues. It really is comparing Apples and Oranges.

  • 1
    With HT enabled you can have 16 threads ;)
    – cularis
    Jun 27, 2011 at 14:15
  • 3
    those aren't real threads they are pretend threads on an Intel box, and you don't get 1:1 performance with Hyper Threading and in some cases you get less performance with all the context switching and cache misses that Hyper Threading causes.
    – user7519
    Jun 27, 2011 at 14:22
  • 1
    In all fairness, the same applies to streams. A stream processor can only run one instruction at a time, so unless all streams are trying to execute the same instruction some streams will be idle, and therefore you usually don't get 1:1 performance on GPU's either.
    – MSalters
    Jun 27, 2011 at 14:26
  • An which ones are these tasks? When should I say: hey, I rather use my GPU than my processor?
    – Sambatyon
    Jun 27, 2011 at 14:28
  • @MSalters notice my qualifier of "...the tasks it is very good at..." And yes you do get 1:1 performance on appropriate tasks. A 512 stream GPU encoding video will be 2X as faster as a 256 stream GPU running the same code on the same input.
    – user7519
    Jun 27, 2011 at 14:34

A multi-core CPU is very good at MIMD work (Multiple Instructions Multiple Data). A GPU excels at SIMD work (Single Instruction Multiple Data). That means that if all your threads are running the same function, only on different data, then using a GPU is probably a good choice. A classic SIMD example is image processing, when all threads run the same algorithm on different parts of the image.

  • You mean a GPU is good at SIMD?
    – dsimcha
    Jun 27, 2011 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.