Chapter 4

Shared-memory programming



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 the O’Reilly learning platform.

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