Concurrency in cuda module fails with visual studio (Bug #3824)


Added by Ernest Galbrun over 10 years ago. Updated over 9 years ago.


Status:Open Start date:2014-07-22
Priority:Normal Due date:
Assignee:Ernest Galbrun % Done:

0%

Category:gpu (cuda)
Target version:-
Affected version:branch 'master' (3.0-dev) Operating System:Windows
Difficulty: HW Platform:x64
Pull request:

Description

I have had trouble using the cuda functions in a multithreaded environment. After some investigation, it appears that the issue comes from the function-scope static members used in cuda_stream.cpp

As specified here, function-scope static initialization is not thread safe:
http://msdn.microsoft.com/en-us/library/vstudio/s1sb61xd(v=vs.120).aspx

I suggest using a file-scope static variable and an excplicit initialization function since we want to defer the execution of the initialization until we need the variable.

I have implemented the changes but since it deals with core functionality of cuda opencv I would like a direct opinion about that.


cuda_stream.cpp (7.5 kB) Ernest Galbrun, 2014-07-23 02:12 pm


Associated revisions

Revision 4a6b1805
Added by Vadim Pisarevsky almost 10 years ago

Merge pull request #3824 from Milania1:tutorial_hough_lines_fix

History

Updated by Dmitry Retinskiy over 10 years ago

Ernest,

thanks for the suggested correction.
Please put it in the form of pull request (see http://www.code.opencv.org/projects/opencv/wiki/How_to_contribute).
Each pull request is automatically tested and then reviewed before merge.

  • Status changed from New to Open
  • Category set to gpu (cuda)
  • Assignee set to Ernest Galbrun

Updated by Maksim Shabunin over 9 years ago

Issue has been transferred to GitHub: https://github.com/Itseez/opencv/issues/4794

Also available in: Atom PDF