OpenCL™ 2.1 Development Environment

OpenCL™ 2.1 Development Environment enables you to experiment and test OpenCL 2.1 features with the Intel® architecture processors that do not provide native OpenCL 2.1 support.

Note

Only the CPU OpenCL 2.1 device is supported with the development platform.

Note

The OpenCL™ 2.1 Development Environment is a development tool and not an official Khronos* conformant OpenCL™ runtime. Therefore, distribution of the OpenCL applications that use this runtime is prohibited.

To access the OpenCL 2.1 development environment on Microsoft Windows* or Linux* operating systems, install the respective version of the Intel® SDK for OpenCL™ Applications. Installation of the Intel® Graphics driver or the OpenCL™ Runtime is still required for using the experimental platform. When developing applications with the OpenCL 2.1 development platform, use the header files located in <sdkdir>/include/CL. The header files support both OpenCL 1.2 and OpenCL 2.1 platforms.

Note

By default, Intel® processors do not support OpenCL 2.1

The following table provides information on the OpenCL 2.1 platform.

Property

Original Platform

Experimental Platform

CL_PLATFORM_NAME

Intel® OpenCL

Experimental OpenCL 2.1 CPU Only Platform

CL_PLATFORM_VENDOR

Intel® Corporation

Intel® Corporation

CL_PLATFORM_VERSION

OpenCL 2.0 (on Intel® Core™ M and 5th and 6th Generation Intel® Core™ processors)
OpenCL 1.2 (on other supported systems)

OpenCL 2.1

OpenCL Devices

CPU and GPU

CPU only

Refer to the code snippet below for an example of how you can return the OpenCL 2.1 CPU-only platform:

#define USE_EXP \\ set this flag when targeting experimental platforms. Otherwise comment it out
 
#ifdef NON_BDW
#define PLATFROM_NAME "Intel(R) OpenCL"
#else
#define PLATFROM_NAME "Experimental OpenCL 2.1 CPU Only Platform"
#endif
 
cl_platform_id * platforms = NULL;
char vendor_name[128] = {0};
cl_uint num_platforms = 0;
 
// get number of available platforms
cl_int err = clGetPlatformIDs(0, NULL, & num_platforms);
if (CL_SUCCESS != err)
{
    handle error
}
platforms = (cl_platform_id*)malloc(sizeof(cl_platform)* num_platforms);
if (NULL == platforms)
{
    // handle error
}
err = clGetPlatformIDs(num_platforms, platforms, NULL);
if (CL_SUCCESS != err)
{
    // handle error
}
// return the OpenCL 2.1 development environment platform
for (cl_uint ui=0; ui< num_platforms; ++ui)
{
    err = clGetPlatformInfo(platforms[ui],
                CL_PLATFORM_NAME,
                128 * sizeof(char),
                vendor_name,
                NULL);
    if (CL_SUCCESS != err)
    {
        // handle error
    }
    if (vendor_name != NULL)
    {
        if (!strcmp(platform_name, PLATFROM_NAME))
        {
            return platforms[ui];
        }
    }
}

Once the experimental platform is selected, you can start using the Intel CPU on OpenCL 2.1 Platform device option in the Intel Code Builder for OpenCL API.

To build the OpenCL code using the Intel CPU on Experimental OpenCL 2.1 Platform device, specify the following build option:

-cl-std=CL2.1

To check the platform availability, use the Platform Info feature of the Intel Code Builder for OpenCL API in Microsoft Visual Studio*.

See Also

Selecting Target OpenCL™ Device
Configuring Options
Building with Kernel Builder CLI