user1848223
user1848223

Reputation: 57

CPU vs GPU number of cores

I need some help understanding the concept of cores on a GPU vs. cores in a CPU for the purpose of doing parallel calculations.

When it comes to cores in a CPU, it seems pretty simple. I have a super intensive "for" loop that iterates four times. I have four cores in my Intel i5 2.26GHz CPU. I give one loop to each core. Each of the four loops is independent of the other. Boom - I now have four threads created and 100% CPU usage (instead of 25% CPU usage with only one core). My "for" loop now runs almost four times faster than it would have if I did not parallelize it.

In contrast, I don't even know the number of cores in my laptop's GPU (Intel Graphics Media Accelerator HD, or Intel HD Graphics, with 1696MB shared memory) that I can use for parallel calculations. I don't even know a valid way of comparing the GPU to the CPU. When I see compute unit = 6 on my graphics card description, I wonder if that means the graphics card has 6 cores for parallelization that can work kinda like the 4 cores in a CPU, except that the GPU cores run at 500MHz [slow] instead of 2.26GHz [fast]?

So, would you please fill some of the gaps or mistakes in my knowledge or help me compare the two? I don't need a super complicated answer, something as simple as "You can't compare a CPU core with a GPU core because of blankity blank" or "a GPU core isn't really a core like a CPU core is" would be very much appreciated.

Upvotes: 1

Views: 2557

Answers (1)

Yogi Joshi
Yogi Joshi

Reputation: 816

GPU core is technically different from a CPU core in its design. GPU cores are optimized for vectorized code's execution unlike the CPU cores. Hence, the speedup you would get with GPU comparedto CPU is not only dependent on the number of cores but it also depends on the extent to which the code could be vectorized. You can check the specifications of your computer's GPU to find the number of cores. You can use CUDA/ OpenCL depending on the GPU on your machine.

Upvotes: 1

Related Questions