OpenCL编程:获取平台信息

如果想知道平台支持OpenCL的相关信息,可以调用clGetPlatformInfo。

函数原型如下:

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);

char pform_name[40];
for (int i=0; i<num_platforms; i++)
{
	err = clGetPlatformInfo(platforms[i], CL_PLATFORM_NAME, sizeof(pform_name), &pform_name, NULL);
	cout << "platform " << i <<"name: " << pform_name<<endl;

	clGetPlatformInfo(platforms[i], CL_PLATFORM_VENDOR, sizeof(pform_name), &pform_name, NULL);
	cout << "platform " << i << "vendor: " << pform_name<<endl;

	clGetPlatformInfo(platforms[i], CL_PLATFORM_VERSION, sizeof(pform_name), &pform_name, NULL);
	cout << "platform " << i << "version: " << pform_name<<endl;

	clGetPlatformInfo(platforms[i], CL_PLATFORM_PROFILE, sizeof(pform_name), &pform_name, NULL);
	cout << "platform " << i << "profile: " << pform_name<<endl;
}

输出:

猜你喜欢

转载自blog.csdn.net/heiheiya/article/details/81087038
今日推荐