OpenCL Intro To Programming

As taught in: May 2010 @ Colfax International

Level: Beginner


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, such as a CPU, and one or more compute devices, such as 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 can take advantage of these different types of processors in a single system.


Allen Ly – AMD Senior Application Engineer

Course Features

» Presentation [PDF 6.91MB]

» Training Guide [PDF 3.81MB]

» Programming Exercise Material [ZIP 41.6KB]

If you are interested in using this course material, in whole or part, for use in your own training class, please contact for more information.

Course Description

In this class, we will introduce OpenCL™. We start with an overview of GPU compute since the desire to take advantage of modern GPU computational power in general applications was a main motivator in the development of OpenCL™. The discussion includes some of the early APIs developed to harness the increasing programmable computational power available in modern graphics processors.

We then introduce the anatomy and programming model of OpenCL™ and take you through some of the highlights of installing the ATI Stream SDK v2 which includes support for OpenCL™ 1.0 on x86 CPUs and AMD GPUs. Then, the practical portions of the OpenCL™ runtime and kernel specifications are discussed in detail.

At the end, we discussion optimization tips to help you avoid common pitfalls when coding your applications in OpenCL™. For students who may have existing code written for the proprietary interface, CUDA, we discuss the easy steps involved in porting that code to OpenCL™.

Through the course of the class, hands-on exercises are provided that help reinforce the skills you learn during the lectures.

The course syllabus is as follows:

  • GPGPU Overview
    • What is GPU Compute?
    • Brief History of GPU Compute
    • Heterogeneous Computing
  • Introduction to OpenCL™
    • What is OpenCL™?
      • Benefits of OpenCL™
    • Anatomy of OpenCL™
    • OpenCL™ Architecture
      • Platform Model
      • Execution Model
      • Memory Model
  • Getting Started with OpenCL™
    • Software Development Environment
      • Requirements
      • Installation on Windows®
      • Installation on Linux®
    • First OpenCL™ Program
    • Compiling OpenCL™ Source
  • OpenCL™ Programming in Detail
    • OpenCL™ Application Execution
    • Resource Setup
    • Kernel Programming and Compiling
    • Program Execution
    • Memory Objects
    • Synchronization
  • The OpenCL™ C Language
    • Restrictions
    • Data Types
    • Type Casting and Conversions
    • Qualifiers
    • Built-in Functions
  • Application Optimization and Porting
    • Debugging OpenCL™
    • Performance Measurements
    • General Optimization Tips
    • Porting CUDA to OpenCL™


  • Working knowledge of C programming.
  • Experience compiling programs under Microsoft® Visual Studio® (for Windows®) or GCC (for Linux®).
  • Some understanding of parallelization is helpful, but not necessary.

Related Resources

OpenCL and the OpenCL logo are trademarks of Apple Inc. used by permission by Khronos.