segfault with multithreaded gpu calls
Hey,
I'm using gpu::HOGDescriptor from OpenCV 2.4.9.0 in a multithreaded application, that is multiple gpu HoGs are running simultaneously. Ocassionally, I get the following error:
OpenCV Error: Gpu API call (an illegal memory access was encountered) in extract_descrs_by_cols, file /home/stfn/libs/opencv-2.4.9/modules/gpu/src/cuda/hog.cu, line 545
OpenCV Error: Gpu API call (an illegal memory access was encountered) in mallocPitch, file /home/stfn/libs/opencv-2.4.9/modules/dynamicuda/include/opencv2/dynamicuda/dynamicuda.hpp, line 1134
OpenCV Error: Gpu API call (an illegal memory access was encountered) in normalize_hists, file /home/stfn/libs/opencv-2.4.9/modules/gpu/src/cuda/hog.cu, line 323
OpenCV Error: Gpu API call (an illegal memory access was encountered) in call, file /home/stfn/libs/opencv-2.4.9/modules/gpu/include/opencv2/gpu/device/detail/transform_detail.hpp, line 364
terminate called recursively
terminate called recursively
terminate called after throwing an instance of 'cv::ExceptionAbgebrochen (Speicherabzug geschrieben)
It seems that there is no rule for that, it happens completely randomly. Is there a guideline on Cuda resp. the OpenCV gpu module in multithreaded applications or stuff?
It is known that OpenCV CUDA functionality is not threadsafe ... this is a large downside but this causes the illegal attempts you are getting.
So ... would it help to create a cuda context in each thread? The data processed is independent for each thread.
That could be the solution, I am not experienced enough in CUDA development to help you out here.
@stfn: Hello. Did you find a solution to your problem? I am facing the same occasional error with opencv 3.0.0 with cuda::HOG (in compute() function) in a multi-threading software. Thanks.
Like I said, CUDA is not my main area of research, so experience is quite limited there :)
Any news for version 2.4.13.2 ?