SURF_GPU & thread safety (Bug #3592)
Description
When multiple threads call SURF_GPU at the same time, they lead to unexpected and random results. It does not happen if each call is performed sequentially.
The bug seems to come from the operator() because it does not occur anymore if operator call is surrounded by mutex.
Exemple : --------------
| KO Thread code |--------------
[...]
cv::gpu::SURF_GPU surf(minHessian, 4, 2, is_extended, 0.01f);
surf(gpu_object, cv::gpu::GpuMat(), gpu_keypoints_object, gpu_descriptors_object);
surf(gpu_scene, cv::gpu::GpuMat(), gpu_keypoints_scene, gpu_descriptors_scene);
[...]
--------------
| OK Thread code |--------------
[...]
cv::gpu::SURF_GPU surf(minHessian, 4, 2, is_extended, 0.01f);
pthread_mutex_lock(mutex);
surf(gpu_object, cv::gpu::GpuMat(), gpu_keypoints_object, gpu_descriptors_object);
surf(gpu_scene, cv::gpu::GpuMat(), gpu_keypoints_scene, gpu_descriptors_scene);
pthread_mutex_unlock(mutex);
[...]
I'm working on Ubuntu 12.04.4 LTS 64bits with CUDA 5.5.22 (GPU Quadro K4000) and OpenCV 2.4.8 (Linux release version).
It does not seem to come from CUDA or GPU since I test with other gpu functions and I never encountered the problem again.
Associated revisions
Merge pull request #3592 from jet47:cuda-7.0-android
History
Updated by Stephane LADEVIE about 11 years ago
- Assignee deleted (
Vladislav Vinogradov)
Updated by Dinar Ahmatnurov about 11 years ago
- Status changed from New to Cancelled