OpenCL - clGetPlatformIDs - clGetPlatformInfo

OpenCL - clGetPlatformIDs - clGetPlatformInfo

1. clGetPlatformIDs

https://www.khronos.org/registry/OpenCL//sdk/1.2/docs/man/xhtml/clGetPlatformIDs.html

Obtain the list of platforms available.
获取可用平台的列表。

cl_int clGetPlatformIDs(cl_uint num_entries,
 	                    cl_platform_id *platforms,
 	                    cl_uint *num_platforms)

1.1 Parameters

  • num_entries

The number of cl_platform_id entries that can be added to platforms. If platforms is not NULL, the num_entries must be greater than zero.
可以添加到 platformscl_platform_id 条目的数量。如果 platforms 不是 NULL,则 num_entries 必须大于零。num_entriesplatforms 中可以容纳 cl_platform_id 表项的数目 。

  • platforms

Returns a list of OpenCL platforms found. The cl_platform_id values returned in platforms can be used to identify a specific OpenCL platform. If platforms argument is NULL, this argument is ignored. The number of OpenCL platforms returned is the mininum of the value specified by num_entries or the number of OpenCL platforms available.
返回找到的 OpenCL 平台的列表。platforms 中的每个 cl_platform_id 都用来标识某个特定的 OpenCL 平台。如果 platforms 参数为 NULL,则忽略此参数。返回的 OpenCL 平台数量是 num_entries 和实际数目中较小的那个。

  • num_platforms

Returns the number of OpenCL platforms available. If num_platforms is NULL, this argument is ignored.
返回可用的 OpenCL 平台数。 如果 num_platformsNULL,则忽略该参数。

1.2 Errors

Returns CL_SUCCESS if the function is executed successfully. Otherwise it returns CL_INVALID_VALUE if num_entries is equal to zero and platforms is not NULL, or if both num_platforms and platforms are NULL.
如果函数执行成功,则返回 CL_SUCCESS。否则,如果 num_entries 等于零且 platforms 不为 NULL,或者 num_platformsplatforms 均为 NULL,则返回CL_INVALID_VALUE

Returns CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.
如果无法在主机上分配 OpenCL 实现所需的资源,则返回 CL_OUT_OF_HOST_MEMORY

2. clGetPlatformInfo

https://www.khronos.org/registry/OpenCL//sdk/1.2/docs/man/xhtml/clGetPlatformInfo.html

Get specific information about the OpenCL platform.
获取有关 OpenCL 平台的特定信息。

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)

2.1 Parameters

  • platform

The platform ID returned by clGetPlatformIDs or can be NULL. If platform is NULL, the behavior is implementation-defined.
platformclGetPlatformIDs 所返回的平台 ID,指明要查询哪个平台,也可以是 NULL。而如果是 NULL,其行为依赖于具体实现。

  • param_name

An enumeration constant that identifies the platform information being queried. It can be one of the values specified in the table below.
一个枚举常量,用于标识要查询的平台信息。它可以是下表中指定的值之一。

  • param_value

A pointer to memory location where appropriate values for a given param_value will be returned. Possible param_value values returned are listed in the table below. If param_value is NULL, it is ignored.
指向内存位置的指针,将返回给定 param_value 的适当值。下表列出了可能返回的 param_value 值。如果 param_valueNULL,则将其忽略。
param_value 是一个指针,所指内存用来存储 param_name 所对应的信息。

  • 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 table below.
指定由 param_value 指向的内存大小 (以字节为单位)。此字节大小必须 ≥ 下表中指定的返回类型的大小。

  • param_value_size_ret

Returns the actual size in bytes of data being queried by param_value. If param_value_size_ret is NULL, it is ignored.
返回由 param_value 查询的数据的实际大小 (以字节为单位)。如果 param_value_size_retNULL,则将其忽略。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章