- This article walks developers through:
- Installation for the OpenCL™ developer tools in Intel® System Studio 2019. This is the latest update to Intel® SDK for OpenCL™ Applications on Windows* 10 OS.
- Building and executing an OpenCL™ application with Microsoft Visual Studio* 2017 IDE.
- This article covers Intel® SDK for OpenCL™ Applications 2019 on Windows* 10 OS as:
- FPGA devices are not covered here... see fpgasoftware.intel.com.
- Developers familiar with the basics of the build environment may wish to skip to the SDK debug and analysis walkthrough.
- For a video walkthrough, check techdecoded.intel.io for the ‘OpenCL™ Development with Intel® System Studio 2019 on Windows* OS’ introduction (Expected End of October 2018).
- Note: the video uses an older release candidate than the Intel® SDK for OpenCL™ Applications 2019 initial release examined here.
- The reference platform used in this guide is an Intel® NUC (NUC6i7KYK) with
- Intel® Core™ i7-6770HQ Processor and Intel® Iris® Pro 580 Graphics.
- Windows* 10 Enterprise OS 1709 16299.665
- Read the release notes from the Intel® SDK for OpenCL™ Applications - Release Notes Portal.
- Ensure Microsoft Visual Studio* 2017 IDE is installed.
- The remaining prerequisites are OpenCL™ implementation related.
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.
- The SDK can function with a CPU and Intel® Graphics Technology implementation, or just one implementation.
- Full analysis and debug capabilities may only be available for Intel® Graphics Technology implementations.
- Recent distributions of Windows* OS will install the Intel® Graphics Technology driver by default for systems with Intel® Graphics Technology. This driver package contains OpenCL™ CPU and Intel® Graphics Technology implementations. These OpenCL™ implementations may not be up to date to support all the developer features provided in Intel SDK for OpenCL Applications. Options:
- Intel® distributes CPU only OpenCL™ implementations see the deployment portal for OpenCL™ Runtimes for Intel® Processors for more details.
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:
- The Experimental OpenCL 2.1 CPU Only Platform has:
- CPU OpenCL™ target device implementation for development, non-production usages only. Per release notes, it is expected to be removed in future product updates.
- The Intel(R) OpenCL platform has:
- A CPU OpenCL™ target device implementation suitable for production usages.
- An Intel® Graphics Technology OpenCL™ target device implementation suitable for production usages.
- Users who have only Intel® CPU Runtime for OpenCL Applications installed will only see the CPU OpenCL™ target device.
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:
- Dynamically allocate OpenCL™ memory objects
- Schedule OpenCL™ command queue items
- Size global NDRanges and local workgroup sizes
- Use OpenCL™ extensions available for the device, referencing the extension specifications on the Khronos OpenCL™ registry.
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:
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.
- Walkthrough the analysis, debug, and other Intel® SDK for OpenCL™ Applications plugin facilities with this quick start guide.
- As mentioned earlier, for a video walkthrough check techdecoded.intel.io for the ‘OpenCL™ Development with Intel® System Studio 2019 on Windows* OS’ introduction. (Expected End of October)
- Note: the video uses an older release candidate than the Intel® SDK for OpenCL™ Applications 2019 than examined here.
- As a next step, please see the Intel® GPU Compute Samples posted on github. In particular, take a look at the examples using the cl_intel_subgroups extension. This extension is needed to get better performance from Intel® Graphics Technology hardware on recent Intel® Processors.
- For both CPU and Intel® Graphics Technology analysis, please see Intel® VTune™ Amplifier as part of Intel® System Studio 2019 or as a standalone package.
- Please see the community forums for Intel® development for OpenCL™ technologies.
- See more references at the Khronos OpenCL™ registry.
- 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.
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
Product and Performance Information
Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.