Skip to content
Discussion options

You must be logged in to vote

I think you have the wrong mental model of a GPU. You shouldn't think of a GPU as a faster CPU. You should think of a GPU as a whole bunch of really slow CPUs with fast communication and shared memory, which can work together to do large computations in parallel, thereby beating a typical CPU that doesn't have access to such parallelism.

When you do a small computation (like your 100 element-wise multiplications), your problem is not really in a regime where you can benefit from the inherent parallelism of the GPU, and so the CPU will outperform it. On larger problems, you should find that the GPU will out-perform the CPU: for example, if I change your code from N = 101 to N = 10000001, I…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ToshiyukiBandai
Comment options

Answer selected by ToshiyukiBandai
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants