Channels ▼
RSS

End-to-End Development with Intel Parallel Studio


Stephen Blair-Chappell is a technical consulting engineer at Intel.


One of the fun things I do as an Intel technologist is to speak at various conferences and seminars. The hottest topic of the year at these events has been "how do I make my program parallel?". To answer this question, I decided to use Intel Parallel Studio which is designed to help programmers to develop and debug parallel applications. Parallel Studio is ideal for Windows C\C++ programmers who write and develop programs using Microsoft Visual Studio.

Parallel Studio consists of four tools that plug into Visual Studio:

  • Intel Parallel Advisor
  • Intel Parallel Composer
  • Intel Parallel Inspector
  • Intel Parallel Amplifier.

In my presentations I show how to change a serial application into parallel. The techniques I used are not new -- I've been promoting the same four-stage development cycle for the last 18 months. What was new was the use of the Parallel Studio as a complete solution. In this development cycle (see Figure 1) I first analyse an existing application looking for the best place to apply parallelism. I then add parallel code to the spot just identified. Following that I verify that the code I have added is correct and has no parallel-type bugs. Finally I tune the parallel application.

Figure 1: Four-stage development cycle..

Analysis

The program I use as a starting point is one that calculates the value of Pi using an approximate integration technique. In this first stage I am interested in identifying hotspots in the code, since these are likely to be the best place to add parallelism. Using Parallel Amplifier, it can be seen that at the heart of the code is a function that does all the donkey work.

Code and Debug

For my example I decided to use OpenMP as the means of adding parallelism. OpenMP is easy to use and is great for incrementally introducing parallelism to applications. My first attempt looked like this:


double CalcPi()
{
          double pi, sum=0.0;
   #pragma omp parallel for
       for (int i=0; i<num_steps; i++)
      {
          sum = CalcSum(i,sum);
      }
      pi = sum*step;
      return pi;
}

If you're an expert, you've already spotted the errors in my code. These errors will become obvious in the next stage of the development cycle.

Intel Parallel Composer users have several options on how to implement their parallelism. As well as supporting OpenMP, Parallel Studio includes a simplified parallel language extension; Threading Building Blocks; and Win32 native threads. Alongside the compiler comes a parallel debugger that extends the Visual Studio debugger to make parallel debugging simpler.

Verify

I'm told that one of the biggest hurdles stopping programmers from introducing parallelism in their code is the fear that they will introduce diffi cult to find errors. Parallel Inspector helps programmers detect parallel type errors such as data races and deadlocks, as well as memory leaks (see Figure 2).

Figure 2: Using Parallel Inspector to identify hotspots.

In my application, Inspector identified two data races which I then corrected by modifying the code. One of the great things about Parallel Studio is how easy the tool can be configured. For example, when using Parallel Inspector the analysis type is selected by simply turning a dial (Figure 3).

Figure 3: A configuration dial in Parallel Inspector.

Tune

The Intel Parallel Amplifier is used to spot load in balances and threading overhead. In my Pi program, Parallel Amplifier confirmed that my application had a high degree of parallelism with no threading overhead (Figure 4).

Figure 4: Using Parallel Amplifier to tune an applications.

Conclusion

The things that stick out for me are ease-of-use and that all the required components of Parallel Studio integrate into the Microsoft Visual Studio from a single installer. That means you don't have to hunt around for different packages and licences.


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.
 

Comments:

Video