Intel® Advisor


OpenMP* is a parallel programming framework for C, C++, or Fortran code. Using OpenMP requires few source changes and is supported by multiple compilers. Because OpenMP is supported by OpenMP libraries, you modify your source code with compiler directives rather than using types, variables, and calls. An OpenMP program can often be changed from parallel execution to serial execution by omitting a compiler option so the compiler ignores the OpenMP directives.

Testing the Intel TBB Synchronization Code

After you add Intel TBB synchronization code (such as mutexes), but before adding the constructs that cause the program to use parallel execution, you should test your serial program. The synchronization code may introduce problems if you have inadvertently used a non-recursive mutex in a recursive context, or if your edits accidentally changed some other piece of program behavior.

It is much easier to find these problems in the serial version of your program than it will be in the parallel version.

Basic OpenMP Atomic Operations

Use OpenMP atomic operations to allow multiple threads to safely update a shared numeric variable, such as on hardware platforms that support atomic operation use. An atomic operation applies only to the single assignment statement that immediately follows it, so atomic operations are useful for code that requires fine-grain synchronization.

Before the statement to be protected, use:

  • #pragma omp atomic for C/C++.

Subscribe to Intel® Advisor