Could you let us know what are the recommended tools to debug TBB applications, including finding race conditions, memory problems, performance issues, etc.
I know valgrind doesn't support tbb memory allocator.
If you would like to find memory and threading issues in TBB application, I'd suggest using Intel Inspector XE. To monitorperformance of your application you can use Intel VTune Amplifier XE. Both tools support TBB.
It depends on what IDE you're using. For example, in case of a Windows platform aVisual Studio'sDebugger is one of the best.
Thanks. I am working on Linux.
adding Intel Debugger (IDB) that comes with the Intel Composer XE 2011 for Linux. It also has awareness of the most important TBB containers and even allows partial editing (as long as the allocation model allows it) during runtime.IDB also has a feature to detect data races called Thread Data Sharing Detection.
Quoting Georg Zitzlsberger (Intel)Hello,
adding Intel Debugger (IDB) that comes with the Intel Composer XE 2011 for Linux. It also has awareness of the most important TBB containers...
[SergeyK] Could you provide more technical details ( I mean the list of these containers )? And, what do you mean when you mentioned'awareness'?
the support for TBB is adding awareness to IDB about it to get the same features as for STL:- TBB types, mostly containers, are shown "pretty printed" (see screenshot)- TBB types can be modified (if no allocation/deallocation is needed)- TBB implementation is not entered when doing step-into (but can be turned off by setting $usessteppingrules=0)
You'll find a file called idb_tbb_config.xml in the debugger directory (inside Composer XE 2011 for Linux). It defines filters for doing the pretty printing. Currently we support the following TBB types:
Giving an example:
In the screenshot above we're evaluating cv which is TBB type concurrenct_vector of type long. Usually you'd see the real data members of it which are pointers (begin, end, next, ...). Then it's hard to extract the elements you, as a developer, are usually interested in. IDB does this for you automatically, which is called pretty printing. Here, you see the three elements of type long (1/4, 2 & 3).Also IDB allows you to modify those elements, which I'm just doing; value of first element was changed from 1 to 4. Note, that you cannot remove or add new elements becasue that involves allocation/deallocation which is not possible.Regarding stepping: If you're at lines 10-12 and try to do a step-into IDB detects that this is TBB namespace and does not follow. For you, it's 3rd party code and usually you won't be interested in its implementation. Mostly people do step-into very quickly and suddently end up inside TBB which is of no use for them. That's the idea of this feature.
Please let me know if you have further questions,
Thank you,Georg! That's anawesomedescription! I wish to see more responses like this one fromeverybody.
Here is an example of debuggingthe sameTBB's 'concurrent_vector' Test-Case withVisual Studio 2005:
There's also the Parallel Studio plugin.