C Specification

Specific information about an OpenCL platform can be obtained with the function:

cl_int clGetPlatformInfo(
    cl_platform_id platform,
    cl_platform_info param_name,
    size_t param_value_size,
    void* param_value,
    size_t* param_value_size_ret);

Parameters

  • platform refers to the platform ID returned by clGetPlatformIDs or can be NULL. If platform is NULL, the behavior is implementation-defined.

  • param_name is an enumeration constant that identifies the platform information being queried. It can be one of the following values as specified in the Platform Queries table.

  • param_value is a pointer to memory location where appropriate values for a given param_name, as specified in the Platform Queries table, will be returned. If param_value is NULL, it is ignored.

  • param_value_size specifies the size in bytes of memory pointed to by param_value. This size in bytes must be ≥ size of return type specified in the Platform Queries table.

  • param_value_size_ret returns the actual size in bytes of data being queried by param_name. If param_value_size_ret is NULL, it is ignored.

Description

The information that can be queried using clGetPlatformInfo is specified in the Platform Queries table.

Table 1. List of supported param_names by clGetPlatformInfo
Platform Info Return Type Description

CL_PLATFORM_PROFILE [1]

char[] [2]

OpenCL profile string. Returns the profile name supported by the implementation. The profile name returned can be one of the following strings:

FULL_PROFILE - if the implementation supports the OpenCL specification (functionality defined as part of the core specification and does not require any extensions to be supported).

EMBEDDED_PROFILE - if the implementation supports the OpenCL embedded profile. The embedded profile is defined to be a subset for each version of OpenCL. The embedded profile for OpenCL is described in OpenCL Embedded Profile.

CL_PLATFORM_VERSION

char[]

OpenCL version string. Returns the OpenCL version supported by the implementation. This version string has the following format:

OpenCL<space><major_version.minor_version><space><platform-specific information>

The major_version.minor_version value returned will be one of 1.0, 1.1, 1.2, 2.0, 2.1, 2.2 or 3.0.

CL_PLATFORM_NUMERIC_VERSION

missing before version 3.0.

cl_version

Returns the detailed (major, minor, patch) version supported by the platform. The major and minor version numbers returned must match those returned via CL_PLATFORM_VERSION.

CL_PLATFORM_NAME

char[]

Platform name string.

CL_PLATFORM_VENDOR

char[]

Platform vendor string.

CL_PLATFORM_EXTENSIONS

char[]

Returns a space separated list of extension names (the extension names themselves do not contain any spaces) supported by the platform. Each extension that is supported by all devices associated with this platform must be reported here.

CL_PLATFORM_EXTENSIONS_WITH_VERSION

missing before version 3.0.

cl_name_version[]

Returns an array of description (name and version) structures that lists all the extensions supported by the platform. The same extension name must not be reported more than once. The list of extensions reported must match the list reported via CL_PLATFORM_EXTENSIONS.

CL_PLATFORM_HOST_TIMER_RESOLUTION

missing before version 2.1.

cl_ulong

Returns the resolution of the host timer in nanoseconds as used by clGetDeviceAndHostTimer.

Support for device and host timer synchronization is required for platforms supporting OpenCL 2.1 or 2.2. This value must be 0 for devices that do not support device and host timer synchronization.

clGetPlatformInfo returns CL_SUCCESS if the function is executed successfully. Otherwise, it returns one of the following errors [3].

  • CL_INVALID_PLATFORM if platform is not a valid platform.

  • CL_INVALID_VALUE if param_name is not one of the supported values or if size in bytes specified by param_value_size is < size of return type as specified in the OpenCL Platform Queries table, and param_value is not a NULL value.

  • CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.

See Also

Document Notes

For more information, see the OpenCL Specification

This page is extracted from the OpenCL Specification. Fixes and changes should be made to the Specification, not directly.

Copyright 2014-2023 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0


1. The platform profile returns the profile that is implemented by the OpenCL framework. If the platform profile returned is FULL_PROFILE, the OpenCL framework will support devices that are FULL_PROFILE and may also support devices that are EMBEDDED_PROFILE. The compiler must be available for all devices i.e. CL_DEVICE_COMPILER_AVAILABLE is CL_TRUE. If the platform profile returned is EMBEDDED_PROFILE, then devices that are only EMBEDDED_PROFILE are supported.
2. A null terminated string is returned by OpenCL query function calls if the return type of the information being queried is a char[].
3. The OpenCL specification does not describe the order of precedence for error codes returned by API calls.