Re:Ask HN: What are good projects to understand CUDA and GPU...
by AnthonBerg on Tuesday October 02, 2018 @04:41AM
(#18119785)
An image blur is a good place to start! Read horizontally from many pixels in parallel, sum them up as parallel as you can, normalize, write back. Repeat for vertical blur - and here it might be best to rotate the image by a quarter of a turn so vertical is horizontal!, because memory access is usually faster that way.
[ Parent
| on HN ]
Re:Ask HN: What are good projects to understand CUDA and GPU...
by Const-me on Tuesday October 02, 2018 @05:57AM
(#18120139)
Did it couple of times.
One trick is write output pixels transposed. This way both passes will be identical, and they both read image linearly. Two transposes cancel each other.
Another one is use local memory.
Finally, the right place for the kernel values is compiled into the code, in immediate values. Everything else is slower.