←back to thread

170 points judicious | 1 comments | | HN request time: 0.262s | source
Show context
Animats ◴[] No.45407980[source]
This is just cutesy on CPUs, but is a big part of GPU programming.
replies(1): >>45409699 #
itemize123 ◴[] No.45409699[source]
off topic, what are good resources to dive into gpu programming (for someone mostly in the cpu world)
replies(1): >>45409882 #
1. Animats ◴[] No.45409882[source]
Here's a short CUDA demo from NVidia, of adding two arrays of a million numbers each, elementwise. The line that actually does the add is

     add<<<1, 1>>>(N, x, y);
All N adds are conceptually done in parallel, with no side effects. In practice, hundreds or thousands of adds are done simultaneously, depending on the available hardware.

This is true branchless programming.

[1] https://developer.nvidia.com/blog/even-easier-introduction-c...