OpenCV4入门教程028:OpenCL

索引地址:系列索引

OpenCL(全称Open Computing Language,开放运算语言)是第一个面向异构系统通用目的并行编程的开放式、免费标准,也是一个统一的编程环境,便于软件开发人员为高性能计算服务器、桌面计算系统、手持设备编写高效轻便的代码,而且广泛适用于多核心处理器(CPU)、图形处理器(GPU)、Cell类型架构以及数字信号处理器(DSP)等其他并行处理器,在游戏、娱乐、科研、医疗等各种领域都有广阔的发展前景。

我暂时没有用过,本文来查看以下系统opencl的版本信息。

测试代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "opencv2/opencv.hpp"
#include "opencv2/core/ocl.hpp"

using namespace std;
using namespace cv;
using namespace cv::ocl;

int main()
{
vector<ocl::PlatformInfo> info;
getPlatfomsInfo(info);
PlatformInfo sdk = info.at(0);

if (sdk.deviceNumber()<1)
return -1;

cout << "******SDK*******" << endl;
cout << "Name: " << sdk.name() << endl;
cout << "Vendor: " << sdk.vendor() << endl;
cout << "Version: " << sdk.version() << endl;
cout << "Number of devices: " << sdk.deviceNumber() << endl;

for (int i=0; i<sdk.deviceNumber(); i++){
Device device;
sdk.getDevice(device,i);
cout << "\n\n*********************\n Device " << i+1 << endl;

cout << "Vendor ID: " << device.vendorID() << endl;
cout << "Vendor name: " << device.vendorName() << endl;
cout << "Name: " << device.name() << endl;
cout << "Driver version: " << device.driverVersion() << endl;
if (device.isAMD()) cout << "Is an AMD device" << endl;
if (device.isIntel()) cout << "Is a Intel device" << endl;
cout << "Global Memory size: " << device.globalMemSize() << endl;
cout << "Memory cache size: " << device.globalMemCacheSize() << endl;
cout << "Memory cache type: " << device.globalMemCacheType() << endl;
cout << "Local Memory size: " << device.localMemSize() << endl;
cout << "Local Memory type: " << device.localMemType() << endl;
cout << "Max Clock frequency: " << device.maxClockFrequency() << endl;
}

return 0;
}

测试输出:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
******SDK*******
Name: NVIDIA CUDA
Vendor: NVIDIA Corporation
Version: OpenCL 1.2 CUDA 11.1.110
Number of devices: 1


*********************
Device 1
Vendor ID: 3
Vendor name: NVIDIA Corporation
Name: GeForce GTX 1660 Ti
Driver version: 455.38
Global Memory size: 6230245376
Memory cache size: 786432
Memory cache type: 2
Local Memory size: 49152
Local Memory type: 1
Max Clock frequency: 1590

OpenCV4入门教程028:OpenCL
https://blog.jackeylea.com/opencv/opencv-opencl-introduction/
作者
JackeyLea
发布于
2020年11月10日
许可协议