Home Find which GPU a GpuMat is on
Reply: 0

Find which GPU a GpuMat is on

user555
1#
user555 Published in May 26, 2018, 11:40 pm

With multiple GPUs on my system, I would like to find an easy way to determine which GPU a cv::cuda::GpuMat is allocated on. For example, ignoring errors:

int numDevices = cv::cuda::getCudaEnabledDeviceCount();
// Choose a random GPU
cudaSetDevice(rand()%numDevices);
cv::cuda::GpuMat foo(5, 5, CV_8UC1);
// Choose another random GPU
cudaSetDevice(rand()%numDevices);

Now, which GPU does foo live on? I'm using OpenCV 3 and CUDA 8, in case there is a version-specific solution.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.302477 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO