About Examining Potential Correctness Problems

The Intel® Advisor Correctness tool runs your annotated serial program's executable (target) and watches its memory access operations to predict possible parallel data sharing problems. It analyzes your target while it runs serially, using the parallel site, task, and other annotations you added previously. The Correctness tool can only examine annotated serial programs (not parallel programs).

You can run the Correctness tool to collect predicted parallel correctness data:

  • Within Microsoft Visual Studio* by using the Tools menu, Advisor XE Workflow tab, or the toolbar icons (see Using the Menu Items and Toolbars).

  • Within the Intel Advisor standalone GUI by using the Tools menu, the Advisor XE Workflow tab, or the toolbar icons after you open a project.

  • By clicking the Collect Correctness Data button on the side command toolbar.

  • Using the advixe-cl command line, by specifying the --collect option after you open a project.

Similarly, you can view the collected data in the Correctness Report and related windows by using Visual Studio, the standalone GUI, or the command line.

Use the Correctness tool before you have modified your serial program to use parallelism. By observing the data accesses and the annotations during execution, it knows which tasks the accesses are in. The data collected and analyzed appears in the Correctness Report window. You can find bugs before they happen - you do not have to wait for your parallel program to fail and then debug it. As you fix the detected problems, rebuild your application and run the Correctness tool again. When the Correctness tool does not detect any Problems, a No Problems Detected message appears instead of the Correctness Report.

When you write a serial program, you know the order in which its operations will execute. When you create two tasks within that program and execute them in parallel, any operation in either task can execute before, after, or simultaneously with any operation in the other task (or an instance of the same task). Errors occur when two tasks that are executing simultaneously contain operations that access the same memory location. If one of them writes to the location and the other one reads from it, then the result of the read depends on whether it happens before or after the write. If they both write to the location, then the final value in the location depends on which write happens last.

These errors are called data sharing problems. They are also sometimes referred to as conflicts, or data races, because the behavior of the program depends on which operation gets to the data first, or as data dependencies, because the result of executing a data access operation depends on other operations that have previously accessed the same data.

A correct parallel program is expected to be reliable, and typically deterministic in the output it produces. The problem with parallel data sharing problems is that they are non-deterministic. This rearrangement of the order of operations can easily change the behavior of the program. Since the order of operations may be different every time the program is executed, the resulting errors can be hard to reproduce, and even harder to debug. A program may execute perfectly 100 times; then, the next time, one task runs a little bit faster, and reads from an object on the heap before it has been written by another task. Or when you add some print statements or use the debugger, the task slows down and the bug disappears.

After you change annotations or fix data sharing problems, run the Correctness tool again to check the modified program. In addition to data sharing problems, the Correctness tool can predict other problems, such as mismatched annotations pairs and lock-related warnings such as a deadlock. Run this tool until the predicted problems have been fixed. After you fix the data sharing problems, run the Suitability tool again to check your program's predicted performance characteristics.

Caution

To catch the most data sharing problems, run the Correctness tool on your annotated serial program and the Intel® Inspector on your parallel program. As it examines your annotated serial program, the Correctness tool will not detect and report all possible sharing problems. After you have modified your program to run in parallel, use Intel® Inspector to check for problems. Because Intel® Inspector observes the program running in parallel, it can detect some sharing problems that the Correctness tool will not detect. For information on kinds of sharing problems that Intel Advisor will not report, see the help topic Correctness Tool Limitations.

Einzelheiten zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.