Practice exercises for learning OpenCL

Can anyone suggest 1 or 2 practice exercises for learning OpenCL? Not tutorials -- there are plenty of those -- but simply an algorithm to implement. I'm thinking the ideal would be a one-day project in which I take a 2D sequential algorithm and parallelize it using OpenCL. But which algorithm? Thanks for any suggestions.

Re: Practice exercises for learning OpenCL

Perhaps a Mandelbrot fractal. I like that example because it gives visual results which are nice to look at, is very simple to implement naively but has loads of potential for all kinds of optimizations that can be done later in order to speed it up. It is good to have some project where new techniques and methods you learn can be applied so you can track the progress of your OpenCL skill as the performance of your Mandelbrot generator increases. You can even use it to learn OpenGL interaction, but a simple read to host and write to PPM is good enough for the first-day exercise and really easy to implement.

Re: Practice exercises for learning OpenCL

Thanks for the suggestion. The problem with a fractal exercise, though, is that in order to see and verify the results, I'd have to come up with some way of displaying the pixels, which adds complexity that has nothing to do with OpenCL.

While reading Apple's OpenCL Programming Guide for Mac OS X, I came across an exercise that's just what I was looking for:

Quote:

Write a simple application that keeps track of the grades for students in a class. The application consists of two main tasks:

- Compute the final grade for each student, assuming the final grade is the average of all the student’s grades.[/*:m:1sh9ujbm]
- Obtain a class average by averaging the final grades of all students.[/*:m:1sh9ujbm]

I like this because it's very easy to understand, and the result is just a single number, so it's easy to verify that an OpenCL implementation gives the same answer as a sequential implementation. Plus, it involves a real-world data dependency (#1 must complete before #2), so it teaches about events and synchronization.