Published:10/06/2018 Last Updated:10/05/2018
1. Overview
2. Prerequisites
OpenCL™ implementations
Ensure the system has a capable OpenCL™ implementation for Intel® devices. By default, a Windows* OS distribution may or may not already have OpenCL™ implementation(s) from Intel.
3. Install Tools
If a new OpenCL™ implementation has not been installed, SDK installation is still possible. Follow the installer dialog. If using Intel® System Studio 2019, ensure OpenCL™ components are selected:
OpenCL™ developer component selection
The installer will take some time to write registry entries and apply plugins for the Microsoft Visual Studio* 2017 IDE. In Intel® SDK for OpenCL™ Applications 2019 initial release, the installer will also install the Experimental OpenCL ™ 2.1 CPU Only implementation to the system.
4. Check Plugin
After opening the Visual Studio* 2017 IDE, check the OpenCL™ platform information via the Tools->Intel Code Builder for OpenCL API->Platform Info… menu item:
‘Platform Info…’ menu item
The Code Builder Platform Info Tree should open by default on the right side of the IDE pane. Take a moment to examine the available OpenCL™ platforms and devices. Example:
The white box in the example contains the system hostname.
Assuming the SDK, CPU implementation, and Intel® Graphics Technology implementation have been installed. Here’s what is displayed:
Right-clicking on a device and selecting Properties will display device interrogation parameters. These parameters are useful for understanding device capabilities.
Properties menu item
Example OpenCL™ parameters from Intel® Core™ i7-6770HQ with Intel® Iris® Pro Graphics 580.
Use these parameters to better:
Device Version reporting a NEO implementation like ‘OpenCL 2.1 NEO’ maps to the validation platform for Intel® SDK for OpenCL™ Applications 2019. Implementations without the NEO branch designation will likely not be able to interface with all Intel® SDK for OpenCL™ Applications 2019 debug and analysis features. This field is similar to OpenCL™ API call clGetDeviceInfo(…) looking for CL_DEVICE_VERSION information.
5. Try Example Project
Intel® SDK for OpenCL™ Applications 2019 places template projects available for using in Visual Studio* 2017. To use a template project, select File->New->Project… In the New Project dialog, Visual C++ OpenCL™ template projects can be selected.
New->Project menu item
Template selection dialog
The CPU and Intel® Graphics Technology OpenCL™ Projects contain C++ host target source examples (.cpp files) that use the OpenCL™ host side C API. They also contain an OpenCL-C device target example (.cl files). These examples are helpful for developers new to heterogeneous and OpenCL™ programming. The Empty OpenCL™ Project contains an empty place holder C++ host target source (.cpp), and an empty placeholder device target source (.cl).
In this example, the Intel® Graphics Technology project is selected. Here are the automatically generated sources that it comes with:
Solution Explorer view of Intel® Graphics Technology template project
Note: Examining the properties of the GPUOpenCLProject1 can inform a user of project settings needed to build a non-template OpenCL™ application.
When Build->Build Solution is selected, this project will use the Visual Studio* compiler to build the C++ sources and the SDK’s offline compiler (ioc64.exe/ioc32.exe) to build the kernel (.cl). A status report will be output to the window pane. Here is the build result:
Build issue: –simd option is not supported for GPU device.
This error was present in the Intel® SDK for OpenCL™ Applications 2019 initial release candidate. To fix this template error, navigate to project properties by right-clicking the project and selecting Properties. Select OpenCL Code Builder->General, and clear the SIMD field:
Project Properties
Delete the contents of the highlighted –simd=default field.
After clearing the field click Apply and Ok. Attempting to Build Solution again yields a successful result and executable on disk.
With this template, the Build Solution action will stage the executable and the OpenCL-C kernel (.cl) next to each other in the project’s target directory.
Launch the built executable with the Local Windows Debugger button in the top toolbar. To pause the application and review console output, consider adding a system(“pause”); to the bottom of the main function of the C++ host target source file. Example:
Add a pause to review shell output.
After Building the Solution and launching the Local Windows Debugger again. Here is the resulting output shell:
The program has been successfully built and has executed the sample OpenCL-C kernel on the Intel® Graphics Technology device.
6. More
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
Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.
Notice revision #20110804