- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Interested in finding if your third party DLL is thread safe? See http://www.intel.com/support/performancetools/sb/CS-021533.htmfor details. New features will be highlighted on the product support pages regularly.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
This is a useful essay but I have a couple of minor comments. First, the DLL source codeshould show where the gPrimesFound variable is declared. Second, the statement "If Intel Thread Checker identifies issues...this indicates the dll is not threadsafe" is a little overstated. Consider the following function:
static int var;
I oftensee one-time initializations when I analyze DLL's for threadsafety. I usually have the DLL source code so I know that this type of storage conflict can be ignored. Without source code, I have no way of knowing if the storage conflicts reported by Thread Checker are serious or benign so I have to err on the side of caution and not call the DLL with multiple threads.
Henry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Henry,
Consider
!$OMP PARALLEL
call InitOnce()
call DoSomethingThatModifiesVar()
!$OMP END PARALLEL
The above is a storage conflict. What you might want is
!$OMP PARALLEL
!$OMP MASTER
call InitOnce()
!$OMP END MASTER
!$OMP BARRIER
call DoSomethingThatModifiesVar()
!$OMP END PARALLEL
Or
!$OMP PARALLEL
call InitOnce()
!$OMP BARRIER
call DoSomethingThatModifiesVar()
!$OMP END PARALLEL
The above is simplified and should be examined for usefulness
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I forgot to add...
If "var" is in a module that is part of the DLL then if two applications share the DLL the 2nd app could possibly reset "var" after the 1st app has modifyed it past 0.
If "var" is in the calling app's address space then there would be no conflict provided the InitVar was called once and before var is used.
Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jim,
You're correct that initializing variables in a parallel region then modifying those variables can result in potentially serious storage conflicts. However, I was trying to illustrate that not all storage conflicts reported by Thread Checker are serious. One-time initializationsoften fall into the category of real yet benign conflicts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Henry -
Perhaps amore realistic example of a benign data contention would be using a shared variable to signal that a condition has been met, e.g., threads searching for the same item in a data set and two threads find the desired item within their assigned subset. If more than one thread determines that the condition has been met, they could both set the variable to the same value as the signal.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page