CSE 746 - Assignment #2
Due 5pm, Tuesday, March 21, 2017. Submit by email.
Reduction with OpenCL, OpenACC and Thrust
The goal is to write a code accelerated on the GPU which performs a sum reduction on an array of integers. In all cases, include also a reference calculation on the CPU which you can use to compare results. You can freely use code from class exercises as your starting point if you like.
Part 1 - Accelerating with OpenCL
Write an OpenCL code to do such a reduction. Use atomic operations. There will be some pragmas you will need to add to the code to enable these, look up the documentation.
Part 2 - Accelerating with OpenACC
Write an OpenACC code to perform this.
Part 3 - Accelerating with Thrust
Write a code employing the Thrust library to perform this.
Note: It is likely you will find part 1 much harder than parts 2 or 3. OpenCL can be tricky to debug.