Get Started with Intel® SDK for OpenCL™ Applications 2019: Core Concepts

1. Overview


2. Introduction

Intel® SDK for OpenCL™ Applications 2019, and the OpenCL™ component of Intel® System Studio 2019, are the primary development vehicles for OpenCL™ development on Intel® Graphics Technology and Intel® CPUs. The SDK tools include three layers of components to enable the developer stack.

Intel® SDK for OpenCL™ Applications 2019 overview

  • Developer Tools
    • Debug facility for OpenCL™ applications
    • Analysis facility for OpenCL™ applications
    • IDE plugin for Eclipse* and Visual Studio* - Intel® Code Builder for OpenCL™ API
    • Intel® SDK for OpenCL™ - offline compiler, ioc64/ioc32
      • ioc64/ioc32 is a command line utility to build OpenCL™ kernels offline as opposed to at runtime. ioc64/ioc32 supports various output types, including SPIR-V (Standard Portable Intermediate Representation). ioc64/ioc32 serves as a pass through to the OpenCL™ implementations for Intel® devices available on the system.
  • OpenCL™ Headers and OpenCL™ ICD Loader Library
    • Headers and link libraries to build and execute OpenCL™ programs
  • Intel® Experimental OpenCL™ 2.1 CPU Only implementation
    • Provision to run kernels on the CPU with no need for an accelerator/coprocessor device. This experimental runtime is intended for development only. It is not intended for redistribution.

The Intel® SDK for OpenCL™ Applications does not contain any kernel mode components.


3. Basic Example

A functioning OpenCL™ application (depicted in green) can be built with the SDK components like so:

 

Intel® SDK for OpenCL™ Applications 2019 Simple Build

  • First, the developer writes one to many C or C++ sources and includes OpenCL™ headers (far left, .cpp).
    • The program can choose an OpenCL™ platform, such as the Intel® Experimental OpenCL™ 2.1 CPU Only platform.
    • the C or C++ program instructs the OpenCL™ API facilities in the interrogator runtime to create a context and picks an available OpenCL™ platform and device.
  • Next, the developer writes her/his OpenCL-C kernel source file (middle, .cl), with an option to precompile the kernel.
  • Next, the developer builds and links the C or C++ objects to the OpenCL™ ICD Loader runtime library (middle right)
  • At runtime, the OpenCL™ API facilities either: just-in-time build the OpenCL-C kernel source OR load a user precompiled kernel. The OpenCL™ implementation schedules execution of the kernel binary on the OpenCL™ target device.
    • In the above example, the target device is the CPU. Kernel compilation and execution is afforded by the platform provided with the Intel® Experimental OpenCL™ 2.1 CPU Only runtime.

There are various other considerations when writing and executing OpenCL™ applications. Explore the Khronos* reference on OpenCL™ registry page for more detail. Also, see the Intel® SDK for OpenCL™ Applications 2019 release notes.


4. Production Examples

The following three examples describe SDK setup for different OpenCL™ target devices. More detail is shown for the components at each layer. Note: Intel® FPGA devices are not mentioned here. For Intel® FPGA developer resources and guidance, see the fpgasoftware.intel.com portal.

Intel® CPU / Windows* OS or Linux* OS

The first example shows CPU targeting with Intel® CPU Runtime for OpenCL™ Applications 16.1.2, an OpenCL™ implementation suitable for production deployments. Note: this scenario applies similarly to both supported Windows* OS and supported Linux* OS:

Intel® SDK for OpenCL™ Applications 2019 CPU Stack

The user application (.c/.cpp) uses the OpenCL™ ICD Loader reference library (libOpenCL.so/OpenCL.dll) to select the CPU target device afforded by the Intel® CPU Runtime for OpenCL™ Applications 16.1.2. The user application (.cpp) ships the kernel program (.cl) through the CPU implementation. The kernel is executed on the CPU directly. Neither graphics device nor coprocessor device is used or required.


For more information about the Intel® CPU Runtime for OpenCL™ Applications please see the Intel® article for OpenCL™ deployments. Note that Intel® CPU Runtime for OpenCL™ Applications 18.1 is now available.

The Intel® Graphics Technology driver package for Windows* OS also contains the Intel® CPU Runtime for OpenCL™ Applications distribution described in this example. Windows* OS systems may have this package installed by default. For compatibility and bug fixes consider:

To see a software development walkthrough for Windows* OS visit the Intel® SDK for OpenCL™ Applications 2019 Windows* OS getting started guide.


Intel® Graphics Technology / Windows* OS

This second example shows the Intel® SDK for OpenCL™ Applications 2019 targeting Intel® Graphics Technology with Windows* OS.

Component boxes highlighted in:

  • Purple - apply for both supported Intel® CPU and supported Intel® Graphics Technology platforms.
  • Blue - apply for supported Intel® CPU platforms.
  • Red - apply for supported Intel® Graphics Technology platforms.

Intel® SDK for OpenCL™ Applications 2019 Windows* OS Intel® Graphics Technology

Here the user application (.c/.cpp) uses the OpenCL™ ICD Loader reference library (OpenCL.dll) to select the Intel® Graphics Technology device afforded by the Intel® Graphics Compute Runtime for OpenCL™ Driver. The user application (.c/.cpp) ships the kernel program (.cl) through the Intel® Graphics Technology implementation. The kernel is executed on Intel® Graphics Technology hardware.


This OpenCL™ implementation is distributed as part of the Intel® Graphics Technology driver package for Windows* OS. The Intel® graphics driver package for Windows* OS also contains the CPU standalone distribution described in the previous example. Windows* OS distributions installed on systems with Intel® processors with Intel® Graphics Technology may have this package installed be default. Please consider updating this package from either downloadcenter.intel.com or from the system vendor. See more information in the Intel® Graphics Technology deployment section at the deployment page.

To see a software development walkthrough for Windows* OS visit the Intel® SDK for OpenCL™ Applications 2019 Windows* OS getting started guide.


Intel® Graphics Technology / Linux* OS

The third example shows SDK development targeting Intel® Graphics Technology on Linux* OS:

Intel® SDK for OpenCL™ Applications 2019 Linux* OS Intel® Graphics Technology

The user application (.c/.cpp) uses the OpenCL™ ICD Loader reference library (libOpenCL.so) to select the Intel® Graphics Technology device afforded by the Intel® Graphics Compute Runtime for OpenCL™ Driver. The user application (.c/.cpp) ships the kernel program (.cl) through the Intel® Graphics Technology implementation. The kernel program is executed on Intel® Graphics Technology hardware. The kernel is not executed on the CPU.


The Intel® Graphics Compute Runtime for OpenCL™ Driver, known as “NEO”, is an opensource and actively maintained OpenCL™ implementation. It was introduced for Intel® Graphics Technology GEN8 microarchitecture Broadwell processors as well as GEN9 platforms and later. Intel® SDK for OpenCL™ Applications 2019 is intended to support development with the NEO implementation and move away from the legacy SRB5.0 implementation. For more on NEO, view the Intel® deployment page for OpenCL™ runtimes and the NEO github page.


5. Misc and Next Steps

For more tools capable of heterogeneous analysis and profiling, consider Intel® VTune™ Amplifier, found:

For lightweight development help in monitoring and debugging OpenCL™ applications see the Intercept Layer for OpenCL™ Applications open source project.

For learning about Intel® Processor SKU’s featuring Intel® Graphics Technology, please see the ark database.

In some cases, the Experimental OpenCL™ 2.1 CPU Only runtime may throw errors if used in the same process as other OpenCL™ implementations. This implementation is for development purposes only. Please do not use it in production applications. The Intel® CPU Runtime for OpenCL™ Applications 18.1 is a suitable replacement for the Experimental Runtime in development and production use cases.

 

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

*Other names and brands may be claimed as the property of others

For more complete information about compiler optimizations, see our Optimization Notice.