Introduction to OpenCL
Tutor: George Leaver
Time and location:
Modules 1 & 2: 10am-5pm, Friday 8th March 2013. Training Room 3, Kilburn Building.
- Module 3: 10am-1pm, Not Scheduled Feb/Mar 2013. Training Room 3, Kilburn Building.
- Module 4: 10am-1pm, Not Scheduled Feb/Mar 2013. Training Room 3, Kilburn Building.
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:
The course outline is given below. The course content is broken down in to modules, each of which can be applied for independently.
- 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
- 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.
- Host set up details and examples
- Platform / device / context / queues / kernel model
- Kernel compilation
- Debugging and profiling options
- Case studies (possibly)
- Queues, Events, Synchronization
- Sync within queues (barriers, events)
- Multi-queue sync (and example of usage)
- Calling from Fortran
- OpenCL on CPUs