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 https://www.khronos.org/registry/OpenCL/specs/2.2/html/OpenCL_API.html#clGetPlatformInfo
cl_platform_info Return Type Description

CL_​PLATFORM_​PROFILE

char[]1

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, or 2.2.

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_​HOST_​TIMER_​RESOLUTION

Missing before version 2.1.

cl_ulong

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

clGetPlatformInfo returns CL_​SUCCESS if the function is executed successfully. Otherwise, it returns one of the following errors2.

  • 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.

    1

    A null terminated string is returned by OpenCL query function calls if the return type of the information being queried is a char[].

    2

    The OpenCL specification does not describe the order of precedence for error codes returned by API calls.

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 (c) 2014-2020 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.