Introduction to OpenCL
Perhaad Mistry & Dana Schaa,
Northeastern University Computer Architecture
Research Lab, with Benedict R. Gaster, AMD
© 2011
Instructor Notes
This is a straight-forward lecture. It introduces the
OpenCL specification while building a simple vector
addition program
The Mona Lisa images in the slides may be misleading
in that we are not actually using OpenCL images, but
they were nicer to look at than diagrams of buffers
It would probably be a good idea to open up the
example code and walk through it along with the
lecture
2
Perhaad Mistry & Dana Schaa, Northeastern Univ Computer
Architecture Research Lab, with Ben Gaster, AMD © 2011
OpenCL Architecture
OpenCL allows parallel computing on heterogeneous
devices
CPUs, GPUs, other processors (Cell, DSPs, etc)
Provides portable accelerated code
Defined in four parts
Platform Model
Execution Model
Memory Model
Programming Model
(We’re going to diverge from this structure a bit)
3
Perhaad Mistry & Dana Schaa, Northeastern Univ Computer
Architecture Research Lab, with Ben Gaster, AMD © 2011
Platform Model
Each OpenCL implementation (i.e. an OpenCL
library from AMD, NVIDIA, etc.) defines platforms
which enable the host system to interact with
OpenCL-capable devices
Currently each vendor supplies only a single platform
per implementation
OpenCL uses an “Installable Client Driver” model
The goal is to allow platforms from different vendors
to co-exist
Current systems’ device driver model will not allow
different vendors’ GPUs to run at the same time
4
Perhaad Mistry & Dana Schaa, Northeastern Univ Computer
Architecture Research Lab, with Ben Gaster, AMD © 2011
Platform Model
The model consists of a host connected to one or more
OpenCL devices
A device is divided into one or more compute units
Compute units are divided into one or more processing
elements
Each processing element maintains its own program counter
5
Perhaad Mistry & Dana Schaa, Northeastern Univ Computer
Architecture Research Lab, with Ben Gaster, AMD © 2011