r/cpp • • Nov 27 '15

Tutorial for OpenMP and OpenACC Acceleration, with Benchmarking

http://www.stevenovakov.com/blog/2015-10-30/
22 Upvotes

1 comment sorted by

0

u/[deleted] Nov 28 '15

[deleted]

2

u/TheStevenator Nov 28 '15

OpenMP can apparently support targeting GPU since 4.0

Weird... how would that work?? I'll look into it, thanks.

Also it would be interesting to see how the directive-based cases compare to specialised CUDA code.

As you said, this is kind of a trivial problem so I expect not much. I'm actually fairly impressed with the accelerator. If you look at the code there's a global variable that all kernels contribute to that needs to be coalesced and sent back to the host every iteration. It knows, regardless of whether I specify a reduction clause in the directive, to (I'm guessing) write the work-group specific value to a different buffer and then make a second kernel to find the maximum value. I expect for most trivial cases like this it's going to be "pretty smart".