Using Automatic Parallelization and OpenMP
Previous chapters have covered low-level approaches to creating processes or threads and sharing data between them. Fortunately, many approaches enable the developer to focus on higher levels of application design and leave the mechanics of managing threads and sharing data to runtime libraries and the compiler. In an ideal case, the compiler manages everything, from identifying parts of the code to run in parallel through provid-ing the mechanisms to support that parallelism. However, without some help from the developer, current compiler technology will rarely be able to exploit all the parallelism in an application. The most commonly used and commonly available language extension for parallelism is the OpenMP API.
The OpenMP specification defines an API that enables a developer to add directives to their serial code that will cause the compiler to produce a parallel version of the application. This chapter describes both automatic parallelism provided by many compil-ers and how the OpenMP API can produce parallel applications from serial codes.