Since 1986 - Covering the Fastest Computers in the World and the People Who Run Them

Language Flags
July 31, 2014

Parallel Programming with OpenMP

Tiffany Trader
OpenMPLogo

One of the most important tools in the HPC programmer’s toolbox is OpenMP, a standard for expressing shared memory parallelism that was published in 1997. The current release, version 4.0, came out last November.

In a recent video, Oracle’s OpenMP committee representative Nawal Copty explores some of the tool’s features and common pitfalls.

Copty explains OpenMP simply as a way to write parallel programs, stating: “you start with your C, C++ or Fortran program and then insert directives in the code to specify to the compiler which parts of the code you want to parallelize.”

There are several advantages over using POSIX threads, according to Copty, such as being easy to learn and use. You don’t need to rewrite your application, just insert directives, an approach called incremental parallelization, where parallelism is added bit by bit. There are several types of parallelism supported by OpenMP, including parallel regions, parallel loops and tasking.

The latest version of OpenMP includes several new features, which Copty highlights. One of these is called region cancellation. This is a mechanism for the programmer to be able to cleanly terminate or abort the execution of a region if certain conditions occur. Another feature involves task dependencies, where the programmer can specify dependent actions. Another important feature is thread affinity. This lets a programmer specify that an application must run on certain processors and not move around while the application is executed.

Copty makes a final note for users to be aware some common pitfalls, including data races and data locks, which can cause incorrect results, hangups and crashes. Oracle Solaris has a tool called thread analyzer that can help pinpoint these conditions.

For those that are interested in the history of OpenMP, Intel showcased the nearly two-decade long OpenMP timeline in its latest issue of Parallel Computing Forum.

An OpenMP Timeline graphic

SC14 Virtual Booth Tours

AMD SC14 video AMD Virtual Booth Tour @ SC14
Click to Play Video
Cray SC14 video Cray Virtual Booth Tour @ SC14
Click to Play Video
Datasite SC14 video DataSite and RedLine @ SC14
Click to Play Video
HP SC14 video HP Virtual Booth Tour @ SC14
Click to Play Video
IBM DCS3860 and Elastic Storage @ SC14 video IBM DCS3860 and Elastic Storage @ SC14
Click to Play Video
IBM Flash Storage
@ SC14 video IBM Flash Storage @ SC14  
Click to Play Video
IBM Platform @ SC14 video IBM Platform @ SC14
Click to Play Video
IBM Power Big Data SC14 video IBM Power Big Data @ SC14
Click to Play Video
Intel SC14 video Intel Virtual Booth Tour @ SC14
Click to Play Video
Lenovo SC14 video Lenovo Virtual Booth Tour @ SC14
Click to Play Video
Mellanox SC14 video Mellanox Virtual Booth Tour @ SC14
Click to Play Video
Panasas SC14 video Panasas Virtual Booth Tour @ SC14
Click to Play Video
Quanta SC14 video Quanta Virtual Booth Tour @ SC14
Click to Play Video
Seagate SC14 video Seagate Virtual Booth Tour @ SC14
Click to Play Video
Supermicro SC14 video Supermicro Virtual Booth Tour @ SC14
Click to Play Video