Channels ▼


Intel Parallel Debugger Extension for Microsoft Visual Studio

This article provides tips and tricks on how to best take advantage of the additional insight into parallel data constructs the Intel Parallel Debugger Extension brings to the Microsoft Visual Studio debug environment. (The Parallel Debugger Extension is part of Intel Parallel Studio.) In doing so it provides a high-level overview of the Intel Parallel Debugger Extension for Microsoft Visual Studio and the key features that enhance the debug experience through enhanced visibility and more in depth understanding of:

  • The data shared between multiple threads in Intel C++ Compiler built applications
  • The vectorized data streams processed in Single Instruction Multiple Data (SIMD) registers
  • The use and dependencies of reentrant function calls
  • Active OpenMP tasks lock information and thread team hierarchies

The advent of more and more "multi" and "many" core processors requires extensive use of parallel programming models to best take advantage of the benefits these systems provide to program execution flow and thus to get the best performance out of these systems. Using more and more advanced parallel programming techniques makes it however more and more difficult to keep track of all active threads and their possible data inter-dependencies. The purpose of the Intel Parallel Debugger Extension for Microsoft Visual Studio is to pair the tools Intel provides for developing highly multi-threaded parallel applications with the debug extensions to allow for equally advanced and easily accessible features in the debugger. Advanced parallel programming techniques call for advanced parallel debugging techniques to keep the executions flow and the analysis of runtime problems straight forward and allow for speedy error corrections.

To follow the examples presented in this article, you need:

  • Windows XP SP2 or SP3, Window Vista
  • Visual Studio 2005 or Visual Studio 2008
  • IA-32, Intel 64 architecture or compatible.

The Intel Parallel Debugger Extension, which is part of the Intel Parallel Composer component of the Intel Parallel Studio, consists of a set of features that can be accessed through the Visual Studio Debug pulldown menu (Figure 1). The additional insight provided into the parallel execution of the code to debug is grouped into the following menu entries:

Figure 1: Intel Parallel Debugger Extension menu entry

Thread Data Sharing Detection: If an applications has been built using Intel's Debug Runtime Library by using the /debug:parallel and /Qopenmp options with the Intel C++ Compiler, data sharing violations can be detected. It is necessary to set both /Qopenmp and /debug:parallel because the thread data sharing detection feature as well as the function re-entrancy detection rely not only on the debug information instrumentation triggered with /debug:parallel, but also on Intel specific parallel language extensions in the OpenMP runtime library that get activated with the /Qopenmp switch (Figure 2) . The "Enable Detection" menu entry (Figure 3) allows turning thread Data sharing event detection on. An exception is raised when the Debugger Extension detects the sharing of data between different threads.

Figure 2: Debug Communication and Data Sharing Detection

The Intel Parallel Debugger Extensions monitors this exception and display the data sharing events in a dedicated window (Figure 4).

Figure 3: Enabling Data Sharing Detection

You can enable data sharing event detection (Figure 3), tell the Debugger Extension to treat such an event as the equivalent of a data breakpoint halting execution, set data sharing filters so only data sharing violations in specific memory regions or data objects, and last but not least you can monitor data sharing events in a dedicated window (Figure 4).

From any of the data sharing events displayed in the Thread Data Sharing Events treeview window you can link back to the associated source code or assembly code via double click at an of the events listed.

Figure 4: Thread Data Sharing Events Context Menu

A data sharing event that has been detected does not indicate that an actual violation causing faulty program execution occurred. It does however indicate that you may want to have a closer look at these events as more than likely they could point to a potential problem.

If you determined that an event is harmless you may also suppress future reporting by selecting the corresponding context menu entry as in Figure 4.

Re-entrant Function Call Detection

From the Visual Studio Debug pulldown menu you can access a dialog that turns on reentrant function call detection and instructs Visual Studio to break and stop execution when different threads call a function at the same time. Thus it permits to debug and monitor accesses closely so you can decide what measures may need to be taken to ensure consistent execution behavior of your application (Figure 5). Prerequisite for the re-entrant function call detection again is compilation of your code with the Intel C++ Compiler using the /debug:parallel and /Qopenmp options. To enable detection you would select the corresponding debug pulldown menu entry and specify a memory address that can be resolved as belonging to a specific function. Any access timing conflicts between multiple threads to that function will then cause the execution to break.

Figure 5: Re-Entrant Call Detection

SSE Registers Window

The Visual Studio debug pulldown menu gives you access to MMX, SSE, SSE2, and SSE3 registers commonly used for data vectorization and single instruction multiple data (SIMD) handling. It displays vectors as rows (or columns) in a table display (Figure 6). Therefore, the SSE Registers Window is a window for displaying expressions, not as single values, but as a vector of values. It thus provides you with ways to change the representation of the data in those registers that makes their use in the debuggee application as well as the actual data mapping to the underlying hardware more transparent.

Figure 6: SSE Registers Window and Context Menu Options

OpenMP Debugging Support

From the Debug pulldown menu as well as the Intel Parallel Debug Extension icons bar you can access information about OpenMP data structures. The prerequisite for this menu entry to be available and grayed out is to have your application built with the OpenMP runtime library, which means that it requires to be compiled with the compiler option /Qopenmp set.

Figure 7: OpenMP Data Structures Pulldown Menu and Display

The OpenMP data structures you can access directly are tasks, task wait lists, task spawn trees, barriers, locks and thread teams (Figure 7).

Serialize Parallel Regions

For OpenMP-based parallel code you can analyze and better understand possible timing issues with parallelized code regions by forcing serial execution.

Figure 8: Serialize Parallel Regions Menu Selection

This let's you determine whether an execution flow correctness issue has been introduced with parallelism, or whether there is a more fundamental coding error that shows up in serial execution as well.

Figure 9: Serial Execution of Parallel Regions

This let's you modify program execution behavior on the fly (Figure 9). It thus provides a very useful feature for basic code correctness checking before investigating an issue further.

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.