1. Overview
- This article explains core development concepts with Intel® SDK for OpenCL™ Applications . The article covers:
- OpenCL™ Developer Tools as a component within Intel® System Studio 2020.
- Intel® SDK for OpenCL™ Applications 2020 as a standalone product (not yet available).
- Developers familiar with OpenCL™ components can head directly to the following resources for prerequisites, install, and walkthrough guidance:
- This article does not cover OpenCL™ development specific to Intel® FPGA products.
- For Intel® FPGA devices see fpgasoftware.intel.com.
- Users looking to build Intel® oneAPI: DPC++/SYCL* programs with existing OpenCL kernels can see the article on interoperability.
- Users of the 2019 SDK should visit the legacy Intel® SDK for OpenCL™ Applications 2019 Getting Started portal.
2. Introduction
Intel® SDK for OpenCL™ Applications, and the OpenCL™ Tools component of Intel® System Studio, are 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.
- OpenCL™ Headers and OpenCL™ ICD Loader Library
- Headers and link libraries to build and execute OpenCL™ programs
- Intel® CPU Runtime for OpenCL™ Applications 18.1
- Provision to run kernels on the CPU with no need for a coprocessor device.
- IDE plugin
- 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 builds kernel programs throughOpenCL™ implementations for Intel® devices.
- Debug & Analysis facility for OpenCL™ applications
- Note: These tools maybe removed from some SDK versions, with alternatives offered via Intel® VTune™ Profiler and Intel oneAPI Beta alternatives
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:
- First, the developer writes one to many C/C++ sources (far left, .cpp).. The sources includes OpenCL™ headers.
- The C/C++ sources can choose an OpenCL™ platform, such as the Intel® CPU Runtime for OpenCL™ Applications.
- The C/C++ program uses the OpenCL™ API exposed through the ICD Loader runtime to create a context. The program associates that context with an available OpenCL™ platform and device.
- Next, the developer stages her/his OpenCL-C kernel source file (middle, .cl), with an option to precompile the kernel.
- Next, the developer builds and links the C/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 the Intel® CPU Runtime for OpenCL™ Applications.
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 2020 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 18.1, an OpenCL™ implementation suitable for production deployments. Note: this scenario applies similarly to both supported Windows* OS and supported Linux* OS:
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 18.1. The user application (.cpp) builds and stages the kernel program (.cl) through the CPU implementation. The kernel is executed on the CPU directly. Neither graphics device nor separate coprocessor device is used.
For more information about the Intel® CPU Runtime for OpenCL™ Applications please see the Intel® article for OpenCL™ runtimes. Note that Experimental Intel® CPU Runtime for OpenCL™ Applications with SYCL support is available. It supports the Intel oneAPI: DPC++ Compiler Beta. At the time of publishing for this article, it is actively maintained and updated.
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:
- Updating Intel® Graphics Technology driver package from the deployments page or
- Uninstalling the Intel® Graphics Technology driver in favor of an updated Intel® CPU Runtime for OpenCL™ Applications standalone
To see a software development walkthrough for:
- Windows* OS visit the Intel® SDK for OpenCL™ Applications 2020 Windows* OS getting started guide.
- Linux* OS visit the Intel® SDK for OpenCL™ Applications 2020 Linux* OS getting started guide.
Intel® Graphics Technology / Windows* OS
This second example shows the Intel® SDK for OpenCL™ Applications 2020 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.
Here the user application (.c/.cpp) uses the OpenCL™ ICD Loader reference library (OpenCL.dll) to select the Intel® Graphics Technology device exposed by the Intel® Graphics Compute Runtime for OpenCL™ Driver. The user application (.c/.cpp) build and stages 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 2020 Windows* OS getting started guide.
Intel® Graphics Technology / Linux* OS
The third example shows SDK development targeting Intel® Graphics Technology on Linux* OS:
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 Compute Runtime for OpenCL™ Driver implementation. The kernel program is executed on Intel® Graphics Technology hardware. See the Intel® SDK for OpenCL™ Applications 2020 Linux* OS getting started guide to get familiar with the tool interface and building and executing OpenCL™ programs.
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 and newer is intended to support development with the NEO implementation and move away from the legacy SRB5.0 implementation. For more on NEO, view the OpenCL™ runtimes for Intel® processors article and the NEO github page.
Note: A standalone CPU Runtime is available.
5. Misc and Next Steps
Users looking to build Intel® oneAPI: DPC++/SYCL* programs with existing OpenCL kernels can see the article on interoperability.
For more tools capable of heterogeneous analysis and profiling, consider Intel® VTune™ Profiler, found:
- as a standalone tool
- within Intel® Parallel Studio
- within Intel® System Studio
- With Intel® oneAPI developer toolkits
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.
*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