One of the most useful aspects of Intel® Advisor XE is its ability to model parallelism in my application without actually running the code in parallel. Simply by doing this modeling it can tell me potential race conditions and correctness issues while still running everything serially. At first glance I ask myself “Why do I need this modeling? Shouldn’t I just try the parallel code and let another tool, like Intel® Inspector XE, find the race conditions?”
Some parallel frameworks, like OpenMP, can parallelize my for loop with a single pragma. The fact of the matter is that this can work sometimes, but other times it may provide incorrect output data or crash my application before a tool like Intel Inspector XE can find the race conditions. When this happens, it can be very difficult to debug. Crashes in parallel applications may occur non-deteministically and may not be repeatable. This type of bug can be very time consuming to find and correct. By using a modeler I can ensure that my serial testing framework will still work, and the output will be the same as a run without the modeler.
Here is an example of an application that works fine serially, but could crash if parallelized:
Image may be NSFW.
Clik here to view.
This code fills two arrays of integer pointers with the addresses of integers. One array points to integers in counting order, the other in reverse order. It then prints out the integers by dereferencing the pointers in the arrays. When run serially, this code works fine and prints the numbers 0-99 then 99-0. Without a modeler like Intel Advisor XE, I could add the #pragma (currently commented out) to parallelize the loop and let another tool check for races. However, this could crash my application. Since there is a data race on both index variables, some pointers may not be initialized. When they are dereferenced in the printing loops they may throw an exception and never allow my code to finish.
In addition to detecting potential correctness issues in your application, Intel Advisor XE can estimate the scalability of the parallelized version, i.e. approximately how much speedup you will see on a machine with more cores. This information isn't easily available in an already parallelized version of the application and can be very valuable when making decisions about whether or not to add parallelism.
Thus, modeling parallelism as opposed to implementing it can be a very useful step in parallelizing serial code.
You can download a fully-featured evaluation copy of Intel Advisor XE here. You can find more information about Intel Advisor XE here, and talk with other users in our forum here.
Icon Image:
Clik here to view.
