Chapter 4

Shared-memory programming

OpenMP

Abstract

The decomposition of a sequential program into components that can execute in parallel is a tedious enterprise. OpenMP has been designed to alleviate much of the effort involved, by accommodating the incremental conversion of sequential programs into parallel ones, with the assistance of the compiler.

OpenMP relies on compiler directives for decorating portions of the code that the compiler will attempt to parallelize. In this chapter we examine these OpenMP directives and the associated clauses that control their behavior.

OpenMP is particularly useful for partitioning and running in parallel the iterations of a loop. Loop parallelism as facilitated by OpenMP, can be successful only if ...

Get Multicore and GPU Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.