Results 1 to 3 of 3

Thread: Practice exercises for learning OpenCL

  1. #1

    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.

  2. #2

    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.

  3. #3

    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:

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

    1. Compute the final grade for each student, assuming the final grade is the average of all the studentís grades.[/*:m:1sh9ujbm]
    2. 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.

Similar Threads

  1. Best Practice for multiple dll
    By clint3112 in forum OpenCL - parallel programming of heterogeneous systems
    Replies: 3
    Last Post: 10-24-2012, 05:58 AM
  2. Need help to start learning OpenCL on my laptop
    By saroj in forum OpenCL - parallel programming of heterogeneous systems
    Replies: 2
    Last Post: 06-16-2012, 11:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts