, , , C, , , cl.hpp . , , C :
cl_platform_id platform_id = NULL;
cl_int ret = clGetPlatformIDs(1, &platform_id, &ret_num_platforms);
, 1. , OpenCL , platform_id. , , "ret", , , .
, , cl.hpp, cl:: Platform:: get:
static cl_int get(
VECTOR_CLASS<Platform>* platforms)
{
cl_uint n = 0;
cl_int err = ::clGetPlatformIDs(0, NULL, &n);
if (err != CL_SUCCESS) {
return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
}
cl_platform_id* ids = (cl_platform_id*) alloca(
n * sizeof(cl_platform_id));
err = ::clGetPlatformIDs(n, ids, NULL);
if (err != CL_SUCCESS) {
return detail::errHandler(err, __GET_PLATFORM_IDS_ERR);
}
platforms->assign(&ids[0], &ids[n]);
return CL_SUCCESS;
}
,
::clGetPlatformIDs(0, NULL, &n);
, 0, OpenCL runtime "n". , "n".
, , C , , , cl.hpp - , , .
, ICD . , :
ERROR: clGetPlatformID -1001 OpenCL (Linux)
, .