HOME
|
OPENMP API Specification: Version 5.1 November 2020
[
next
] [
prev
] [
prev-tail
] [
tail
] [
up
]
Contents
1
Overview of the OpenMP API
1.1
Scope
1.2
Glossary
1.2.1
Threading Concepts
1.2.2
OpenMP Language Terminology
1.2.3
Loop Terminology
1.2.4
Synchronization Terminology
1.2.5
Tasking Terminology
1.2.6
Data Terminology
1.2.7
Implementation Terminology
1.2.8
Tool Terminology
1.3
Execution Model
1.4
Memory Model
1.4.1
Structure of the OpenMP Memory Model
1.4.2
Device Data Environments
1.4.3
Memory Management
1.4.4
The Flush Operation
1.4.5
Flush Synchronization and
Happens Before
1.4.6
OpenMP Memory Consistency
1.5
Tool Interfaces
1.5.1
OMPT
1.5.2
OMPD
1.6
OpenMP Compliance
1.7
Normative References
1.8
Organization of this Document
2
Directives
2.1
Directive Format
2.1.1
Fixed Source Form Directives
2.1.2
Free Source Form Directives
2.1.3
Stand-Alone Directives
2.1.4
Array Shaping
2.1.5
Array Sections
2.1.6
Iterators
2.2
Conditional Compilation
2.2.1
Fixed Source Form Conditional Compilation Sentinels
2.2.2
Free Source Form Conditional Compilation Sentinel
2.3
Variant Directives
2.3.1
OpenMP Context
2.3.2
Context Selectors
2.3.3
Matching and Scoring Context Selectors
2.3.4
Metadirectives
2.3.5
Declare Variant Directive
2.3.6
dispatch
Construct
2.4
Internal Control Variables
2.4.1
ICV Descriptions
2.4.2
ICV Initialization
2.4.3
Modifying and Retrieving ICV Values
2.4.4
How ICVs are Scoped
2.4.4.1
How the Per-Data Environment ICVs Work
2.4.5
ICV Override Relationships
2.5
Informational and Utility Directives
2.5.1
requires
Directive
2.5.2
Assume Directive
2.5.3
nothing
Directive
2.5.4
error
Directive
2.6
parallel
Construct
2.6.1
Determining the Number of Threads for a
parallel
Region
2.6.2
Controlling OpenMP Thread Affinity
2.7
teams
Construct
2.8
masked
Construct
2.9
scope
Construct
2.10
Worksharing Constructs
2.10.1
sections
Construct
2.10.2
single
Construct
2.10.3
workshare
Construct
2.11
Loop-Related Directives
2.11.1
Canonical Loop Nest Form
2.11.2
Consistent Loop Schedules
2.11.3
order
Clause
2.11.4
Worksharing-Loop Construct
2.11.4.1
Determining the Schedule of a Worksharing-Loop
2.11.5
SIMD Directives
2.11.5.1
simd
Construct
2.11.5.2
Worksharing-Loop SIMD Construct
2.11.5.3
declare
simd
Directive
2.11.6
distribute
Loop Constructs
2.11.6.1
distribute
Construct
2.11.6.2
distribute
simd
Construct
2.11.6.3
Distribute Parallel Worksharing-Loop Construct
2.11.6.4
Distribute Parallel Worksharing-Loop SIMD Construct
2.11.7
loop
Construct
2.11.8
scan
Directive
2.11.9
Loop Transformation Constructs
2.11.9.1
tile
Construct
2.11.9.2
unroll
Construct
2.12
Tasking Constructs
2.12.1
task
Construct
2.12.2
taskloop
Construct
2.12.3
taskloop
simd
Construct
2.12.4
taskyield
Construct
2.12.5
Initial Task
2.12.6
Task Scheduling
2.13
Memory Management Directives
2.13.1
Memory Spaces
2.13.2
Memory Allocators
2.13.3
allocate
Directive
2.13.4
allocate
Clause
2.14
Device Directives
2.14.1
Device Initialization
2.14.2
target
data
Construct
2.14.3
target
enter
data
Construct
2.14.4
target
exit
data
Construct
2.14.5
target
Construct
2.14.6
target
update
Construct
2.14.7
Declare Target Directive
2.15
Interoperability
2.15.1
interop
Construct
2.15.2
Interoperability Requirement Set
2.16
Combined Constructs
2.16.1
Parallel Worksharing-Loop Construct
2.16.2
parallel
loop
Construct
2.16.3
parallel
sections
Construct
2.16.4
parallel
workshare
Construct
2.16.5
Parallel Worksharing-Loop SIMD Construct
2.16.6
parallel
masked
Construct
2.16.7
masked
taskloop
Construct
2.16.8
masked
taskloop
simd
Construct
2.16.9
parallel
masked
taskloop
Construct
2.16.10
parallel
masked
taskloop
simd
Construct
2.16.11
teams
distribute
Construct
2.16.12
teams
distribute
simd
Construct
2.16.13
Teams Distribute Parallel Worksharing-Loop Construct
2.16.14
Teams Distribute Parallel Worksharing-Loop SIMD Construct
2.16.15
teams
loop
Construct
2.16.16
target
parallel
Construct
2.16.17
Target Parallel Worksharing-Loop Construct
2.16.18
Target Parallel Worksharing-Loop SIMD Construct
2.16.19
target
parallel
loop
Construct
2.16.20
target
simd
Construct
2.16.21
target
teams
Construct
2.16.22
target
teams
distribute
Construct
2.16.23
target
teams
distribute
simd
Construct
2.16.24
target
teams
loop
Construct
2.16.25
Target Teams Distribute Parallel Worksharing-Loop Construct
2.16.26
Target Teams Distribute Parallel Worksharing-Loop SIMD Construct
2.17
Clauses on Combined and Composite Constructs
2.18
if
Clause
2.19
Synchronization Constructs and Clauses
2.19.1
critical
Construct
2.19.2
barrier
Construct
2.19.3
Implicit Barriers
2.19.4
Implementation-Specific Barriers
2.19.5
taskwait
Construct
2.19.6
taskgroup
Construct
2.19.7
atomic
Construct
2.19.8
flush
Construct
2.19.8.1
Implicit Flushes
2.19.9
ordered
Construct
2.19.10
Depend Objects
2.19.10.1
depobj
Construct
2.19.11
depend
Clause
2.19.12
Synchronization Hints
2.20
Cancellation Constructs
2.20.1
cancel
Construct
2.20.2
cancellation
point
Construct
2.21
Data Environment
2.21.1
Data-Sharing Attribute Rules
2.21.1.1
Variables Referenced in a Construct
2.21.1.2
Variables Referenced in a Region but not in a Construct
2.21.2
threadprivate
Directive
2.21.3
List Item Privatization
2.21.4
Data-Sharing Attribute Clauses
2.21.4.1
default
Clause
2.21.4.2
shared
Clause
2.21.4.3
private
Clause
2.21.4.4
firstprivate
Clause
2.21.4.5
lastprivate
Clause
2.21.4.6
linear
Clause
2.21.5
Reduction Clauses and Directives
2.21.5.1
Properties Common to All Reduction Clauses
2.21.5.2
Reduction Scoping Clauses
2.21.5.3
Reduction Participating Clauses
2.21.5.4
reduction
Clause
2.21.5.5
task_reduction
Clause
2.21.5.6
in_reduction
Clause
2.21.5.7
declare
reduction
Directive
2.21.6
Data Copying Clauses
2.21.6.1
copyin
Clause
2.21.6.2
copyprivate
Clause
2.21.7
Data-Mapping Attribute Rules, Clauses, and Directives
2.21.7.1
map
Clause
2.21.7.2
Pointer Initialization for Device Data Environments
2.21.7.3
defaultmap
Clause
2.21.7.4
declare
mapper
Directive
2.22
Nesting of Regions
3
Runtime Library Routines
3.1
Runtime Library Definitions
3.2
Thread Team Routines
3.2.1
omp_set_num_threads
3.2.2
omp_get_num_threads
3.2.3
omp_get_max_threads
3.2.4
omp_get_thread_num
3.2.5
omp_in_parallel
3.2.6
omp_set_dynamic
3.2.7
omp_get_dynamic
3.2.8
omp_get_cancellation
3.2.9
omp_set_nested
(Deprecated)
3.2.10
omp_get_nested
(Deprecated)
3.2.11
omp_set_schedule
3.2.12
omp_get_schedule
3.2.13
omp_get_thread_limit
3.2.14
omp_get_supported_active_levels
3.2.15
omp_set_max_active_levels
3.2.16
omp_get_max_active_levels
3.2.17
omp_get_level
3.2.18
omp_get_ancestor_thread_num
3.2.19
omp_get_team_size
3.2.20
omp_get_active_level
3.3
Thread Affinity Routines
3.3.1
omp_get_proc_bind
3.3.2
omp_get_num_places
3.3.3
omp_get_place_num_procs
3.3.4
omp_get_place_proc_ids
3.3.5
omp_get_place_num
3.3.6
omp_get_partition_num_places
3.3.7
omp_get_partition_place_nums
3.3.8
omp_set_affinity_format
3.3.9
omp_get_affinity_format
3.3.10
omp_display_affinity
3.3.11
omp_capture_affinity
3.4
Teams Region Routines
3.4.1
omp_get_num_teams
3.4.2
omp_get_team_num
3.4.3
omp_set_num_teams
3.4.4
omp_get_max_teams
3.4.5
omp_set_teams_thread_limit
3.4.6
omp_get_teams_thread_limit
3.5
Tasking Routines
3.5.1
omp_get_max_task_priority
3.5.2
omp_in_final
3.6
Resource Relinquishing Routines
3.6.1
omp_pause_resource
3.6.2
omp_pause_resource_all
3.7
Device Information Routines
3.7.1
omp_get_num_procs
3.7.2
omp_set_default_device
3.7.3
omp_get_default_device
3.7.4
omp_get_num_devices
3.7.5
omp_get_device_num
3.7.6
omp_is_initial_device
3.7.7
omp_get_initial_device
3.8
Device Memory Routines
3.8.1
omp_target_alloc
3.8.2
omp_target_free
3.8.3
omp_target_is_present
3.8.4
omp_target_is_accessible
3.8.5
omp_target_memcpy
3.8.6
omp_target_memcpy_rect
3.8.7
omp_target_memcpy_async
3.8.8
omp_target_memcpy_rect_async
3.8.9
omp_target_associate_ptr
3.8.10
omp_target_disassociate_ptr
3.8.11
omp_get_mapped_ptr
3.9
Lock Routines
3.9.1
omp_init_lock
and
omp_init_nest_lock
3.9.2
omp_init_lock_with_hint
and
omp_init_nest_lock_with_hint
3.9.3
omp_destroy_lock
and
omp_destroy_nest_lock
3.9.4
omp_set_lock
and
omp_set_nest_lock
3.9.5
omp_unset_lock
and
omp_unset_nest_lock
3.9.6
omp_test_lock
and
omp_test_nest_lock
3.10
Timing Routines
3.10.1
omp_get_wtime
3.10.2
omp_get_wtick
3.11
Event Routine
3.11.1
omp_fulfill_event
3.12
Interoperability Routines
3.12.1
omp_get_num_interop_properties
3.12.2
omp_get_interop_int
3.12.3
omp_get_interop_ptr
3.12.4
omp_get_interop_str
3.12.5
omp_get_interop_name
3.12.6
omp_get_interop_type_desc
3.12.7
omp_get_interop_rc_desc
3.13
Memory Management Routines
3.13.1
Memory Management Types
3.13.2
omp_init_allocator
3.13.3
omp_destroy_allocator
3.13.4
omp_set_default_allocator
3.13.5
omp_get_default_allocator
3.13.6
omp_alloc
and
omp_aligned_alloc
3.13.7
omp_free
3.13.8
omp_calloc
and
omp_aligned_calloc
3.13.9
omp_realloc
3.14
Tool Control Routine
3.15
Environment Display Routine
4
OMPT Interface
4.1
OMPT Interfaces Definitions
4.2
Activating a First-Party Tool
4.2.1
ompt_start_tool
4.2.2
Determining Whether a First-Party Tool Should be Initialized
4.2.3
Initializing a First-Party Tool
4.2.3.1
Binding Entry Points in the OMPT Callback Interface
4.2.4
Monitoring Activity on the Host with OMPT
4.2.5
Tracing Activity on Target Devices with OMPT
4.3
Finalizing a First-Party Tool
4.4
OMPT Data Types
4.4.1
Tool Initialization and Finalization
4.4.2
Callbacks
4.4.3
Tracing
4.4.3.1
Record Type
4.4.3.2
Native Record Kind
4.4.3.3
Native Record Abstract Type
4.4.3.4
Record Type
4.4.4
Miscellaneous Type Definitions
4.4.4.1
ompt_callback_t
4.4.4.2
ompt_set_result_t
4.4.4.3
ompt_id_t
4.4.4.4
ompt_data_t
4.4.4.5
ompt_device_t
4.4.4.6
ompt_device_time_t
4.4.4.7
ompt_buffer_t
4.4.4.8
ompt_buffer_cursor_t
4.4.4.9
ompt_dependence_t
4.4.4.10
ompt_thread_t
4.4.4.11
ompt_scope_endpoint_t
4.4.4.12
ompt_dispatch_t
4.4.4.13
ompt_sync_region_t
4.4.4.14
ompt_target_data_op_t
4.4.4.15
ompt_work_t
4.4.4.16
ompt_mutex_t
4.4.4.17
ompt_native_mon_flag_t
4.4.4.18
ompt_task_flag_t
4.4.4.19
ompt_task_status_t
4.4.4.20
ompt_target_t
4.4.4.21
ompt_parallel_flag_t
4.4.4.22
ompt_target_map_flag_t
4.4.4.23
ompt_dependence_type_t
4.4.4.24
ompt_severity_t
4.4.4.25
ompt_cancel_flag_t
4.4.4.26
ompt_hwid_t
4.4.4.27
ompt_state_t
4.4.4.28
ompt_frame_t
4.4.4.29
ompt_frame_flag_t
4.4.4.30
ompt_wait_id_t
4.5
OMPT Tool Callback Signatures and Trace Records
4.5.1
Initialization and Finalization Callback Signature
4.5.1.1
ompt_initialize_t
4.5.1.2
ompt_finalize_t
4.5.2
Event Callback Signatures and Trace Records
4.5.2.1
ompt_callback_thread_begin_t
4.5.2.2
ompt_callback_thread_end_t
4.5.2.3
ompt_callback_parallel_begin_t
4.5.2.4
ompt_callback_parallel_end_t
4.5.2.5
ompt_callback_work_t
4.5.2.6
ompt_callback_dispatch_t
4.5.2.7
ompt_callback_task_create_t
4.5.2.8
ompt_callback_dependences_t
4.5.2.9
ompt_callback_task_dependence_t
4.5.2.10
ompt_callback_task_schedule_t
4.5.2.11
ompt_callback_implicit_task_t
4.5.2.12
ompt_callback_masked_t
4.5.2.13
ompt_callback_sync_region_t
4.5.2.14
ompt_callback_mutex_acquire_t
4.5.2.15
ompt_callback_mutex_t
4.5.2.16
ompt_callback_nest_lock_t
4.5.2.17
ompt_callback_flush_t
4.5.2.18
ompt_callback_cancel_t
4.5.2.19
ompt_callback_device_initialize_t
4.5.2.20
ompt_callback_device_finalize_t
4.5.2.21
ompt_callback_device_load_t
4.5.2.22
ompt_callback_device_unload_t
4.5.2.23
ompt_callback_buffer_request_t
4.5.2.24
ompt_callback_buffer_complete_t
4.5.2.25
ompt_callback_target_data_op_emi_t
and
ompt_callback_target_data_op_t
4.5.2.26
ompt_callback_target_emi_t
and
ompt_callback_target_t
4.5.2.27
ompt_callback_target_map_emi_t
and
ompt_callback_target_map_t
4.5.2.28
ompt_callback_target_submit_emi_t
and
ompt_callback_target_submit_t
4.5.2.29
ompt_callback_control_tool_t
4.5.2.30
ompt_callback_error_t
4.6
OMPT Runtime Entry Points for Tools
4.6.1
Entry Points in the OMPT Callback Interface
4.6.1.1
ompt_enumerate_states_t
4.6.1.2
ompt_enumerate_mutex_impls_t
4.6.1.3
ompt_set_callback_t
4.6.1.4
ompt_get_callback_t
4.6.1.5
ompt_get_thread_data_t
4.6.1.6
ompt_get_num_procs_t
4.6.1.7
ompt_get_num_places_t
4.6.1.8
ompt_get_place_proc_ids_t
4.6.1.9
ompt_get_place_num_t
4.6.1.10
ompt_get_partition_place_nums_t
4.6.1.11
ompt_get_proc_id_t
4.6.1.12
ompt_get_state_t
4.6.1.13
ompt_get_parallel_info_t
4.6.1.14
ompt_get_task_info_t
4.6.1.15
ompt_get_task_memory_t
4.6.1.16
ompt_get_target_info_t
4.6.1.17
ompt_get_num_devices_t
4.6.1.18
ompt_get_unique_id_t
4.6.1.19
ompt_finalize_tool_t
4.6.2
Entry Points in the OMPT Device Tracing Interface
4.6.2.1
ompt_get_device_num_procs_t
4.6.2.2
ompt_get_device_time_t
4.6.2.3
ompt_translate_time_t
4.6.2.4
ompt_set_trace_ompt_t
4.6.2.5
ompt_set_trace_native_t
4.6.2.6
ompt_start_trace_t
4.6.2.7
ompt_pause_trace_t
4.6.2.8
ompt_flush_trace_t
4.6.2.9
ompt_stop_trace_t
4.6.2.10
ompt_advance_buffer_cursor_t
4.6.2.11
ompt_get_record_type_t
4.6.2.12
ompt_get_record_ompt_t
4.6.2.13
ompt_get_record_native_t
4.6.2.14
ompt_get_record_abstract_t
4.6.3
Lookup Entry Points:
ompt_function_lookup_t
5
OMPD Interface
5.1
OMPD Interfaces Definitions
5.2
Activating a Third-Party Tool
5.2.1
Enabling Runtime Support for OMPD
5.2.2
ompd_dll_locations
5.2.3
ompd_dll_locations_valid
5.3
OMPD Data Types
5.3.1
Size Type
5.3.2
Wait ID Type
5.3.3
Basic Value Types
5.3.4
Address Type
5.3.5
Frame Information Type
5.3.6
System Device Identifiers
5.3.7
Native Thread Identifiers
5.3.8
OMPD Handle Types
5.3.9
OMPD Scope Types
5.3.10
ICV ID Type
5.3.11
Tool Context Types
5.3.12
Return Code Types
5.3.13
Primitive Type Sizes
5.4
OMPD Third-Party Tool Callback Interface
5.4.1
Memory Management of OMPD Library
5.4.1.1
ompd_callback_memory_alloc_fn_t
5.4.1.2
ompd_callback_memory_free_fn_t
5.4.2
Context Management and Navigation
5.4.2.1
ompd_callback_get_thread_context_for
_thread
_id
_fn_t
5.4.2.2
ompd_callback_sizeof_fn_t
5.4.3
Accessing Memory in the OpenMP Program or Runtime
5.4.3.1
ompd_callback_symbol_addr_fn_t
5.4.3.2
ompd_callback_memory_read_fn_t
5.4.3.3
ompd_callback_memory_write_fn_t
5.4.4
Data Format Conversion:
ompd_callback_device_host_fn_t
5.4.5
ompd_callback_print_string_fn_t
5.4.6
The Callback Interface
5.5
OMPD Tool Interface Routines
5.5.1
Per OMPD Library Initialization and Finalization
5.5.1.1
ompd_initialize
5.5.1.2
ompd_get_api_version
5.5.1.3
ompd_get_version_string
5.5.1.4
ompd_finalize
5.5.2
Per OpenMP Process Initialization and Finalization
5.5.2.1
ompd_process_initialize
5.5.2.2
ompd_device_initialize
5.5.2.3
ompd_rel_address_space_handle
5.5.3
Thread and Signal Safety
5.5.4
Address Space Information
5.5.4.1
ompd_get_omp_version
5.5.4.2
ompd_get_omp_version_string
5.5.5
Thread Handles
5.5.5.1
ompd_get_thread_in_parallel
5.5.5.2
ompd_get_thread_handle
5.5.5.3
ompd_rel_thread_handle
5.5.5.4
ompd_thread_handle_compare
5.5.5.5
ompd_get_thread_id
5.5.6
Parallel Region Handles
5.5.6.1
ompd_get_curr_parallel_handle
5.5.6.2
ompd_get_enclosing_parallel_handle
5.5.6.3
ompd_get_task_parallel_handle
5.5.6.4
ompd_rel_parallel_handle
5.5.6.5
ompd_parallel_handle_compare
5.5.7
Task Handles
5.5.7.1
ompd_get_curr_task_handle
5.5.7.2
ompd_get_generating_task_handle
5.5.7.3
ompd_get_scheduling_task_handle
5.5.7.4
ompd_get_task_in_parallel
5.5.7.5
ompd_rel_task_handle
5.5.7.6
ompd_task_handle_compare
5.5.7.7
ompd_get_task_function
5.5.7.8
ompd_get_task_frame
5.5.7.9
ompd_enumerate_states
5.5.7.10
ompd_get_state
5.5.8
Display Control Variables
5.5.8.1
ompd_get_display_control_vars
5.5.8.2
ompd_rel_display_control_vars
5.5.9
Accessing Scope-Specific Information
5.5.9.1
ompd_enumerate_icvs
5.5.9.2
ompd_get_icv_from_scope
5.5.9.3
ompd_get_icv_string_from_scope
5.5.9.4
ompd_get_tool_data
5.6
Runtime Entry Points for OMPD
5.6.1
Beginning Parallel Regions
5.6.2
Ending Parallel Regions
5.6.3
Beginning Task Regions
5.6.4
Ending Task Regions
5.6.5
Beginning OpenMP Threads
5.6.6
Ending OpenMP Threads
5.6.7
Initializing OpenMP Devices
5.6.8
Finalizing OpenMP Devices
6
Environment Variables
6.1
OMP_SCHEDULE
6.2
OMP_NUM_THREADS
6.3
OMP_DYNAMIC
6.4
OMP_PROC_BIND
6.5
OMP_PLACES
6.6
OMP_STACKSIZE
6.7
OMP_WAIT_POLICY
6.8
OMP_MAX_ACTIVE_LEVELS
6.9
OMP_NESTED
(Deprecated)
6.10
OMP_THREAD_LIMIT
6.11
OMP_CANCELLATION
6.12
OMP_DISPLAY_ENV
6.13
OMP_DISPLAY_AFFINITY
6.14
OMP_AFFINITY_FORMAT
6.15
OMP_DEFAULT_DEVICE
6.16
OMP_MAX_TASK_PRIORITY
6.17
OMP_TARGET_OFFLOAD
6.18
OMP_TOOL
6.19
OMP_TOOL_LIBRARIES
6.20
OMP_TOOL_VERBOSE_INIT
6.21
OMP_DEBUG
6.22
OMP_ALLOCATOR
6.23
OMP_NUM_TEAMS
6.24
OMP_TEAMS_THREAD_LIMIT
A
OpenMP Implementation-Defined Behaviors
B
Features History
B.1
Deprecated Features
B.2
Version 5.0 to 5.1 Differences
B.3
Version 4.5 to 5.0 Differences
B.4
Version 4.0 to 4.5 Differences
B.5
Version 3.1 to 4.0 Differences
B.6
Version 3.0 to 3.1 Differences
B.7
Version 2.5 to 3.0 Differences
[
next
] [
prev
] [
prev-tail
] [
front
] [
up
]