To get a trial key
fill out the form below
Team License (a basic version)
Enterprise License (extended version)
* By clicking this button you agree to our Privacy Policy statement

Request our prices
New License
License Renewal
--Select currency--
USD
EUR
GBP
RUB
* By clicking this button you agree to our Privacy Policy statement

Free PVS-Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

Message submitted.

Your message has been sent. We will email you at


If you haven't received our response, please do the following:
check your Spam/Junk folder and click the "Not Spam" button for our message.
This way, you won't miss messages from our team in the future.

>
>
Parallel notes N2 - toolkit for OpenMP

Parallel notes N2 - toolkit for OpenMP

Feb 24 2010
Author:

Before starting to study the technique of parallelizing programs with the help of OpenMP technology, let us discuss the toolkit we will need. And here is what we will need first of all - Visual Studio 2005/2008 and Intel Parallel Studio.

0058_Parallel_notes_N2_-_toolkit_for_OpenMP/image1.png

The advantage of OpenMP technology is that you may take the code of a serial program and parallelize it without significantly modifying it. It is done with the help of special directives arranged throughout the program text. Of course, in practice you will not only have to add directives but also edit the application code but these changes will be much fewer than if using alternative technologies such as MPI.

All said above means that you may take a common C/C++ serial code and start parallelizing it gradually. To do it you just need to enable OpenMP support in the project. Go to the project properties in Visual Studio 2005/2008 environment and choose the tab C/C++ / Language as shown in Figure 1.

0058_Parallel_notes_N2_-_toolkit_for_OpenMP/image2.png

Figure 1 - The tab of project settings in Visual Studio where you may enable OpenMP support

Do not forget also to choose the platforms and configurations you want to employ OpenMP in. As shown in Figure 2, we have chosen all the configurations (debug, release) and all the platforms (Win32, x64).

0058_Parallel_notes_N2_-_toolkit_for_OpenMP/image3.png

Figure 2 - Choosing configurations and platforms to set the properties for

OpenMP support is enabled by the option "OpenMP Support" as shown in Figure 3.

0058_Parallel_notes_N2_-_toolkit_for_OpenMP/image4.png

Figure 3 - OpenMP support is enabled

The next step is to enable the header file "omp.h". It is often reasonable to put "#include <omp.h>" into "stdafx.h" to make it visible to the whole project.

These are all the preliminary steps you should make to start mastering OpenMP technology and parallelizing the program code. We will begin to study OpenMP in the next post. But now let us continue discussing the tools. You see, although Visual Studio 2005/2008 provides all the necessary functions to develop parallel OpenMP programs, it is too restricted. It is better to employ Intel® Parallel Studio to conveniently and efficiently work with OpenMP. I am not Intel employee and I am not paid for advertising its tools - I recommend it because it is really a convenient and very useful tool for developing parallel applications. I recommend it relying on my own experience.

Intel Parallel Studio distribution kit is about 460 Mbytes and you may download it from the Intel site. Parallel Studio functions remain unlimited during one trial month - this time is quite enough to understand the working principles and carry out some experiments with parallel code. Parallel Studio integrates into Visual Studio 2005/2008 and adds the corresponding menu and toolbar items (see Figure 4).

0058_Parallel_notes_N2_-_toolkit_for_OpenMP/image5.png

In the next parallel notes we will use the tool Intel Parallel Inspector from the Intel® Parallel Studio package to check the parallel code being created for parallel errors. We will also use Intel® Parallel Amplifier in optimization purposes. We do not necessarily need Intel Parallel Composer compiler but still we will use it to compile OpenMP applications. One of its advantages is that it supports OpenMP 3.0 standard while the Visual Studio 2005/2008 compiler provides support only for OpenMP 2.0. Also, Intel C++ provides some additional functions of static analysis of parallel code - you may read about them in the article.

To compile an application with Parallel Composer you should enable Intel C++. Click the button "Use Intel C++" on the toolbar to do that as shown in Figure 5.

0058_Parallel_notes_N2_-_toolkit_for_OpenMP/image6.png

Now Intel C++ will be used to build applications. And one more thing - if you see a message like the one shown in Figure 6 on launching the application, do not get upset.

0058_Parallel_notes_N2_-_toolkit_for_OpenMP/image7.png

Try just to relaunch Visual Studio to enable the changes introduced by Parallel Studio into the environment. If it does not help, set the environment manually by launching the corresponding command files. You may do this from the Start menu as shown in Figure 7.

0058_Parallel_notes_N2_-_toolkit_for_OpenMP/image8.png

Introduction into the tools is over at this point. Download and install Intel Parallel Studio and try to build some simple program of yours with Intel C++.

Popular related articles
Technologies used in the PVS-Studio code analyzer for finding bugs and potential vulnerabilities

Date: Nov 21 2018

Author: Andrey Karpov

A brief description of technologies used in the PVS-Studio tool, which let us effectively detect a large number of error patterns and potential vulnerabilities. The article describes the implementati…
The Ultimate Question of Programming, Refactoring, and Everything

Date: Apr 14 2016

Author: Andrey Karpov

Yes, you've guessed correctly - the answer is "42". In this article you will find 42 recommendations about coding in C++ that can help a programmer avoid a lot of errors, save time and effort. The au…
Characteristics of PVS-Studio Analyzer by the Example of EFL Core Libraries, 10-15% of False Positives

Date: Jul 31 2017

Author: Andrey Karpov

After I wrote quite a big article about the analysis of the Tizen OS code, I received a large number of questions concerning the percentage of false positives and the density of errors (how many erro…
Free PVS-Studio for those who develops open source projects

Date: Dec 22 2018

Author: Andrey Karpov

On the New 2019 year's eve, a PVS-Studio team decided to make a nice gift for all contributors of open-source projects hosted on GitHub, GitLab or Bitbucket. They are given free usage of PVS-Studio s…
PVS-Studio for Java

Date: Jan 17 2019

Author: Andrey Karpov

In the seventh version of the PVS-Studio static analyzer, we added support of the Java language. It's time for a brief story of how we've started making support of the Java language, how far we've co…
The Evil within the Comparison Functions

Date: May 19 2017

Author: Andrey Karpov

Perhaps, readers remember my article titled "Last line effect". It describes a pattern I've once noticed: in most cases programmers make an error in the last line of similar text blocks. Now I want t…
PVS-Studio ROI

Date: Jan 30 2019

Author: Andrey Karpov

Occasionally, we're asked a question, what monetary value the company will receive from using PVS-Studio. We decided to draw up a response in the form of an article and provide tables, which will sho…
The way static analyzers fight against false positives, and why they do it

Date: Mar 20 2017

Author: Andrey Karpov

In my previous article I wrote that I don't like the approach of evaluating the efficiency of static analyzers with the help of synthetic tests. In that article, I give the example of a code fragment…
The Last Line Effect

Date: May 31 2014

Author: Andrey Karpov

I have studied many errors caused by the use of the Copy-Paste method, and can assure you that programmers most often tend to make mistakes in the last fragment of a homogeneous code block. I have ne…
How PVS-Studio Proved to Be More Attentive Than Three and a Half Programmers

Date: Oct 22 2018

Author: Andrey Karpov

Just like other static analyzers, PVS-Studio often produces false positives. What you are about to read is a short story where I'll tell you how PVS-Studio proved, just one more time, to be more atte…

Comments (0)

Next comments
This website uses cookies and other technology to provide you a more personalized experience. By continuing the view of our web-pages you accept the terms of using these files. If you don't want your personal data to be processed, please, leave this site.
Learn More →
Accept