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,則將其忽略。

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