Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
2465 Discussions

What are the best tools to debug TBB application?

missing__zlw
Beginner
563 Views
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.

Thanks.
0 Kudos
9 Replies
Kirill_R_Intel
Employee
563 Views

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.

Regards,
Kirill

0 Kudos
SergeyKostrov
Valued Contributor II
563 Views
It depends on what IDE you're using. For example, in case of a Windows platform aVisual Studio'sDebugger is one of the best.
0 Kudos
missing__zlw
Beginner
563 Views
Thanks. I am working on Linux.
0 Kudos
Georg_Z_Intel
Employee
563 Views
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 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.

Best regards,

Georg Zitzlsberger
0 Kudos
SergeyKostrov
Valued Contributor II
563 Views
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'?

Best regards,

Georg Zitzlsberger


Best regards,
Sergey

0 Kudos
Georg_Z_Intel
Employee
563 Views
Hi Sergey,

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:

  • task
  • atomic
  • concurrent_vector (& iterator)
  • concurrent_queue (& iterator)
  • concurrent_hashmap (& accessor/iterator)

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,

Georg Zitzlsberger
0 Kudos
SergeyKostrov
Valued Contributor II
563 Views
Thank you,Georg! That's anawesomedescription! I wish to see more responses like this one from
everybody.

Best regards,
Sergey
0 Kudos
SergeyKostrov
Valued Contributor II
563 Views
Here is an example of debuggingthe sameTBB's 'concurrent_vector' Test-Case withVisual Studio 2005:


0 Kudos
RafSchietekat
Valued Contributor III
563 Views
There's also the Parallel Studio plugin.
0 Kudos
Reply