Transcription of OpenMP Application Programming Interface
1 OpenMPApplication ProgrammingInterfaceVersion November 2015 Copyrightc 1997-2015 OpenMP Architecture Review to copy without fee all or part of this material is granted, provided the OpenMPArchitecture Review Board copyright notice and the title of this document appear. Notice isgiven that copying is by permission of OpenMP Architecture Review page intentionally left blank in published Scope .. Glossary .. Threading Concepts .. OpenMP Language Terminology .. Loop Terminology.
2 Synchronization Terminology .. Tasking Terminology .. Data Terminology .. Implementation Terminology .. Execution Model .. Memory Model .. Structure of the OpenMP Memory Model .. Device Data Environments .. The Flush Operation .. OpenMP Memory Consistency .. OpenMP Compliance .. Normative References .. Organization of this Document .. 232 Directive Format .. Fixed Source Form Directives .. Free Source Form Directives .. Stand-Alone Directives.
3 Conditional Compilation .. Fixed Source Form Conditional Compilation Sentinels .. Free Source Form Conditional Compilation Sentinel .. Internal Control Variables .. ICV Descriptions .. ICV Initialization .. Modifying and Retrieving ICV Values .. How ICVs are Scoped .. How the Per-Data Environment ICVs Work .. ICV Override Relationships .. Array Sections .. Determining the Number of Threads for aparallelRegion .. Controlling OpenMP Thread Affinity.
4 Canonical Loop Form .. Worksharing Constructs .. Loop Construct .. Determining the Schedule of a Worksharing Loop .. SIMD Constructs .. simdConstruct .. Loop SIMD Construct .. Tasking Constructs .. simdConstruct .. Task Scheduling .. Device Constructs .. dataConstruct .. enter dataConstruct .. exit dataConstruct .. 100iiOpenMP API Version November .. updateConstruct .. targetDirective .. simdConstruct .. Distribute Parallel Loop Construct.
5 Distribute Parallel Loop SIMD Construct .. Combined Constructs .. Parallel Loop Construct .. sectionsConstruct .. workshareConstruct .. Parallel Loop SIMD Construct .. parallelConstruct .. Target Parallel Loop Construct .. Target Parallel Loop SIMD Construct .. simdConstruct .. teamsConstruct .. distributeConstruct .. distribute simdConstruct .. teams distributeConstruct .. teams distribute simdConstruct .. Teams Distribute Parallel Loop Construct .. Target Teams Distribute Parallel Loop Construct.
6 Teams Distribute Parallel Loop SIMD Construct .. Target Teams Distribute Parallel Loop SIMD Construct .. Master and Synchronization Constructs and Clauses .. Cancellation Constructs .. pointConstruct .. Data Environment .. Data-sharing Attribute Rules .. Data-sharing Attribute Rules for Variables Referenced in a Data-sharing Attribute Rules for Variables Referenced in a Regionbut not in a Construct .. Data-Sharing Attribute Clauses .. Data Copying Clauses .. Data-mapping Attribute Rules and Clauses.
7 ReductionDirective .. Nesting of Regions .. 2273 Runtime Library Runtime Library Definitions .. Execution Environment Routines .. 231ivOpenMP API Version November .. Lock Routines .. Timing Routines .. Device Memory Routines .. 2894 Environment .. 300viOpenMP API Version November .. 303A Stubs for Runtime Library C/C++ Stub Routines .. Fortran Stub Routines .. 316B Interface Example of File .. Example of an Interface DeclarationincludeFile.
8 Example of a Fortran Interface Declarationmodule.. Example of a Generic Interface for a Library Routine .. 342C OpenMP Implementation-Defined Behaviors343D Features Version to Differences .. Version to Differences .. Version to Differences .. Version to Differences .. 352 Index355 ContentsviiCHAPTER 11 Introduction2 The collection of compiler directives, library routines, and environment variables described in this3document collectively define the specification of the OpenMP Application Program Interface4( OpenMP API) for parallelism in C, C++ and Fortran specification provides a model for parallel Programming that is portable across architectures6from different vendors.
9 Compilers from numerous vendors support the OpenMP API. More7information about the OpenMP API can be found at the following web site8 directives, library routines, and environment variables defined in this document allow users to10create and to manage parallel programs while permitting portability. The directives extend the C,11C++ and Fortran base languages with single program multiple data (SPMD) constructs, tasking12constructs, device constructs, worksharing constructs, and synchronization constructs, and they13provide support for sharing, mapping and privatizing data.
10 The functionality to control the runtime14environment is provided by library routines and environment variables. Compilers that support the15 OpenMP API often include a command line option to the compiler that activates and allows16interpretation of all OpenMP Scope18 The OpenMP API covers only user-directed parallelization, wherein the programmer explicitly19specifies the actions to be taken by the compiler and runtime system in order to execute the program20in parallel. OpenMP -compliant implementations are not required to check for data dependencies,21data conflicts, race conditions, or deadlocks, any of which may occur in conforming programs.
