5.6.2 Ending Parallel Regions............................ 595 5.6.3 Beginning Task Regions............................ 595 5.6.4 Ending Task Regions 596 5.6.5 Beginning OpenMP Threads 597 5.6.6 Ending OpenMP Threads 597 5.6.7 Initializing OpenMP Devices.···················· 598 5.6.8 Finalizing OpenMP Devices,..·..·......···,.....·. 599 6 Environment Variables 601 6.1 OMP SCHEDULE 601 6.2 OMP_NUM_THREADS 602 6.3 OMP_DYNAMIC..················ 603 6.4 OMP_PROC_BIND 。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。t。 604 6.5 OMP_PLACES。············· 605 6.6 OMP_STACKSIZE 607 6.7 OMP_WAIT_POLICY 608 6.8 OMP_MAX_ACTIVE_LEVELS.················ 608 69 OMP_NESTED,,..·.·.············,·,····· 609 6.10 OMP_THREAD_LIMIT 610 6.11 OMP_CANCELLATION 610 6.12 OMP_DISPLAY ENV 611 6.l3OP_DISPLAY_AFFINITY.......···...·.·.·.·... 612 6.14 OMP_AFFINITY_FORMAT 613 6.15 OMP_DEFAULT DEVICE 615 6.16 OMP_MAX_TASK_PRIORITY 。。。。。。·。。。4.4。。。0。。。。。4。。4 615 6.17 OMP_TARGET_OFFLOAD 615 6.18 OMP_TOOL 616 6.19 OMP_TOOLLIBRARIES 617 6.20 OMP_DEBUG....... 617 6.21 OMP_ALLOCATOR 618 A OpenMP Implementation-Defined Behaviors 619 B Features History 627 B.1 Deprecated Features............................. 627 Contents XV
5.6.2 Ending Parallel Regions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595 5.6.3 Beginning Task Regions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595 5.6.4 Ending Task Regions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596 5.6.5 Beginning OpenMP Threads . . . . . . . . . . . . . . . . . . . . . . . . . . 597 5.6.6 Ending OpenMP Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . 597 5.6.7 Initializing OpenMP Devices . . . . . . . . . . . . . . . . . . . . . . . . . 598 5.6.8 Finalizing OpenMP Devices . . . . . . . . . . . . . . . . . . . . . . . . . . 599 6 Environment Variables 601 6.1 OMP_SCHEDULE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 601 6.2 OMP_NUM_THREADS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 602 6.3 OMP_DYNAMIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603 6.4 OMP_PROC_BIND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604 6.5 OMP_PLACES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605 6.6 OMP_STACKSIZE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607 6.7 OMP_WAIT_POLICY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608 6.8 OMP_MAX_ACTIVE_LEVELS . . . . . . . . . . . . . . . . . . . . . . . . . . . 608 6.9 OMP_NESTED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 609 6.10 OMP_THREAD_LIMIT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 610 6.11 OMP_CANCELLATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 610 6.12 OMP_DISPLAY_ENV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611 6.13 OMP_DISPLAY_AFFINITY . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612 6.14 OMP_AFFINITY_FORMAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 613 6.15 OMP_DEFAULT_DEVICE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 615 6.16 OMP_MAX_TASK_PRIORITY . . . . . . . . . . . . . . . . . . . . . . . . . . . 615 6.17 OMP_TARGET_OFFLOAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 615 6.18 OMP_TOOL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 616 6.19 OMP_TOOL_LIBRARIES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 617 6.20 OMP_DEBUG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 617 6.21 OMP_ALLOCATOR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 618 A OpenMP Implementation-Defined Behaviors 619 B Features History 627 B.1 Deprecated Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 627 Contents xv
B.2 Version4.5to5.0 Differences........................... 627 B.3 Version 4.0 to 4.5 Differences 631 B.4 Version 3.1 to 4.0 Differences 633 B.5 Version3.0to3.Differences····················· 634 B.6 Version25to3.0 Differences.··························· 635 Index 639 xvi OpenMP API-Version 5.0 November 2018
B.2 Version 4.5 to 5.0 Differences . . . . . . . . . . . . . . . . . . . . . . . . . . . . 627 B.3 Version 4.0 to 4.5 Differences . . . . . . . . . . . . . . . . . . . . . . . . . . . . 631 B.4 Version 3.1 to 4.0 Differences . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633 B.5 Version 3.0 to 3.1 Differences . . . . . . . . . . . . . . . . . . . . . . . . . . . . 634 B.6 Version 2.5 to 3.0 Differences . . . . . . . . . . . . . . . . . . . . . . . . . . . . 635 Index 639 xvi OpenMP API – Version 5.0 November 2018
List of Figures 2.1 Determining the schedule for a Worksharing-Loop 4.1 First-Party Tool Activation Flow Chart........................422 xvii
List of Figures 2.1 Determining the schedule for a Worksharing-Loop . . . . . . . . . . . . . . . . 109 4.1 First-Party Tool Activation Flow Chart . . . . . . . . . . . . . . . . . . . . . . . . 422 xvii
List of Tables 1.1 Map-Type Decay of Map Type Combinations.................... 6 2.1 ICV Initial Values. 。。。。。。。,。。,。,。,。,。。,。。。 2.2 Ways to Modify and to Retrieve ICV Values..................... 6 2.3 Scopes of ICVs..... 70 2.4 ICV Override Relationships 72 2.5 schedule Clause kind Vale 104 schedule ·4···44444·4。。4 ompt_callback_task_create callback flags evaluation........... 28 Predefined Memory Spaces.............................. 152 2.9 Allocator Traits. 153 2.10 Predefined Allocators 155 2.11 Implic citly Declared C/C++ 。。4”本·44”4.4”4。 294 2.12 Implicitly Declared Fortran reduction-identifiers................... 295 3.1 Standard Tool Control Commands 。。。。。4.4·。。··。44.4。。。 417 Point Names and Their Type Signatures. Valid Return Codes of ompt_set_callback for Each Callback......... 428 4.3 OMPT Tracing Interface Runtime Entry Point Names and Their Type Signatures.. 4 5.Mapping of Scope Type and OMPD Handles···················· 542 5.2OMPD-specific ICVs............................... 589 6.1 Defined Abstract Names for OMP_PLACES.. 605 6.2 Available Field Types for Formatting OpenMP Thread Affinity Information 613 xviii
List of Tables 1.1 Map-Type Decay of Map Type Combinations . . . . . . . . . . . . . . . . . . . . 16 2.1 ICV Initial Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 2.2 Ways to Modify and to Retrieve ICV Values . . . . . . . . . . . . . . . . . . . . . 68 2.3 Scopes of ICVs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 2.4 ICV Override Relationships . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 2.5 schedule Clause kind Values . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 2.6 schedule Clause modifier Values . . . . . . . . . . . . . . . . . . . . . . . . . 106 2.7 ompt_callback_task_create callback flags evaluation . . . . . . . . . . . 139 2.8 Predefined Memory Spaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 2.9 Allocator Traits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 2.10 Predefined Allocators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 2.11 Implicitly Declared C/C++ reduction-identifiers . . . . . . . . . . . . . . . . . . . 294 2.12 Implicitly Declared Fortran reduction-identifiers . . . . . . . . . . . . . . . . . . . 295 3.1 Standard Tool Control Commands . . . . . . . . . . . . . . . . . . . . . . . . . . 417 4.1 OMPT Callback Interface Runtime Entry Point Names and Their Type Signatures . 426 4.2 Valid Return Codes of ompt_set_callback for Each Callback . . . . . . . . . 428 4.3 OMPT Tracing Interface Runtime Entry Point Names and Their Type Signatures . . 430 5.1 Mapping of Scope Type and OMPD Handles . . . . . . . . . . . . . . . . . . . . 542 5.2 OMPD-specific ICVs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589 6.1 Defined Abstract Names for OMP_PLACES . . . . . . . . . . . . . . . . . . . . . 605 6.2 Available Field Types for Formatting OpenMP Thread Affinity Information . . . . 613 xviii
CHAPTER 1 Introduction 3 The collection of compiler directives.library routines,and environment variables described in this 4 document collectively define the specification of the OpenMP Application Program Interface (OpenMP API)for parallelism in C,C++and Fortran programs. 6 This specification provides a model for parallel programming that is portable across architectures from different vendors.Compilers from numerous vendors support the OpenMP API.More information about the OpenMP API can be found at the following web site 9 http://www.openmp.org 10 The directives,library routines,environment variables,and tool support defined in this document allow users to create,to manage,to debug and to analyze parallel programs while permitting 13 portability.Thedircctives extend the C.andn e langes with single progra multiple data(SPMD)constructs,tasking constructs,device cons tructs worksharing con 1415 they provide sharing.mapping and privatizing data The functionality to control the runtime environment is provided by library routines and 6 environment variables.Compilers that support the OpenMP API often include a command line option to the compiler that activates and allows interpretation of all OpenMP directives. 181.1 Scope 1 The OpenMP API covers only user-directed parallelization,wherein the programmer explicitly 2 species the actions to be taken by the compiler and runtime system in order to execute the program 223 inconforming programs.In addition,compliant implementations are not required to check for code sequences that cause a program to be classified as non-conforming.Application developers are responsible for correctly
CHAPTER 1 1 Introduction 2 3 The collection of compiler directives, library routines, and environment variables described in this 4 document collectively define the specification of the OpenMP Application Program Interface 5 (OpenMP API) for parallelism in C, C++ and Fortran programs. 6 This specification provides a model for parallel programming that is portable across architectures 7 from different vendors. Compilers from numerous vendors support the OpenMP API. More 8 information about the OpenMP API can be found at the following web site 9 http://www.openmp.org 10 The directives, library routines, environment variables, and tool support defined in this document 11 allow users to create, to manage, to debug and to analyze parallel programs while permitting 12 portability. The directives extend the C, C++ and Fortran base languages with single program 13 multiple data (SPMD) constructs, tasking constructs, device constructs, worksharing constructs,and 14 synchronization constructs, and they provide support for sharing, mapping and privatizing data. 15 The functionality to control the runtime environment is provided by library routines and 16 environment variables. Compilers that support the OpenMP API often include a command line 17 option to the compiler that activates and allows interpretation of all OpenMP directives. 18 1.1 Scope 19 The OpenMP API covers only user-directed parallelization, wherein the programmer explicitly 20 specifies the actions to be taken by the compiler and runtime system in order to execute the program 21 in parallel. OpenMP-compliant implementations are not required to check for data dependencies, 22 data conflicts, race conditions, or deadlocks, any of which may occur in conforming programs. In 23 addition, compliant implementations are not required to check for code sequences that cause a 24 program to be classified as non-conforming. Application developers are responsible for correctly 1