Channels ▼

Stephen Blair-chappell

Dr. Dobb's Bloggers

Going Parallel: Part 4 -- Enter Intel Parallel Studio

June 08, 2009

Previously I examined a Dhrystone app and identified hotspots. Since then Intel Parallel Studio has been released, so I thought I'd convert the project to use it. This time I concentrate on converting my project to Visual Studio, then use Parallel Studio begin implementing parallelism.

Links to previous sections of blog

Steps to using Parallel Studio

First of all you must already have Visual Studio installed -- either 2005 or 2008. I'm using Visual; Studio 2005.

Parallel Studio can be downloaded from by pressing the Evaluate button.

After you have downloaded and installed the product, you might want to consider downloading the Intel Parallel Advisor Lite from I'll use the Advisor Lite in a subsequent blog, but you might as well get it whilst you are in 'downloading mode'

Creating a Visual Studio Project

First Create new Win32 Console application from the File | New | Project menu

Once you've put a valid path in the Location field, the 'OK' button becomes live. Press OK!

Press the Next> button, and edit the settings as follows...

Finally press Finish.

In the new project, add the existing files from the previous blog (dhry_1.c, dhry_2.c, dhry.h)

After adding all three files, open the project properties and add the TIME to the Preprocessor  Definitions

Build the project with the default settings and make sure the program runs.

Using the Intel C++ Compiler

From the solution context menu select 'Use Intel C++...'

First thing you should notice is a Composer icon appearing in the solution browser.

Adding the Parallelism using OpenMP

I like OpenMP. It's an easy way to add parallelism to code.In my code example, I added a single statement to the beginning of the main lop in the program


    #pragma omp parallel for
(Run_Index = 1; Run_Index <= Number_Of_Runs; ++Run_Index)


To enable OpenMP, you need to modify the compiler options:

I suggest that you also add an extra command-line option to make the compiler spew out any remarks. We can then get better information about any OpenMP directives that the compiler handles.

I then built the code with the Intel compiler ...

The output window shows that the OpenMP code was parallelised

                dhry_1.c(145): (col. 1) remark: OpenMP DEFINED LOOP WAS PARALLELIZED.


Error, Errors Errors!

On running the application I got an application error:

In the next blog I'll look at using Static and Dynamic analysis to help correct the errors I have just introduced.


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.