-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
How to set cuda device in dnn module? #17852
Copy link
Copy link
Closed
Labels
category: gpu/cuda (contrib)OpenCV 4.0+: moved to opencv_contribOpenCV 4.0+: moved to opencv_contribquestion (invalid tracker)ask questions and other "no action" items here: https://forum.opencv.orgask questions and other "no action" items here: https://forum.opencv.org
Description
System information (version)
- OpenCV => 4.3.0
- Operating System / Platform => CentOS7
- Compiler => GCC6.2
Detailed description
int gpu_id = 2;
int device_count;
device_count = cv::cuda::getCudaEnabledDeviceCount();
//cudaGetDeviceCount(&device_count);
cv::cuda::setDevice(gpu_id);
//cudaSetDevice(gpu_id);
net = cv::dnn::readNetFromONNX("colorE.onnx");
net.setPreferableTarget(cv::dnn::DNN_TARGET_CUDA);
net.setPreferableBackend(cv::dnn::DNN_BACKEND_CUDA);
when I set gpu_id is 2, but Memory appear in GPU:0 and GPU:2. I don't know what's wrong with the code.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
category: gpu/cuda (contrib)OpenCV 4.0+: moved to opencv_contribOpenCV 4.0+: moved to opencv_contribquestion (invalid tracker)ask questions and other "no action" items here: https://forum.opencv.orgask questions and other "no action" items here: https://forum.opencv.org