Transcription of OpenMP Technical Report 6: Version 5.0 Preview 2
1 OpenMP Technical Report 6: Version Preview 2 This Technical Report augments the OpenMP Application Programming Interface Specification with language features for concurrent loops, task reductions, a runtime interface for first-party (OMPT) and for third-party tools (OMPD), major extensions to the device constructs, memory allocation features, new task dependencies, and several clarifications and corrections. EDITORS Bronis R. de Supinski Michael Klemm November 9, 2017 Expires November 8, 2019 We actively solicit comments. Please provide feedback on this document either to the Editors directly or in the OpenMP Forum at End of Public Comment Period: January 8, 2018 OpenMP Architecture Review Board Ravi S. Rao, OpenMP , c/o Intel Corporation, 1300 MoPac Express Way, Austin, TX 78746, USA This Technical Report describes possible future directions or extensions to the OpenMP Specification. The goal of this Technical Report is to build more widespread existing practice for an expanded OpenMP .
2 It gives advice on extensions or future directions to those vendors who wish to provide them possibly for trial implementation, allows OpenMP to gather early feedback, support timing and scheduling differences between official OpenMP releases, and offers a Preview to users of the future directions of OpenMP with the provisions stated in the next paragraph. This Technical Report is non-normative. Some of the components in this Technical Report may be considered for standardization in a future Version of OpenMP , but they are not currently part of any OpenMP Specification. Some of the components in this Technical Report may never be standardized, others may be standardized in a substantially changed form, or it may be standardized as is in its entirety. OpenMPApplication ProgrammingInterfaceVersion rev 2, November 2017 Copyrightc 1997-2017 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.
3 Notice isgiven that copying is by permission of OpenMP Architecture Review page intentionally left blank in published is Revision 2-TR6 (Second Official Draft) (9 November 2017) and includes the followinginternal tickets applied to the LaTeX sources: 50, 354, 389, 399, 425, 452, 459, 461-463,465-467, 484, 486, 489, 491-504, 508, 510, 511, 514, 518, 520, 521, 523, 524, 530-533, 536, 537,545, 548, 551, 555-562, 564, 568-577, 581-584, 586, 589-592, 594, 597, 601, 603, 606, 608, 610,611-615, 617, 618, 620, 621, 625-631, 633-644, 648, 650 This is a draft; contents will change in official releaseContents1. Scope .. Glossary .. Threading Concepts .. OpenMP Language Terminology .. Loop Terminology .. Synchronization Terminology .. Tasking Terminology .. Data Terminology .. Implementation Terminology .. Tool Terminology .. Execution Model .. Memory Model .. Structure of the OpenMP Memory Model.
4 Device Data Environments .. Memory Management .. The Flush Operation .. Flush Synchronization and Happens Before .. OpenMP Memory Consistency .. Tool Interface .. OMPT .. OMPD .. OpenMP Compliance .. Normative References .. Organization of this Document .. 31i2. Directive Format .. Fixed Source Form Directives .. Free Source Form Directives .. Stand-Alone Directives .. 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 .. Iterators .. Memory Allocators .. Determining the Number of Threads for aparallelRegion.
5 Controlling OpenMP Thread Affinity .. Canonical Loop Form .. Worksharing Constructs .. Loop Construct .. Determining the Schedule of a Worksharing Loop .. SIMD Constructs .. simdDirective .. Loop SIMD Construct .. 105iiOpenMP API Version rev 2, November .. Tasking Constructs .. simdConstruct .. Initial Task .. Task Scheduling .. Memory Management Directives .. Device Constructs .. Device Initialization .. dataConstruct .. enter dataConstruct .. exit dataConstruct .. updateConstruct .. targetDirective .. mapperDirective .. simdConstruct .. Parallel Loop Construct .. 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.
6 TeamsConstruct .. distributeConstruct .. distribute simdConstruct .. teams distributeConstruct .. teams distribute simdConstruct .. Distribute Parallel Loop Construct .. Teams Distribute Parallel Loop Construct .. Distribute Parallel Loop SIMD Construct .. Teams Distribute Parallel Loop SIMD Construct .. Master and Synchronization Constructs and Clauses .. Implicit Barriers .. Hints .. 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 .. 244ivOpenMP API Version rev 2, November Data-Sharing Attribute Clauses .. Reduction Clauses .. Properties Common To All Reduction Clauses .. Reduction Scoping Clauses .. Reduction Participating Clauses .. Data Copying Clauses.
7 Data-mapping Attribute Rules and Clauses .. reductionDirective .. Nesting of Regions .. 2953. Runtime Library Runtime Library Definitions .. Execution Environment Routines .. 343viOpenMP API Version rev 2, November Lock Routines .. Timing Routines .. Device Memory Routines .. Memory Management Routines .. Memory Management Types .. Tool Control Routines .. 3724. Tool OMPT .. Activating an OMPT Tool .. Determining Whether an OMPT Tool Should be Initialized .. Initializing an OMPT Tool .. Monitoring Activity on the Host with OMPT .. Tracing Activity on Target Devices with OMPT .. Finalizing an OMPT Tool .. OMPT Data Types .. Tool Initialization and Finalization .. Callbacks .. Tracing .. Miscellaneous Type Definitions .. OMPT Tool Callback Signatures and Trace Records .. Initialization and Finalization Callback Signature.
8 Event Callback Signatures and Trace Records .. OMPT Runtime Entry Points for Tools .. Entry Points in the OMPT Callback Interface .. Entry Points in the OMPT Device Tracing Interface .. Lookup Entry Point .. OMPD .. Activating an OMPD Tool .. Enabling the Runtime for OMPD .. Finding the OMPD plugin .. OMPD Data Types .. Basic Types .. System Device Identifiers .. Thread Identifiers .. OMPD Handle Types .. Tool Context Types .. Return Code Types .. OpenMP Scheduling Types .. OpenMP Proc Binding Types .. Primitive Types .. Runtime State Types .. OMPD Tool Callback Interface .. Memory Management of OMPD Plugin .. Context Management and Navigation .. Sizes of Primitive Types .. ompd_callback_symbol_addr_fn_t .. 494viiiOpenMP API Version rev 2, November Accessing Memory in the OpenMP Program or Runtime .. Data Format Conversion.
9 Ompd_callback_print_string_fn_t .. The Callback Interface .. OMPD Tool Interface Routines .. Per OMPD Library Initialization and Finalization .. Per OpenMP Process Initialization and Finalization .. Thread and Signal Safety .. Available Processors and Threads .. Thread Handles .. Parallel Region Handles .. Task Handles .. Display Control variables .. Runtime Entry Points for OMPD .. Event notification .. Entry Points for OMPD defined in the OpenMP program .. Enabling Support for OMPD at Runtime .. Tool Foundation .. Data Types .. Thread States .. Frames .. Wait Identifiers .. Global Symbols .. 5615. Environment .. 580A. Stubs for Runtime Library C/C++ Stub Routines .. Fortran Stub Routines .. 594B. Interface Example of File .. Example of an Interface DeclarationincludeFile .. Example of a Fortran Interface Declarationmodule.
10 Example of a Generic Interface for a Library Routine .. 625C. OpenMP Implementation-Defined Behaviors627D. Task Frame Management for the Tool Interface635E. Interaction Diagram of OMPD Components637F. Features Deprecated Features .. Version to Differences .. Version to Differences .. 642xOpenMP API Version rev 2, November Version to Differences .. Version to Differences .. Version to Differences .. 646 Index649 ContentsxiThis page intentionally left blankCHAPTER 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. Compilers from numerous vendors support the OpenMP API.