OpenCL is a standard for programming heterogeneous computers built from CPUs, GPUs and other processors. It includes a framework to define the platform in terms of a host (e.g. a CPU) and one or more compute devices (e.g. a GPU) plus a C-based programming language for writing programs for the compute devices. Using OpenCL, a programmer can write task-based and data-parallel programs that use all the resources of the heterogeneous computer. This tutorial was held Thursday, June 16, 2011 at CERN. Below we share lecture notes and handouts.
This is “programmer’s introduction” where we cover the ideas behind OpenCL but also show how these ideas are translated into source code. We will do this through a series of progressively more challenging examples, thereby providing a set of pedagogically useful examples that experienced HPC programmers can use to quickly become productive OpenCL programmers.
Second part is hands-on tutorial:
Exercise source code [TGZ]
- common – a set of functions used by these openCL programs
- matrix_mult – a serial matrix multiplication program
- pi – A serial numberical integration program to estimate pi
- Solutions-OXS – Solutions tested on Apple’s Snow Leopard OS
- Solutions-vs2010 – Solutions tested wtih visual studio 2010
- vadd – An OpenCL program to add a pair of vectors
You can download the beta release of OpenCL (Linux and Windows) from Intel at: http://software.intel.com/en-us/articles/opencl-sdk/
For Apple laptops, OpenCL is included with Xcode for Mac OS X (Snow Leopard release and beyond). You can also use the AMD release of OpenCL for x86 processors which can be downloaded at: http://developer.amd.com/SDKS/AMDAPPSDK/Pages/default.aspx