602
社区成员
发帖
与我相关
我的任务
分享
cl_uint num_platforms;
cl_platform_id *platforms = NULL;
cl_int ret = clGetPlatformIDs(5, NULL, &num_platforms);
if (0 == ret){
printf("已获取平台数量:%d\n", num_platforms);
}
else{
printf("获取平台数量失败,请检查\n");
return 1;
}
platforms = (cl_platform_id *)malloc(sizeof(cl_platform_id)*num_platforms);
ret = clGetPlatformIDs(5, platforms, NULL);
char platform_vendor[40];
ret = clGetPlatformInfo(*platforms, CL_PLATFORM_VENDOR, sizeof(platform_vendor), platform_vendor, NULL);
if (0 == ret){
cout << "平台厂商:"<< platform_vendor << endl;
}
else{
cout << "获取平台信息失败!" << endl;
return 1;
}
free(platforms);
system("pause");
//平台结构
cl_platform_id *platforms = NULL;
cl_uint num_platform = 0;
int ret = clGetPlatformIDs(3, NULL, &num_platform);
if (ret == 1){
//cout << "函数执行错误,请检查!" << endl;
return 1;
}
//cout << "机器平台数量:" << num_platform << endl;
printf("机器平台数量:%d\n", num_platform);
platforms = (cl_platform_id *)malloc(sizeof(cl_platform_id)*num_platform);
ret = clGetPlatformIDs(3, platforms, NULL);
free(platforms);
system("pause");
//平台结构
cl_platform_id *platforms = NULL;
cl_uint num_platform = 0;
int ret = clGetPlatformIDs(3, NULL, &num_platform);
if (ret == 1){
//cout << "函数执行错误,请检查!" << endl;
return 1;
}
//cout << "机器平台数量:" << num_platform << endl;
printf("机器平台数量:%d\n", num_platform);
platforms = (cl_platform_id *)malloc(sizeof(cl_platform_id)*num_platform);
ret = clGetPlatformIDs(num_platform , platforms, NULL);
free(platforms);
system("pause");