Computational Science Community Wiki

Introduction to OpenCL

Tutor: George Leaver

Time and location:

Course materials: Community OpenCL page

About the Course

OpenCL is the first open, royalty-free standard for cross-platform, parallel programming of modern processors found in personal computers, servers and handheld/embedded devices. OpenCL (Open Computing Language) greatly improves speed and responsiveness for a wide spectrum of applications in numerous market categories from gaming and entertainment to scientific and medical software.

The course modules, which can be taken separately, cover all of the topics required to begin developing OpenCL programs. Practical sessions will be run on a University central facility using Nvidia GPUs. This will be accessed remotely from the training room.


Familiarity with Unix/Linux and the ability to program in C is essential. Some acquaintance with the concepts and terminology of High Performance Computing is desirable. All practicals will be under a Linux environment and require you to write C codes using an editor such as vi, emacs or gedit before compiling and running in batch.

There's lots of material online covering C programming. Two useful ones are:

Topics Covered

The course outline is given below. The course content is broken down in to modules, each of which can be applied for independently.


  1. GPU Computing, OpenCL basics
    • Heterogeneous architectures.
    • Vector vs Threaded vs GPU programming models (inc graphics history).

    • GPU architecture
    • OpenCL components (OpenCL C, host APIs)
    • Execution grid / expressing parallelism / indexing

    • Simple kernel examples
    • Exercises
  2. Memory hierarchy, OpenCL C, more advanced kernels
    • More OpenCL C for use in kernels (by-example style).
    • Memory hierarchy, and access patterns / optimizations
    • Brief intro to device setup. Focus on device memory objs, host-device transfer, kernel launch.
    • Exercises
  3. Host set up details and examples
    • Platform / device / context / queues / kernel model
    • Kernel compilation
    • Debugging and profiling options
    • Case studies (possibly)
    • Exercises
  4. Queues, Events, Synchronization
    • Sync within queues (barriers, events)
    • Multi-queue sync (and example of usage)
    • Calling from Fortran
    • OpenCL on CPUs
    • Exercises

alt="Book On Courses - UoM staff and PGR only"

Back to list of courses