日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

OpenCL列举平台列表以及平台属性信息

發布時間:2023/12/15 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 OpenCL列举平台列表以及平台属性信息 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

摘自《OpenCL異構并行計算原理、機制與優化實踐》

// Platform.cpp : Defines the entry point for the console application. //#include "stdafx.h"#include <CL/cl.h> #include <stdio.h> #include <string.h> #include <malloc.h>int main() {cl_platform_id *platform;cl_uint num_platform;cl_int err;err = clGetPlatformIDs(0, NULL, &num_platform);platform = (cl_platform_id *)malloc(sizeof(cl_platform_id) * num_platform);err = clGetPlatformIDs(num_platform, platform, NULL);for (int i = 0; i < num_platform; i++){size_t size;// get nameerr = clGetPlatformInfo(platform[i], CL_PLATFORM_NAME, 0, NULL, &size);char *name = (char *)malloc(size);err = clGetPlatformInfo(platform[i], CL_PLATFORM_NAME, size, name, NULL);printf("CL_PLATFORM_NAME:%s\n", name);// vendorerr = clGetPlatformInfo(platform[i], CL_PLATFORM_VENDOR, 0, NULL, &size);char *vendor = (char *)malloc(size);err = clGetPlatformInfo(platform[i], CL_PLATFORM_VENDOR, size, vendor, NULL);printf("CL_PLATFORM_VENDOR:%s\n", vendor);// versionerr = clGetPlatformInfo(platform[i], CL_PLATFORM_VERSION, 0, NULL, &size);char *version = (char *)malloc(size);err = clGetPlatformInfo(platform[i], CL_PLATFORM_VERSION, size, version, NULL);printf("CL_PLATFORM_VERSION:%s\n", version);// profileerr = clGetPlatformInfo(platform[i], CL_PLATFORM_PROFILE, 0, NULL, &size);char *profile = (char *)malloc(size);err = clGetPlatformInfo(platform[i], CL_PLATFORM_PROFILE, size, profile, NULL);printf("CL_PLATFORM_PROFILE:%s\n", profile);// extensionserr = clGetPlatformInfo(platform[i], CL_PLATFORM_EXTENSIONS, 0, NULL, &size);char *extensions = (char *)malloc(size);err = clGetPlatformInfo(platform[i], CL_PLATFORM_EXTENSIONS, size, extensions, NULL);printf("CL_PLATFORM_EXTENSIONS:%s\n", extensions);//printf("\n\n");// cleanfree(name);free(vendor);free(version);free(profile);free(extensions);}return 0; }

總結

以上是生活随笔為你收集整理的OpenCL列举平台列表以及平台属性信息的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。