一、了解自己GPU的性能
方式有很多,我这里是编译opencv-gpu版本后,可以输出的相关信息。相关代码和结果:
#include "opencv2/opencv.hpp"
#include "opencv2/core/cuda.hpp"
using namespace std;
using namespace cv;
using namespace cv::cuda;
int main()
{
int num_devices = cv::cuda::getCudaEnabledDeviceCount();
cuda::printCudaDeviceInfo(cuda::getDevice());
cout << num_devices << endl;
int i;
cin >> i;
}
结果: