OpenMP Shared-Memory Parallel Programming Model. STMicroelectronics PGI
Reklāma
Reklāma
Chapter 5. Using OpenMP
The PGF77 and PGF95 Fortran compilers support the OpenMP Fortran Application Program Interface. The
PGCC ANSI C and C++ compilers support the OpenMP C/C++ Application Program Interface.
OpenMP is a specification for a set of compiler directives, an applications programming interface (API), and a set of environment variables that can be used to specify shared memory parallelism in FORTRAN and C/C++ programs. OpenMP may be used to obtain most of the parallel performance you can expect from your code, or it may serve as a stepping stone to parallelizing an entire application with MPI.
This chapter provides information on OpenMP as it is supported by PGI compilers.
Use the
-mp
compiler switch to enable processing of the OMP pragmas listed in this chapter. C++ applications will also compile with thread-safe versions of STL header files. Users must link with the
-mp
switch to link the
OpenMP runtime library, and for C++, the thread-safe Standard Template Library.
Note
The C++ Standard Template library has been made thread-safe to extent allowed in the STLport code: simultaneous accesses to distinct containers are safe, simultaneous reads to shared containers are also safe. However, simultaneous writes to shared containers must be protected by
#pragma omp critical
sections.
This chapter describes how to use the following options related to using OpenMP:
–mp
OpenMP Overview
Let’s look at the OpenMP shared-memory parallel programming model and some common OpenMP terminology.
OpenMP Shared-Memory Parallel Programming Model
The OpenMP shared-memory programming model is a collection of compiler directives or pragmas, library routines, and environment variables that can be used to specify shared-memory parallelism in Fortran and C/C
++ programs.
55
Lejupielādēt
Reklāma