Dataset Viewer
Auto-converted to Parquet Duplicate
text
stringlengths
494
1.02k
cancellation is disabled and the cancel construct and cancellation points are effectively ignored. 11 The behavior of the program is implementation defined if OMP_CANCELLATION is set to neither 12 true nor false. 13 Cross References 14 • cancel directive, see Section 16.1 15 • cancel-var ICV, see Table 2.1 16 21.2.7 OMP_DEFAULT_DEVICE 17 The OMP_DEFAULT_DEVICE environment variable sets the device number to use in device 18 constructs by setting the initial value of the default-device-var ICV. The value of this environment 19 variable must be a non-negative integer value. 20 Cross References 21 • Device Directives and Clauses, see Chapter 13 22 • default-device-var ICV, see Table 2.1 23 21.2.8 OMP_TARGET_OFFLOAD 24 The OMP_TARGET_OFFLOAD environment variable sets the initial value of the target-offload-var 25 ICV. Its value must be one of the following: 26 mandatory | disabled | default 27 The mandatory value specifies that the effect of any device construct or device memory routine 28 that uses a device that is un
g, see 25 Section 1.3 and Chapter 12. 26 In parallel regions, references by the primary thread are to the copy of the variable in the thread 27 that encountered the parallel region. 28 During a sequential part, references are to the initial thread’s copy of the variable. The values of 29 data in the initial thread’s copy of a threadprivate variable are guaranteed to persist between any 30 CHAPTER 5. DATA ENVIRONMENT 101 two consecutive references to the variable in the program, provided that no teams construct that is 1 not nested inside of a target construct is encountered between the references and that the initial 2 thread is not executing code inside of a teams region. For initial threads that are executing code 3 inside of a teams region, the values of data in the copies of a threadprivate variable of those initial 4 threads are guaranteed to persist between any two consecutive references to the variable inside that 5 teams region. 6 The values of data in the threadprivate variables of threads that are n
task_reduction clause or a reduction clause with task as 1 the reduction-modifier that is specified on a construct that corresponds to a region in which the 2 region of the participating task is closely nested must match each list item. The construct that 3 corresponds to the innermost enclosing region that meets this condition must specify the same 4 reduction-identifier for the matching list item as the in_reduction clause. 5 Cross References 6 • target directive, see Section 13.8 7 • task directive, see Section 12.5 8 • taskloop directive, see Section 12.6 9 5.5.11 declare reduction Directive 10 Name: declare reduction Association: none Category: declarative Properties: pure 11 Arguments 12 declare reduction(reduction-specifier) 13 Name Type Properties reduction-specifier OpenMP reduction specifier default 14 Clauses 15 initializer 16 Semantics 17 The declare reduction directive declares a reduction-identifier that can be used in a 18 reduction clause as a user-defined reduction. The directive argument reduction-
atisfied if the operators in expr have precedence greater than binop, or by using parentheses 9 around expr or subexpressions of expr. 10 • The expression expr binop x must be numerically equivalent to (expr) binop x. This requirement 11 is satisfied if the operators in expr have precedence equal to or greater than binop, or by using 12 parentheses around expr or subexpressions of expr. 13 • The expression x ordop expr must be numerically equivalent to x ordop (expr). This requirement 14 is satisfied if the operators in expr have precedence greater than ordop, or by using parentheses 15 around expr or subexpressions of expr. 16 • The expression expr ordop x must be numerically equivalent to (expr) ordop x. This requirement 17 is satisfied if the operators in expr have precedence equal to or greater than ordop, or by using 18 parentheses around expr or subexpressions of expr. 19 • The expression x == e must be numerically equivalent to x == (e). This requirement is satisfied 20 if the operators in e have precedence
base language. 26 program order An ordering of operations performed by the same thread as determined by the 27 execution sequence of operations specified by the base language. 28 2 OpenMP API – Version 5.2 November 2021 COMMENT: For versions of C and C++ that include base language 1 support for threading, program order corresponds to the sequenced before 2 relation between operations performed by the same thread. 3 structured block For C/C++, an executable statement, possibly compound, with a single entry at the 4 top and a single exit at the bottom, or an OpenMP construct. 5 For Fortran, a strictly structured block or a loosely structured block. 6 structured block sequence For C/C++, a sequence of zero or more executable statements (including OpenMP 7 constructs) that together have a single entry at the top and a single exit at the bottom. 8 For Fortran, a block of zero or more executable constructs (including OpenMP 9 constructs) with a single entry at the top and a single exit at the bottom. 10 strictly str
cifiers (see Section 3.1). 3 • The omp_all_memory reserved locator was added (see Section 3.1), and the depend clause 4 was extended to allow its use (see Section 15.9.5). 5 • Support for private and firstprivate as an argument to the default clause in C and 6 C++ was added (see Section 5.4.1). 7 • Support was added so that iterators may be defined and used in a map clause (see Section 5.8.3) 8 or in data-motion clause on a target update directive (see Section 13.9). 9 • The present argument was added to the defaultmap clause (see Section 5.8.7). 10 • Support for the align clause on the allocate directive and allocator and align 11 modifiers on the allocate clause was added (see Chapter 6). 12 • The target_device trait set was added to the OpenMP context (see Section 7.1), and the 13 target_device selector set was added to context selectors (see Section 7.2). 14 • For C/C++, the declare variant directive was extended to support elision of preprocessed code 15 and to allow enclosed function definitions to be inter
near-modifier(list) was deprecated and the step modifier 16 was added for specifying the linear step (see Section 5.4.6). 17 • The minus (-) operator for reductions was deprecated (see Section 5.5.5). 18 • The syntax of modifiers without comma separators in the map clause was deprecated (see 19 Section 5.8.3). 20 • To support the complete range of user-defined mappers and to improve consistency of map 21 clause usage, the declare mapper directive was extended to accept iterator-modifier and the 22 present map-type-modifier (see Section 5.8.3 and Section 5.8.8). 23 • If a matching mapped list item is not found in the data environment, the pointer retains its 24 original value as per the firstprivate semantics (see Section 5.8.6). 25 • The enter clause was added as a synonym for the to clause on the declare target directive, and 26 the corresponding to clause was deprecated to reduce parsing ambiguity (see Section 5.8.4 and 27 Section 7.8). 28 Fortran • Metadirectives (see Section 7.4), assumption directives (see Sect
se flush, and it will load any value of a shared variable propagated by a 11 release flush that synchronizes with it into its temporary view so that it may be subsequently read. 12 Therefore, release and acquire flushes may also be used to guarantee that a value written to a 13 variable by one thread may be read by a second thread. To accomplish this, the programmer must 14 ensure that the second thread has not written to the variable since its last acquire flush, and that the 15 following sequence of events happen in this specific order: 16 1. The value is written to the variable by the first thread; 17 2. The first thread performs a release flush; 18 3. The second thread performs an acquire flush; and 19 4. The value is read from the variable by the second thread. 20 21 Note – OpenMP synchronization operations, described in Chapter 15 and in Section 18.9, are 22 recommended for enforcing this order. Synchronization through variables is possible but is not 23 recommended because the proper timing of flushes is difficult
ialized with the value ompt_data_none. 3 This runtime entry point is async signal safe. 4 Between a parallel-begin event and an implicit-task-begin event, a call to 5 ompt_get_parallel_info(0,...) may return information about the outer parallel team or 6 the new parallel team. 7 If a thread is in the state ompt_state_wait_barrier_implicit_parallel then a call to 8 ompt_get_parallel_info may return a pointer to a copy of the specified parallel region’s 9 parallel_data rather than a pointer to the data word for the region itself. This convention enables 10 the primary thread for a parallel region to free storage for the region immediately after the region 11 ends, yet avoid having some other thread in the team that is executing the region potentially 12 reference the parallel_data object for the region after it has been freed. 13 Description of Arguments 14 The ancestor_level argument specifies the parallel region of interest by its ancestor level. Ancestor 15 level 0 refers to the innermost parallel region; info
ved. 17 • The definition of the nest-var, dyn-var, nthreads-var and run-sched-var internal control variables 18 (ICVs) were modified to provide one copy of these ICVs per task instead of one copy for the 19 whole program (see Chapter 2). The omp_set_num_threads, omp_set_nested, and 20 omp_set_dynamic runtime library routines were specified to support their use from inside a 21 parallel region (see Section 18.2.1, Section 18.2.6 and Section 18.2.9). 22 • The thread-limit-var ICV, the omp_get_thread_limit runtime library routine and the 23 OMP_THREAD_LIMIT environment variable were added to support control of the maximum 24 number of threads (see Section 2.1, Section 18.2.13 and Section 21.1.3). 25 • The max-active-levels-var ICV, omp_set_max_active_levels and 26 omp_get_max_active_levels runtime library routines, and 27 OMP_MAX_ACTIVE_LEVELS environment variable were added to support control of the 28 number of nested active parallel regions (see Section 2.1, Section 18.2.15, Section 18.2.16 29 and Section 21.1.4
e variable passed 32 by reference in callback and ompt_get_callback returns 1; otherwise, it returns 0. If 33 ompt_get_callback returns 0, the value of the variable passed by reference as callback is 34 undefined. 35 514 OpenMP API – Version 5.2 November 2021 Description of Arguments 1 The event argument indicates the event for which the callback would be invoked. 2 The callback argument returns a pointer to the callback associated with event. 3 Constraints on Arguments 4 The callback argument cannot be NULL and must point to valid storage. 5 Cross References 6 • Callbacks, see Section 19.4.2 7 • ompt_callback_t, see Section 19.4.4.1 8 • ompt_set_callback_t, see Section 19.6.1.3 9 19.6.1.5 ompt_get_thread_data_t 10 Summary 11 The ompt_get_thread_data_t type is the type signature of the 12 ompt_get_thread_data runtime entry point, which returns the address of the thread data 13 object for the current thread. 14 Format 15 C / C++ typedef ompt_data_t *(*ompt_get_thread_data_t) (void); 16 C / C++ Semantics 17 Each
eger. 24 The stride must evaluate to a positive integer. 25 When the size of the array dimension is not known, the length must be specified explicitly. 26 When the stride is absent it defaults to 1. 27 When the length is absent it defaults to ⌈⌈(size − lower-bound)/stride⌉⌉, where size is the size of the 28 array dimension. 29 When the lower-bound is absent it defaults to 0. 30 64 OpenMP API – Version 5.2 November 2021 C/C++ (cont.) The precedence of a subscript operator that uses the array section syntax is the same as the 1 precedence of a subscript operator that does not use the array section syntax. 2 3 Note – The following are examples of array sections: 4 a[0:6] 5 a[0:6:1] 6 a[1:10] 7 a[1:] 8 a[:10:2] 9 b[10][:][:] 10 b[10][:][:0] 11 c[42][0:6][:] 12 c[42][0:6:2][:] 13 c[1:10][42][0:6] 14 S.c[:100] 15 p->y[:10] 16 this->a[:N] 17 (p+10)[:N] 18 Assume a is declared to be a 1-dimensional array with dimension size 11. The first two examples 19 are equivalent, and the third and fourth examples are equivalent.
17 range-decl of each associated loop has the value that it would have if the set of the associated loops 18 was executed sequentially. 19 When an if clause is present and the if clause expression evaluates to false, undeferred tasks are 20 generated. The use of a variable in an if clause expression causes an implicit reference to the 21 variable in all enclosing constructs. 22 C++ For firstprivate variables of class type, the number of invocations of copy constructors that 23 perform the initialization is implementation defined. 24 C++ 25 Note – When storage is shared by a taskloop region, the programmer must ensure, by adding 26 proper synchronization, that the storage does not reach the end of its lifetime before the taskloop 27 region and its descendent tasks complete their execution. 28 29 Execution Model Events 30 The taskloop-begin event occurs upon entering the taskloop region. A taskloop-begin will 31 precede any task-create events for the generated tasks. The taskloop-end event occurs upon 32 comple
Clauses 23 Clause groups 24 Properties: unique, inarguable Members: simd, threads 25 Directives 26 ordered 27 Semantics 28 The parallelization-level clause grouping defines a set of clauses that indicate the level of 29 parallelization with which to associate a construct. 30 Cross References 31 • ordered directive, see Section 15.10.2 32 CHAPTER 15. SYNCHRONIZATION CONSTRUCTS AND CLAUSES 331 16 Cancellation Constructs 1 This chapter defines constructs related to cancellation of OpenMP regions. 2 16.1 cancel Construct 3 Name: cancel Association: none Category: executable Properties: default 4 Clauses 5 if, do, for, parallel, sections, taskgroup 6 Additional information 7 The cancel-directive-name clause set consists of the directive-name of each directive that has the 8 cancellable property (i.e., directive-name for the worksharing-loop construct, parallel, 9 sections and taskgroup). This clause set has the required, unique and exclusive properties. 10 Binding 11 The binding thread set of the cancel region is th
indirect Clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 8 Informational and Utility Directives 210 8.1 at Clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 8.2 requires Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210 8.2.1 requirement Clauses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 8.3 Assumption Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 8.3.1 assumption Clauses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 8.3.2 assumes Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 8.3.3 assume Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 8.3.4 begin assumes Directive . . . . . . . . . . . . . . . . . . . . . . . . . . 215 8.4 nothing Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 8.5 error Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 8.5.1 sev
Fortran Variables with predetermined data-sharing attributes may not be listed in data-sharing attribute 15 clauses, except for the cases listed below. For these exceptions only, listing a predetermined 16 variable in a data-sharing attribute clause is allowed and overrides the variable’s predetermined 17 data-sharing attributes. 18 • The loop iteration variable in any associated loop of a loop-associated construct may be listed in 19 a private or lastprivate clause. 20 • If a simd construct has just one associated loop then its loop iteration variable may be listed in a 21 linear clause with a linear-step that is the increment of the associated loop. 22 C / C++ • Variables with const-qualified type with no mutable members may be listed in a 23 firstprivate clause, even if they are static data members. 24 • The __func__ variable and similar function-local predefined variables may be listed in a 25 shared or firstprivate clause. 26 C / C++ 98 OpenMP API – Version 5.2 November 2021 Fortran • Loop iteration variab
lay_affinity, 370 OMP_DISPLAY_ENV, 615 omp_display_env, 438 OMP_DYNAMIC, 600 omp_free, 430 omp_fulfill_event, 414 omp_get_active_level, 362 omp_get_affinity_format, 369 omp_get_ancestor_thread_num, 360 omp_get_cancellation, 353 omp_get_default_allocator, 428 omp_get_default_device, 382 omp_get_device_num, 384 omp_get_dynamic, 352 omp_get_initial_device, 385 omp_get_interop_int, 417 omp_get_interop_name, 420 omp_get_interop_ptr, 418 omp_get_interop_rc_desc, 421 omp_get_interop_str, 419 omp_get_interop_type_desc, 421 omp_get_level, 360 omp_get_mapped_ptr, 402 omp_get_max_active_levels, 359 omp_get_max_task_priority, 377 omp_get_max_teams, 374 omp_get_max_threads, 350 omp_get_nested, 354 omp_get_num_devices, 383 omp_get_num_interop_properties, 417 omp_get_num_places, 364 omp_get_num_procs, 381 omp_get_num_teams, 372 omp_get_num_threads, 349 omp_get_partition_num_places, 367 omp_get_partition_place_nums, 368 omp_get_place_num, 366 omp_get_place_num_procs, 365 omp_get_place_proc_ids, 365 omp_get_proc_bind, 363 omp
performed. 24 Fortran The omp_target_memcpy_rect_async routine requires an explicit interface and so might 25 not be provided in omp_lib.h. 26 Fortran Execution Model Events 27 The target-data-op-begin event occurs before a thread initiates a data transfer in the 28 omp_target_memcpy_rect_async region. 29 The target-data-op-end event occurs after a thread initiates a data transfer in the 30 omp_target_memcpy_rect_async region. 31 Tool Callbacks 32 A thread dispatches a registered ompt_callback_target_data_op_emi callback with 33 ompt_scope_begin as its endpoint argument for each occurrence of a target-data-op-begin 34 event in that thread. Similarly, a thread dispatches a registered 35 ompt_callback_target_data_op_emi callback with ompt_scope_end as its endpoint 36 argument for each occurrence of a target-data-op-end event in that thread. These callbacks have 37 type signature ompt_callback_target_data_op_emi_t. 38 398 OpenMP API – Version 5.2 November 2021 A thread dispatches a registered ompt_callback_targ
pe signature ompt_callback_masked_t. 31 Cross References 32 • ompt_callback_masked_t, see Section 19.5.2.12 33 • ompt_scope_endpoint_t, see Section 19.4.4.11 34 • filter clause, see Section 10.5.1 35 238 OpenMP API – Version 5.2 November 2021 10.5.1 filter Clause 1 Name: filter Properties: unique 2 Arguments 3 Name Type Properties thread_num expression of integer type default 4 Directives 5 masked 6 Semantics 7 If thread_num specifies the thread number of the current thread in the current team then the 8 filter clause selects the current thread. If the filter clause is not specified, the effect is as if 9 the clause is specified with thread_num equal to zero, so that the filter clause selects the 10 primary thread. The use of a variable in a thread_num clause expression causes an implicit 11 reference to the variable in all enclosing constructs. 12 Cross References 13 • masked directive, see Section 10.5 14 CHAPTER 10. PARALLELISM GENERATION AND CONTROL 239 11 Work-Distribution Constructs 1 A work-distribution co
t item type default 11 Directives 12 scan 13 Semantics 14 The inclusive clause is used on a separating directive that separates a structured block into two 15 structured block sequences. The clause determines the association of the structured block sequence 16 that precedes the directive on which the clause appears to a phase of that directive. 17 The list items that appear in an inclusive clause may include array sections. 18 Cross References 19 • scan directive, see Section 5.6 20 5.6.2 exclusive Clause 21 Name: exclusive Properties: unique 22 Arguments 23 Name Type Properties list list of variable list item type default 24 Directives 25 scan 26 CHAPTER 5. DATA ENVIRONMENT 143 Semantics 1 The exclusive clause is used on a separating directive that separates a structured block into two 2 structured block sequences. The clause determines the association of the structured block sequence 3 that precedes the directive on which the clause appears to a phase of that directive. 4 The list items that appear in an ex
on-identifier. 22 After the end of the region, the original list item is updated with the values of the private copies 23 using the combiner associated with the reduction-identifier. 24 If reduction-modifier is not present or the default reduction-modifier is present, the behavior is 25 as follows. For parallel and worksharing constructs, one or more private copies of each list 26 134 OpenMP API – Version 5.2 November 2021 item are created for each implicit task, as if the private clause had been used. For the simd 1 construct, one or more private copies of each list item are created for each SIMD lane, as if the 2 private clause had been used. For the taskloop construct, private copies are created 3 according to the rules of the reduction scoping clauses. For the teams construct, one or more 4 private copies of each list item are created for the initial task of each team in the league, as if the 5 private clause had been used. For the loop construct, private copies are created and used in the 6 construct accordi
em that appears in a reduction clause of a teams construct must not appear in a 25 firstprivate clause on a distribute construct if any of the distribute regions that 26 arise from the distribute construct ever bind to any of the teams regions that arise from the 27 teams construct. 28 • A list item that appears in a reduction clause of a worksharing construct must not appear in a 29 firstprivate clause in a task construct encountered during execution of any of the 30 worksharing regions that arise from the worksharing construct. 31 CHAPTER 5. DATA ENVIRONMENT 113 C++ • A variable of class type (or array thereof) that appears in a firstprivate clause requires an 1 accessible, unambiguous copy constructor for the class type. 2 • If the original list item in a firstprivate clause on a work-distribution construct has a 3 reference type then it must bind to the same object for all threads in the binding thread set of the 4 work-distribution region. 5 C++ Fortran • If the list item is a polymorphic variable with t
n unit, 21 omp_alloc and omp_aligned_alloc invocations that appear in target regions must not 22 pass omp_null_allocator as the allocator argument, which must be a constant expression 23 that evaluates to one of the predefined memory allocator values. The alignment argument to 24 omp_aligned_alloc must be a power of two and the size argument must be a multiple of 25 alignment. 26 Binding 27 The binding task set for an omp_alloc or omp_aligned_alloc region is the generating task. 28 Effect 29 The omp_alloc and omp_aligned_alloc routines request a memory allocation of size bytes 30 from the specified memory allocator. If the allocator argument is omp_null_allocator the 31 memory allocator used by the routines will be the one specified by the def-allocator-var ICV of the 32 binding implicit task. Upon success they return a pointer to the allocated memory. Otherwise, the 33 behavior that the fallback trait of the allocator specifies will be followed. If size is 0, 34 omp_alloc and omp_aligned_alloc will return NULL.
sk exists that modifies it. 22 As another example, if a lock acquire and release happen in different parts of a task region, no 23 attempt should be made to acquire the same lock in any part of another task that the executing 24 thread may schedule. Otherwise, a deadlock is possible. A similar situation can occur when a 25 critical region spans multiple parts of a task and another schedulable task contains a 26 critical region with the same name. 27 The use of threadprivate variables and the use of locks or critical sections in an explicit task with an 28 if clause must take into account that when the if clause evaluates to false, the task is executed 29 immediately, without regard to Task Scheduling Constraint 2. 30 31 Execution Model Events 32 The task-schedule event occurs in a thread when the thread switches tasks at a task scheduling 33 point; no event occurs when switching to or from a merged task. 34 CHAPTER 12. TASKING CONSTRUCTS 273 Tool Callbacks 1 A thread dispatches a registered ompt_callback_task_s
or routine creates a new allocator that is associated with the 25 memspace memory space and returns a handle to it. All allocations through the created allocator 26 will behave according to the allocator traits specified in the traits argument. The number of traits in 27 the traits argument is specified by the ntraits argument. Specifying the same allocator trait more 28 than once results in unspecified behavior. The routine returns a handle for the created allocator. If 29 the special omp_atv_default value is used for a given trait, then its value will be the default 30 value specified in Table 6.2 for that given trait. 31 If memspace is omp_default_mem_space and the traits argument is an empty set this routine 32 will always return a handle to an allocator. Otherwise if an allocator based on the requirements 33 cannot be created then the special omp_null_allocator handle is returned. 34 CHAPTER 18. RUNTIME LIBRARY ROUTINES 425 Restrictions 1 The restrictions to the omp_init_allocator routine are as follows: 2 •
out min omp_priv = Maximal representable number in the reduction list item type omp_out = omp_in < omp_out ? omp_in : omp_out C / C++ Fortran Table 5.2 lists each reduction identifier that is implicitly declared for numeric and logical types and 1 its semantic initializer value. The actual initializer value is that value as expressed in the data type 2 of the reduction list item. 3 TABLE 5.2: Implicitly Declared Fortran Reduction Identifiers Identifier Initializer Combiner + omp_priv = 0 omp_out = omp_in + omp_out - (depre- cated) omp_priv = 0 omp_out = omp_in + omp_out * omp_priv = 1 omp_out = omp_in * omp_out table continued on next page CHAPTER 5. DATA ENVIRONMENT 129 table continued from previous page Identifier Initializer Combiner .and. omp_priv = .true. omp_out = omp_in .and. omp_out .or. omp_priv = .false. omp_out = omp_in .or. omp_out .eqv. omp_priv = .true. omp_out = omp_in .eqv. omp_out .neqv. omp_priv = .false. omp_out = omp_in .neqv. omp_out max omp_priv = Minimal representable number in the reductio
Section 6.5 5 Fortran 6.8 uses_allocators Clause 6 Name: uses_allocators Properties: data-environment attribute, data- sharing attribute 7 Arguments 8 Name Type Properties allocator expression of allocator_handle type default 9 Modifiers 10 Name Modifies Type Properties mem-space Generic Complex, name: memspace Arguments: memspace-handle expression of memspace_handle type (de- fault) default traits-array Generic Complex, name: traits Arguments: traits variable of alloctrait array type (default) default 11 Directives 12 target 13 Additional information 14 The comma-separated list syntax, in which each list item is a clause-argument-specification of the 15 form allocator[(traits)] may also be used for the uses_allocators clause arguments. With 16 this syntax, traits must be a constant array with constant values. This syntax has been deprecated. 17 CHAPTER 6. MEMORY MANAGEMENT 181 Semantics 1 The uses_allocators clause enables the use of the specified allocator in the region associated 2 with the directive on which
callback for each 30 occurrence of a taskwait-complete event. This callback has the type signature 31 ompt_callback_task_schedule_t with ompt_taskwait_complete as its 32 prior_task_status argument. 33 Restrictions 34 Restrictions to the taskwait construct are as follows: 35 • The mutexinoutset dependence-type may not appear in a depend clause on a taskwait 36 construct. 37 • If the dependence-type of a depend clause is depobj then the dependence objects cannot 38 represent dependences of the mutexinoutset dependence type. 39 CHAPTER 15. SYNCHRONIZATION CONSTRUCTS AND CLAUSES 307 • The nowait clause may only appear on a taskwait directive if the depend clause is present. 1 Cross References 2 • ompt_callback_sync_region_t, see Section 19.5.2.13 3 • ompt_scope_endpoint_t, see Section 19.4.4.11 4 • ompt_sync_region_t, see Section 19.4.4.14 5 • depend clause, see Section 15.9.5 6 • nowait clause, see Section 15.6 7 • task directive, see Section 12.5 8 15.6 nowait Clause 9 Name: nowait Properties: unique, end-claus
h returns the place number of the place to which the current thread is 33 bound. 34 CHAPTER 19. OMPT INTERFACE 517 Format 1 C / C++ typedef int (*ompt_get_place_num_t) (void); 2 C / C++ Semantics 3 When the current thread is bound to a place, ompt_get_place_num returns the place number 4 associated with the thread. The returned value is between 0 and one less than the value returned by 5 ompt_get_num_places, inclusive. When the current thread is not bound to a place, the routine 6 returns -1. This runtime entry point is async signal safe. 7 19.6.1.10 ompt_get_partition_place_nums_t 8 Summary 9 The ompt_get_partition_place_nums_t type is the type signature of the 10 ompt_get_partition_place_nums runtime entry point, which returns a list of place 11 numbers that correspond to the places in the place-partition-var ICV of the innermost implicit task. 12 Format 13 C / C++ typedef int (*ompt_get_partition_place_nums_t) ( 14 int place_nums_size, 15 int *place_nums 16 ); 17 C / C++ Semantics 18 The ompt_get_partition
hint_t omp_lock_hint_t; 9 C / C++ Fortran integer, parameter :: omp_lock_hint_kind = omp_sync_hint_kind 10 11 integer (kind=omp_sync_hint_kind), & 12 parameter :: omp_sync_hint_none = & 13 int(Z’0’, kind=omp_sync_hint_kind) 14 integer (kind=omp_lock_hint_kind), & 15 parameter :: omp_lock_hint_none = omp_sync_hint_none 16 integer (kind=omp_sync_hint_kind), & 17 parameter :: omp_sync_hint_uncontended = & 18 int(Z’1’, kind=omp_sync_hint_kind) 19 integer (kind=omp_lock_hint_kind), & 20 parameter :: omp_lock_hint_uncontended = & 21 omp_sync_hint_uncontended 22 integer (kind=omp_sync_hint_kind), & 23 parameter :: omp_sync_hint_contended = & 24 int(Z’2’, kind=omp_sync_hint_kind) 25 integer (kind=omp_lock_hint_kind), & 26 parameter :: omp_lock_hint_contended = & 27 omp_sync_hint_contended 28 integer (kind=omp_sync_hint_kind), & 29 parameter :: omp_sync_hint_nonspeculative = & 30 int(Z’4’, kind=omp_sync_hint_kind) 31 integer (kind=omp_lock_hint_kind), & 32 parameter :: omp_lock_hint_nonspeculative = & 33 omp_sync_hint
r ICV. 22 Cross References 23 • place-partition-var ICV, see Table 2.1 24 CHAPTER 18. RUNTIME LIBRARY ROUTINES 367 18.3.7 omp_get_partition_place_nums 1 Summary 2 The omp_get_partition_place_nums routine returns the list of place numbers 3 corresponding to the places in the place-partition-var ICV of the innermost implicit task. 4 Format 5 C / C++ void omp_get_partition_place_nums(int *place_nums); 6 C / C++ Fortran subroutine omp_get_partition_place_nums(place_nums) 7 integer place_nums(*) 8 Fortran Binding 9 The binding task set for an omp_get_partition_place_nums region is the encountering 10 implicit task. 11 Effect 12 The omp_get_partition_place_nums routine returns the list of place numbers that 13 correspond to the places in the place-partition-var ICV of the innermost implicit task. The array 14 must be sufficiently large to contain omp_get_partition_num_places() integers; 15 otherwise, the behavior is unspecified. 16 Cross References 17 • omp_get_partition_num_places, see Section 18.3.6 18 • place-parti
the numerical identifiers of each processor 11 associated with the place numbered place_num. The numerical identifiers are non-negative and 12 their meaning is implementation defined. The numerical identifiers are returned in the array ids and 13 their order in the array is implementation defined. The array must be sufficiently large to contain 14 omp_get_place_num_procs(place_num) integers; otherwise, the behavior is unspecified. 15 The routine has no effect when place_num has a negative value or a value greater than or equal to 16 omp_get_num_places(). 17 Cross References 18 • OMP_PLACES, see Section 21.1.6 19 • omp_get_num_places, see Section 18.3.2 20 • omp_get_place_num_procs, see Section 18.3.3 21 18.3.5 omp_get_place_num 22 Summary 23 The omp_get_place_num routine returns the place number of the place to which the 24 encountering thread is bound. 25 Format 26 C / C++ int omp_get_place_num(void); 27 C / C++ Fortran integer function omp_get_place_num() 28 Fortran 366 OpenMP API – Version 5.2 November 2021 Binding
cation and that includes a 14 442 OpenMP API – Version 5.2 November 2021 definition of ompt_start_tool. 1 If the value of tool-var is enabled, the OpenMP implementation must check if a tool has provided 2 an implementation of ompt_start_tool. The OpenMP implementation first checks if a 3 tool-provided implementation of ompt_start_tool is available in the address space, either 4 statically-linked into the application or in a dynamically-linked library loaded in the address space. 5 If multiple implementations of ompt_start_tool are available, the OpenMP implementation 6 will use the first tool-provided implementation of ompt_start_tool that it finds. 7 If the implementation does not find a tool-provided implementation of ompt_start_tool in the 8 address space, it consults the tool-libraries-var ICV, which contains a (possibly empty) list of 9 dynamically-linked libraries. As described in detail in Section 21.3.2, the libraries in 10 tool-libraries-var are then searched for the first usable implementation of ompt_sta
ion 17.1 for the restrictions on nesting. 2 closely nested region A region nested inside another region with no parallel region nested between 3 them. 4 strictly nested region A region nested inside another region with no other explicit region nested between 5 them. 6 all threads All OpenMP threads participating in the OpenMP program. 7 current team All threads in the team executing the innermost enclosing parallel region. 8 encountering thread For a given region, the thread that encounters the corresponding construct. 9 all tasks All tasks participating in the OpenMP program. 10 current team tasks All tasks encountered by the corresponding team. The implicit tasks constituting the 11 parallel region and any descendent tasks encountered during the execution of 12 these implicit tasks are included in this set of tasks. 13 generating task For a given region, the task for which execution by a thread generated the region. 14 binding thread set The set of threads that are affected by, or provide the context for, th
alue of 5 max-active-levels-var is set to 1. The behavior of the program is implementation defined if the 6 value of OMP_NESTED is neither true nor false. 7 If both the OMP_NESTED and OMP_MAX_ACTIVE_LEVELS environment variables are set, the 8 value of OMP_NESTED is false, and the value of OMP_MAX_ACTIVE_LEVELS is greater than 9 1, then the behavior is implementation defined. Otherwise, if both environment variables are set 10 then the OMP_NESTED environment variable has no effect. 11 The OMP_NESTED environment variable has been deprecated. 12 Example: 13 setenv OMP_NESTED false 14 Cross References 15 • OMP_MAX_ACTIVE_LEVELS, see Section 21.1.4 16 • max-active-levels-var ICV, see Table 2.1 17 21.1.6 OMP_PLACES 18 The OMP_PLACES environment variable sets the initial value of the place-partition-var ICV. A list 19 of places can be specified in the OMP_PLACES environment variable. The value of OMP_PLACES 20 can be one of two types of values: either an abstract name that describes a set of places or an 21 explicit lis
oyed with omp_destroy_allocator results in unspecified 12 behavior. 13 Cross References 14 • Memory Allocators, see Section 6.2 15 • omp_destroy_allocator, see Section 18.13.3 16 18.13.8 omp_calloc and omp_aligned_calloc 17 Summary 18 The omp_calloc and omp_aligned_calloc routines request a zero initialized memory 19 allocation from a memory allocator. 20 Format 21 C void *omp_calloc( 22 size_t nmemb, 23 size_t size, 24 omp_allocator_handle_t allocator 25 ); 26 void *omp_aligned_calloc( 27 size_t alignment, 28 size_t nmemb, 29 size_t size, 30 omp_allocator_handle_t allocator 31 ); 32 C CHAPTER 18. RUNTIME LIBRARY ROUTINES 431 C++ void *omp_calloc( 1 size_t nmemb, 2 size_t size, 3 omp_allocator_handle_t allocator=omp_null_allocator 4 ); 5 void *omp_aligned_calloc( 6 size_t alignment, 7 size_t nmemb, 8 size_t size, 9 omp_allocator_handle_t allocator=omp_null_allocator 10 ); 11 C++ Fortran type(c_ptr) function omp_calloc(nmemb, size, allocator) bind(c) 12 use, intrinsic :: iso_c_binding, only : c_ptr, c_size_t 13
in 3 the program unit. 4 • If a threadprivate variable or a threadprivate common block is declared with the BIND attribute, 5 the corresponding C entities must also be specified in a threadprivate directive in the C 6 program. 7 • A variable may only appear as an argument in a threadprivate directive in the scope in 8 which it is declared. It must not be an element of a common block or appear in an 9 EQUIVALENCE statement. 10 • A variable that appears as an argument in a threadprivate directive must be declared in the 11 scope of a module or have the SAVE attribute, either explicitly or implicitly. 12 • The effect of an access to a threadprivate variable in a DO CONCURRENT construct is unspecified. 13 Fortran Cross References 14 • Determining the Number of Threads for a parallel Region, see Section 10.1.1 15 • copyin clause, see Section 5.7.1 16 • dyn-var ICV, see Table 2.1 17 • order clause, see Section 10.3 18 5.3 List Item Privatization 19 Some data-sharing attribute clauses, including reduction clauses, spec
ICV is a list. The runtime call omp_set_num_threads sets 4 the value of the first element of this list, and omp_get_max_threads retrieves the value of 5 the first element of this list. 6 • Detailed values in the place-partition-var ICV are retrieved using the listed runtime calls. 7 CHAPTER 2. INTERNAL CONTROL VARIABLES 43 • The thread_limit clause sets the thread-limit-var ICV for the region of the construct on 1 which it appears. 2 Cross References 3 • omp_get_active_level, see Section 18.2.20 4 • omp_get_affinity_format, see Section 18.3.9 5 • omp_get_cancellation, see Section 18.2.8 6 • omp_get_default_allocator, see Section 18.13.5 7 • omp_get_default_device, see Section 18.7.3 8 • omp_get_dynamic, see Section 18.2.7 9 • omp_get_level, see Section 18.2.17 10 • omp_get_max_active_levels, see Section 18.2.16 11 • omp_get_max_task_priority, see Section 18.5.1 12 • omp_get_max_teams, see Section 18.4.4 13 • omp_get_max_threads, see Section 18.2.3 14 • omp_get_num_procs, see Section 18.7.1 15 • omp_get_num_thre
API – Version 5.2 November 2021 • nogroup clause, see Section 15.7 1 • num_tasks clause, see Section 12.6.2 2 • priority clause, see Section 12.4 3 • private clause, see Section 5.4.3 4 • reduction clause, see Section 5.5.8 5 • shared clause, see Section 5.4.2 6 • task directive, see Section 12.5 7 • taskgroup directive, see Section 15.4 8 • untied clause, see Section 12.1 9 12.6.1 grainsize Clause 10 Name: grainsize Properties: unique 11 Arguments 12 Name Type Properties grain-size expression of integer type positive 13 Modifiers 14 Name Modifies Type Properties prescriptiveness grain-size Keyword: strict unique 15 Directives 16 taskloop 17 Semantics 18 The grainsize clause specifies the number of logical iterations, Lt, that are assigned to each 19 generated task t. If prescriptiveness is not specified as strict, other than possibly for the 20 generated task that contains the sequentially last iteration, Lt is greater than or equal to the 21 minimum of the value of the grain-size expression and the number of l
5 7.6.2 nocontext Clause 16 Name: nocontext Properties: unique 17 Arguments 18 Name Type Properties do-not-update-context expression of logical type default 19 Directives 20 dispatch 21 Semantics 22 If do-not-update-context evaluates to true, the construct on which the nocontext clause appears 23 is not added to the construct set of the OpenMP context. The use of a variable in 24 do-not-update-context causes an implicit reference to the variable in all enclosing constructs. 25 do-not-update-context is evaluated in the enclosing context. 26 Cross References 27 • dispatch directive, see Section 7.6 28 CHAPTER 7. VARIANT DIRECTIVES 201 7.7 declare simd Directive 1 Name: declare simd Association: declaration Category: declarative Properties: pure 2 Arguments 3 declare simd[(proc-name)] 4 Name Type Properties proc-name identifier of function type optional 5 Clause groups 6 branch 7 Clauses 8 aligned, linear, simdlen, uniform 9 Semantics 10 The association of one or more declare simd directives with a function decla
1 • ompd_rc_callback if a callback returned an unexpected error, which leads to a failure of the 1 query; 2 • ompd_rc_needs_state_tracking if the information cannot be provided while the 3 debug-var is disabled; 4 • ompd_rc_ok on success; or 5 • ompd_rc_error for any other error. 6 20.5.1 Per OMPD Library Initialization and Finalization 7 The OMPD library must be initialized exactly once after it is loaded, and finalized exactly once 8 before it is unloaded. Per OpenMP process or core file initialization and finalization are also 9 required. Once loaded, the tool can determine the version of the OMPD API that the library 10 supports by calling ompd_get_api_version (see Section 20.5.1.2). If the tool supports the 11 version that ompd_get_api_version returns, the tool starts the initialization by calling 12 ompd_initialize (see Section 20.5.1.1) using the version of the OMPD API that the library 13 supports. If the tool does not support the version that ompd_get_api_version returns, it may 14 attempt to call ompd_
evenly, the exact number of threads in a particular 6 subpartition is implementation defined. 7 The determination of whether the affinity request can be fulfilled is implementation defined. If the 8 affinity request cannot be fulfilled, then the affinity of threads in the team is implementation defined. 9 10 Note – Wrap around is needed if the end of a place partition is reached before all thread 11 assignments are done. For example, wrap around may be needed in the case of close and T ≤ P, 12 if the primary thread is assigned to a place other than the first place in the place partition. In this 13 case, thread 1 is assigned to the place after the place of the primary thread, thread 2 is assigned to 14 the place after that, and so on. The end of the place partition may be reached before all threads are 15 assigned. In this case, assignment of threads is resumed with the first place in the place partition. 16 17 Cross References 18 • bind-var ICV, see Table 2.1 19 • parallel directive, see Section 10.1 20 • place-partitio
ent loop schedules, 95 construct syntax, 48 constructs allocators, 180 atomic, 311 barrier, 301 cancel, 332 cancellation constructs, 332 cancellation point, 336 combined constructs, 343 composite constructs, 343 642 OpenMP API – Version 5.2 November 2021 critical, 299 depobj, 322 device constructs, 275 dispatch, 200 distribute, 254 do, 251 flush, 315 for, 250 interop, 291 loop, 257 masked, 238 ordered, 328–330 parallel, 223 scope, 242 sections, 243 simd, 235 single, 240 target, 283 target data, 279 target enter data, 280 target exit data, 282 target update, 289 task, 262 taskgroup, 304 tasking constructs, 260 taskloop, 266 taskwait, 306 taskyield, 270 teams, 230 tile, 219 unroll, 220 work-distribution, 240 workshare, 245 worksharing, 240 worksharing-loop construct, 247 controlling OpenMP thread affinity, 228 copyin, 144 copyprivate, 146 critical, 299 D data copying clauses, 144 data environment, 96 data terminology, 14 data-mapping control, 147 data-motion clauses, 165 data-sharing attribute clauses, 108 data-s
n is 16 implementation defined (see Section 5.2). 17 Fortran • is_device_ptr clause: Support for pointers created outside of the OpenMP device data 18 management routines is implementation defined (see Section 5.4.7). 19 Chapter 6: 20 • Memory spaces: The actual storage resources that each memory space defined in Table 6.1 21 represents are implementation defined. The mechanism that provides the constant value of the 22 variables allocated in the omp_const_mem_space memory space is implementation defined 23 (see Section 6.1). 24 • Memory allocators: The minimum size for partitioning allocated memory over storage 25 resources is implementation defined. The default value for the pool_size allocator trait (see 26 Table 6.2) is implementation defined. The memory spaces associated with the predefined 27 omp_cgroup_mem_alloc, omp_pteam_mem_alloc and omp_thread_mem_alloc 28 allocators (see Table 6.3) are implementation defined (see Section 6.2). 29 • aligned clause: If the alignment modifier is not specified, the default align
11 Table 2.4 shows the override relationships among construct clauses and ICVs. The table only lists 12 ICVs that can be overridden by a clause. 13 TABLE 2.4: ICV Override Relationships ICV construct clause, if used bind-var proc_bind def-allocator-var allocate, allocator nteams-var num_teams nthreads-var num_threads run-sched-var schedule teams-thread-limit-var thread_limit Semantics 14 • The num_threads clause overrides the value of the first element of the nthreads-var ICV. 15 • If a schedule clause specifies a modifier then that modifier overrides any modifier that is 16 specified in the run-sched-var ICV. 17 • If bind-var is not set to false then the proc_bind clause overrides the value of the first element 18 of the bind-var ICV; otherwise, the proc_bind clause has no effect. 19 Cross References 20 • allocate clause, see Section 6.6 21 • allocator clause, see Section 6.4 22 • num_teams clause, see Section 10.2.1 23 46 OpenMP API – Version 5.2 November 2021 • num_threads clause, see Section 10.1.2 1 • proc_bind
ression evaluated to false, and the previous constraints are already met, the task is executed 10 immediately after generation of the task. 11 A program that relies on any other assumption about task scheduling is non-conforming. 12 13 Note – Task scheduling points dynamically divide task regions into parts. Each part is executed 14 uninterrupted from start to end. Different parts of the same task region are executed in the order in 15 which they are encountered. In the absence of task synchronization constructs, the order in which a 16 thread executes parts of different schedulable tasks is unspecified. 17 A program must behave correctly and consistently with all conceivable scheduling sequences that 18 are compatible with the rules above. 19 For example, if threadprivate storage is accessed (explicitly in the source code or implicitly 20 in calls to library routines) in one part of a task region, its value cannot be assumed to be preserved 21 into the next part of the same task region if another schedulable ta
opriate, 16 codeptr_ra may be NULL. 17 Cross References 18 • ompt_data_t, see Section 19.4.4.4 19 • flush directive, see Section 15.8.5 20 19.5.2.18 ompt_callback_cancel_t 21 Summary 22 The ompt_callback_cancel_t type is used for callbacks that are dispatched for cancellation, 23 cancel and discarded-task events. 24 Format 25 C / C++ typedef void (*ompt_callback_cancel_t) ( 26 ompt_data_t *task_data, 27 int flags, 28 const void *codeptr_ra 29 ); 30 C / C++ CHAPTER 19. OMPT INTERFACE 493 Trace Record 1 C / C++ typedef struct ompt_record_cancel_t { 2 ompt_id_t task_id; 3 int flags; 4 const void *codeptr_ra; 5 } ompt_record_cancel_t; 6 C / C++ Description of Arguments 7 The binding of the task_data argument is the task that encounters a cancel construct, a 8 cancellation point construct, or a construct defined as having an implicit cancellation 9 point. 10 The flags argument, defined by the ompt_cancel_flag_t enumeration type, indicates whether 11 cancellation is activated by the current task or detected as being act
cs 13 The full clause specifies that the associated loop is fully unrolled. The construct is replaced by a 14 structured block that only contains n instances of its loop body, one for each of the n logical 15 iterations of the associated loop and in their logical iteration order. 16 Restrictions 17 Restrictions to the full clause are as follows: 18 • The iteration count of the associated loop must be a compile-time constant. 19 Cross References 20 • unroll directive, see Section 9.2 21 9.2.2 partial Clause 22 Name: partial Properties: unique 23 Arguments 24 Name Type Properties unroll-factor expression of integer type optional, constant, posi- tive 25 Directives 26 unroll 27 CHAPTER 9. LOOP TRANSFORMATION CONSTRUCTS 221 Semantics 1 The partial clause specifies that the associated loop is first tiled with a tile size of unroll-factor. 2 Then, the generated tile loop is fully unrolled. If the partial clause is used without an 3 unroll-factor argument then the unroll factor is a positive integer that is implementat
. . . . . 540 20.2 Activating a Third-Party Tool . . . . . . . . . . . . . . . . . . . . . . . . . . 540 20.2.1 Enabling Runtime Support for OMPD . . . . . . . . . . . . . . . . . . . . . 540 20.2.2 ompd_dll_locations . . . . . . . . . . . . . . . . . . . . . . . . . . 540 20.2.3 ompd_dll_locations_valid . . . . . . . . . . . . . . . . . . . . . . 541 20.3 OMPD Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542 20.3.1 Size Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542 20.3.2 Wait ID Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542 20.3.3 Basic Value Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542 20.3.4 Address Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543 20.3.5 Frame Information Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543 20.3.6 System Device Identifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . 544 20.3.7 Native Thread Identifiers
.1 8 • teams directive, see Section 10.2 9 21.6.2 OMP_TEAMS_THREAD_LIMIT 10 The OMP_TEAMS_THREAD_LIMIT environment variable sets the maximum number of OpenMP 11 threads to use in each contention group created by a teams construct by setting the 12 teams-thread-limit-var ICV. The value of this environment variable must be a positive integer. The 13 behavior of the program is implementation defined if the requested value of 14 OMP_TEAMS_THREAD_LIMIT is greater than the number of threads that an implementation can 15 support, or if the value is not a positive integer. 16 Cross References 17 • teams directive, see Section 10.2 18 • teams-thread-limit-var ICV, see Table 2.1 19 21.7 OMP_DISPLAY_ENV 20 The OMP_DISPLAY_ENV environment variable instructs the runtime to display the information as 21 described in the omp_display_env routine section (Section 18.15). The value of the 22 OMP_DISPLAY_ENV environment variable may be set to one of these values: 23 true | false | verbose 24 If the environment variable is set to
e current team. The binding region of the 12 cancel region is the innermost enclosing region of the type that corresponds to 13 cancel-directive-name. 14 Semantics 15 The cancel construct activates cancellation of the innermost enclosing region of the type 16 specified by cancel-directive-name, which must be the directive-name of a cancellable construct. 17 Cancellation of the binding region is activated only if the cancel-var ICV is true, in which case the 18 cancel construct causes the encountering task to continue execution at the end of the binding 19 region if cancel-directive-name is not taskgroup. If the cancel-var ICV is true and 20 cancel-directive-name is taskgroup, the encountering task continues execution at the end of the 21 current task region. If the cancel-var ICV is false, the cancel construct is ignored. 22 Threads check for active cancellation only at cancellation points that are implied at the following 23 locations: 24 • cancel regions; 25 • cancellation point regions; 26 • barrier regions
fies a wait on completion of the taskgroup set associated with the 2 taskgroup region. When a thread encounters a taskgroup construct, it starts executing the 3 region. 4 An implicit task scheduling point occurs at the end of the taskgroup region. The current task is 5 suspended at the task scheduling point until all tasks in the taskgroup set complete execution. 6 Execution Model Events 7 The taskgroup-begin event occurs in each thread that encounters the taskgroup construct on 8 entry to the taskgroup region. 9 The taskgroup-wait-begin event occurs when a task begins an interval of active or passive waiting 10 in a taskgroup region. 11 The taskgroup-wait-end event occurs when a task ends an interval of active or passive waiting and 12 resumes execution in a taskgroup region. 13 The taskgroup-end event occurs in each thread that encounters the taskgroup construct after the 14 taskgroup synchronization on exit from the taskgroup region. 15 Tool Callbacks 16 A thread dispatches a registered ompt_callback_sync_r
loop transformation construct that appears inside a loop nest is replaced according to its 22 semantics before any loop can be associated with a loop-associated directive that is applied to the 23 loop nest. The depth of the loop nest is determined according to the loops in the loop nest, after any 24 such replacements have taken place. A loop counts towards the depth of the loop nest if it is a base 25 language loop statement or generated loop and it matches loop-nest while applying the production 26 rules for canonical loop nest form to the loop nest. 27 The canonical loop nest form allows the iteration count of all associated loops to be computed 28 before executing the outermost loop. 29 For any associated loop, the iteration count is computed as follows: 30 CHAPTER 4. BASE LANGUAGE FORMATS AND RESTRICTIONS 91 C / C++ • If var has a signed integer type and the var operand of test-expr after usual arithmetic 1 conversions has an unsigned integer type then the loop iteration count is computed from lb, 2 te
17 implementation-specific one. For the schedule kinds static, dynamic, and guided, the 18 chunk_size is set to the value of the second argument, or to the default chunk_size if the value of the 19 second argument is less than 1; for the schedule kind auto, the second argument has no meaning; 20 for implementation-specific schedule kinds, the values and associated meanings of the second 21 argument are implementation defined. 22 Each of the schedule kinds can be combined with the omp_sched_monotonic modifier by 23 using the + or | operators in C/C++ or the + operator in Fortran. If the schedule kind is combined 24 with the omp_sched_monotonic modifier, the schedule is modified as if the monotonic 25 schedule modifier was specified. Otherwise, the schedule modifier is nonmonotonic. 26 Cross References 27 • run-sched-var ICV, see Table 2.1 28 18.2.12 omp_get_schedule 29 Summary 30 The omp_get_schedule routine returns the schedule that is applied when the runtime schedule 31 is used. 32 Format 33 C / C++ void omp_get_sch
askloop-chunk-begin event in that thread. 11 The callback binds to the explicit task executing the iterations. The callback has type signature 12 ompt_callback_dispatch_t. 13 Restrictions 14 Restrictions to the taskloop construct are as follows: 15 • The reduction-modifier must be default. 16 • The conditional lastprivate-modifier must not be specified. 17 Cross References 18 • Canonical Loop Nest Form, see Section 4.4.1 19 • ompt_callback_dispatch_t, see Section 19.5.2.6 20 • ompt_callback_work_t, see Section 19.5.2.5 21 • ompt_scope_endpoint_t, see Section 19.4.4.11 22 • ompt_work_t, see Section 19.4.4.16 23 • allocate clause, see Section 6.6 24 • collapse clause, see Section 4.4.3 25 • default clause, see Section 5.4.1 26 • final clause, see Section 12.3 27 • firstprivate clause, see Section 5.4.4 28 • grainsize clause, see Section 12.6.1 29 • if clause, see Section 3.4 30 • in_reduction clause, see Section 5.5.10 31 • lastprivate clause, see Section 5.4.5 32 • mergeable clause, see Section 12.2 33 268 OpenMP
ection 19.6.2.6 11 • ompt_stop_trace_t, see Section 19.6.2.9 12 • ompt_translate_time_t, see Section 19.6.2.3 13 19.3 Finalizing a First-Party Tool 14 If the OMPT interface state is active, the tool finalizer, which has type signature 15 ompt_finalize_t and is specified by the finalize field in the 16 ompt_start_tool_result_t structure returned from the ompt_start_tool function, is 17 called when the OpenMP implementation shuts down. 18 Cross References 19 • ompt_finalize_t, see Section 19.5.1.2 20 19.4 OMPT Data Types 21 The C/C++ header file (omp-tools.h) provides the definitions of the types that are specified 22 throughout this subsection. 23 19.4.1 Tool Initialization and Finalization 24 Summary 25 A tool’s implementation of ompt_start_tool returns a pointer to an 26 ompt_start_tool_result_t structure, which contains pointers to the tool’s initialization 27 and finalization callbacks as well as an ompt_data_t object for use by the tool. 28 CHAPTER 19. OMPT INTERFACE 451 Format 1 C / C++ typedef struct ompt_start
• use clause, see Section 14.1.3 35 292 OpenMP API – Version 5.2 November 2021 14.1.1 OpenMP Foreign Runtime Identifiers 1 An OpenMP foreign runtime identifier, foreign-runtime-id, is a base language string literal or a 2 compile-time constant OpenMP integer expression. Allowed values for foreign-runtime-id include 3 the names (as string literals) and integer values that the OpenMP Additional Definitions document 4 specifies and the corresponding omp_ifr_name constants of OpenMP interop_fr type. 5 Implementation-defined values for foreign-runtime-id may also be supported. 6 14.1.2 init Clause 7 Name: init Properties: default 8 Arguments 9 Name Type Properties interop-var variable of omp_interop_t type default 10 Modifiers 11 Name Modifies Type Properties interop-preference Generic Complex, name: prefer_type Arguments: preference_list OpenMP foreign runtime preference list (default) complex, unique interop-type Generic Keyword: target, targetsync repeatable, re- quired 12 Directives 13 interop 14 Semantics 15 The in
ked region. 7 • A barrier region may not be closely nested inside a worksharing, task, taskloop, 8 critical, ordered, atomic, or masked region. 9 • A masked region may not be closely nested inside a worksharing, atomic, task, or 10 taskloop region. 11 • An ordered region that corresponds to an ordered construct without any clause or with the 12 threads or depend clause may not be closely nested inside a critical, ordered, loop, 13 atomic, task, or taskloop region. 14 • An ordered region that corresponds to an ordered construct without the simd clause 15 specified must be closely nested inside a worksharing-loop region. 16 • An ordered region that corresponds to an ordered construct with the simd clause specified 17 must be closely nested inside a simd or worksharing-loop SIMD region. 18 • An ordered region that corresponds to an ordered construct with both the simd and 19 threads clauses must be closely nested inside a worksharing-loop SIMD region or closely 20 nested inside a worksharing-loop and simd region.
e equivalent (the first line represents the position of the first 9 columns): 15 c23456789 16 !$ 10 iam = omp_get_thread_num() + 17 !$ & index 18 19 #ifdef _OPENMP 20 10 iam = omp_get_thread_num() + 21 & index 22 #endif 23 24 25 Fortran 70 OpenMP API – Version 5.2 November 2021 Fortran 3.3.2 Free Source Form Conditional Compilation Sentinel 1 The following conditional compilation sentinel is recognized in free form source files: 2 !$ 3 To enable conditional compilation, a line with a conditional compilation sentinel must satisfy the 4 following criteria: 5 • The sentinel can appear in any column but must be preceded only by white space; 6 • The sentinel must appear as a single word with no intervening white space; 7 • Initial lines must have a blank character after the sentinel; and 8 • Continued lines must have an ampersand as the last non-blank character on the line, prior to any 9 comment appearing on the conditionally compiled line. 10 Continuation lines can have an ampersand after the sentinel, with optiona
nt and the if clause expression 16 evaluates to false. 17 The teams construct creates a league of teams, where each team is an initial team that comprises 18 an initial thread that executes the teams region. Each initial thread executes sequentially, as if the 19 code encountered is part of an initial task region that is generated by an implicit parallel region 20 associated with each team. Whether the initial threads concurrently execute the teams region is 21 unspecified, and a program that relies on their concurrent execution for the purposes of 22 synchronization may deadlock. 23 If a construct creates a data environment, the data environment is created at the time the construct is 24 encountered. The description of a construct defines whether it creates a data environment. 25 When any thread encounters a parallel construct, the thread creates a team of itself and zero or 26 more additional threads and becomes the primary thread of the new team. A set of implicit tasks, 27 one per thread, is generated. The
a reduction-scoping or lastprivate clause, the final values of 1 the list items that appeared in those clauses are undefined. 2 When an if clause is present on a cancel construct and the if expression evaluates to false, the 3 cancel construct does not activate cancellation. The cancellation point associated with the 4 cancel construct is always encountered regardless of the value of the if expression. 5 6 Note – The programmer is responsible for releasing locks and other synchronization data 7 structures that might cause a deadlock when a cancel construct is encountered and blocked 8 threads cannot be canceled. The programmer is also responsible for ensuring proper 9 synchronizations to avoid deadlocks that might arise from cancellation of OpenMP regions that 10 contain OpenMP synchronization constructs. 11 12 Execution Model Events 13 If a task encounters a cancel construct that will activate cancellation then a cancel event occurs. 14 A discarded-task event occurs for any discarded tasks. 15 Tool Callbacks
thread as its parent 5 thread with respect to any resources associated with an OpenMP thread. 6 child thread When a thread encounters a parallel construct, each of the threads in the 7 generated parallel region’s team are child threads of the encountering thread. 8 The target or teams region’s initial thread is not a child thread of the thread that 9 encountered the target or teams construct. 10 ancestor thread For a given thread, its parent thread or one of its parent thread’s ancestor threads. 11 descendent thread For a given thread, one of its child threads or one of its child threads’ descendent 12 threads. 13 team A set of one or more threads participating in the execution of a parallel region. 14 COMMENTS: 15 For an active parallel region, the team comprises the primary thread and 16 at least one additional thread. 17 For an inactive parallel region, the team comprises only the primary 18 thread. 19 league The set of teams created by a teams construct. 20 contention group An initial thread and its desc
T: An array is a containing array of itself. For the array section 14 (*p0).x0[k1].p1->p2[k2].x1[k3].x2[4][0:n], where identifiers pi have a 15 pointer type declaration and identifiers xi have an array type declaration, 16 the containing arrays are: (*p0).x0[k1].p1->p2[k2].x1 and 17 (*p0).x0[k1].p1->p2[k2].x1[k3].x2. 18 containing structure For C/C++, a structure to which a series of zero or more . (dot) operators and/or 19 array subscript operators are applied to yield a given lvalue expression or array 20 section for which storage is contained by the structure. 21 For Fortran, a structure to which a series of zero or more component selectors and/or 22 array subscript selectors are applied to yield a given variable or array section for 23 which storage is contained by the structure. 24 COMMENT: A structure is a containing structure of itself. For C/C++, a 25 structure pointer p to which the -> operator applies is equivalent to the 26 application of a . (dot) operator to (*p) for the purposes of determining 27
or more blanks or horizontal tabs are optional to separate adjacent keywords in 1 directive-names unless otherwise specified. 2 3 Note – In the following example the three formats for specifying the directive are equivalent (the 4 first line represents the position of the first 9 columns): 5 !23456789 6 !$omp parallel do & 7 !$omp shared(a,b,c) 8 9 !$omp parallel & 10 !$omp&do shared(a,b,c) 11 12 !$omp paralleldo shared(a,b,c) 13 14 Fortran 3.2 Clause Format 15 This section defines the format and categories of OpenMP clauses. OpenMP clauses are specified 16 as part of a directive-specification. Clauses are optional and, thus, may be omitted from a 17 directive-specification unless otherwise specified. The order in which clauses appear on directives 18 is not significant unless otherwise specified. A clause-specification specifies each OpenMP clause 19 in a directive-specification where clause-specification for inarguable clauses is simply: 20 clause-name 21 Inarguable clauses often form natural groupings that have similar
OpenMP Application Programming Interface Version 5.2 November 2021 Copyright c⃝1997-2021 OpenMP Architecture Review Board. Permission to copy without fee all or part of this material is granted, provided the OpenMP Architecture Review Board copyright notice and the title of this document appear. Notice is given that copying is by permission of the OpenMP Architecture Review Board. This page intentionally left blank in published version. Contents 1 Overview of the OpenMP API 1 1.1 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.2.1 Threading Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.2.2 OpenMP Language Terminology . . . . . . . . . . . . . . . . . . . . . . . 2 1.2.3 Loop Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.2.4 Synchronization Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 10 1.2.5 Tasking Termino
. . . . . . 301 15.3.1 barrier Construct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 15.3.2 Implicit Barriers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303 15.3.3 Implementation-Specific Barriers . . . . . . . . . . . . . . . . . . . . . . . 304 15.4 taskgroup Construct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304 15.5 taskwait Construct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306 15.6 nowait Clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 15.7 nogroup Clause . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309 15.8 OpenMP Memory Ordering . . . . . . . . . . . . . . . . . . . . . . . . . . . 309 15.8.1 memory-order Clauses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309 15.8.2 atomic Clauses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 15.8.3 extended-atomic Clauses . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 15.8.4 atomic Construct
d ICV of the device with the corresponding device 21 number. If the corresponding environment variable that includes the _DEV suffix but no device 22 number is set, then the setting of that environment variable is used to set the value of the associated 23 ICV of any non-host device for which the device-number-specific corresponding environment 24 variable is not set. In all cases the setting of an environment variable for which a device number is 25 specified takes precedence. 26 Restrictions 27 Restrictions to device-specific environment variables are as follows: 28 • Device-specific environment variables must not correspond to environment variables that 29 initialize ICVs with global scope. 30 599 21.1 Parallel Region Environment Variables 1 This section defines environment variables that affect the operation of parallel regions. 2 21.1.1 OMP_DYNAMIC 3 The OMP_DYNAMIC environment variable controls dynamic adjustment of the number of threads 4 to use for executing parallel regions by setting the initial value of th
11 omp_ifr_name, where name is the name of the foreign runtime environment. Available names 12 include those that are listed in the OpenMP Additional Definitions document; 13 implementation-defined names may also be supported. The value of omp_ifr_last is defined as 14 one greater than the value of the highest supported foreign-runtime-id value that is listed in the 15 aforementioned document. 16 Cross References 17 • Interoperability Routines, see Section 18.12 18 14.1 interop Construct 19 Name: interop Association: none Category: executable Properties: device 20 Clauses 21 depend, destroy, device, init, nowait, use 22 Clause set action-clause 23 Properties: required Members: destroy, init, use 24 CHAPTER 14. INTEROPERABILITY 291 Binding 1 The binding task set for an interop region is the generating task. The interop region binds to 2 the region of the generating task. 3 Semantics 4 The interop construct retrieves interoperability properties from the OpenMP implementation to 5 enable interoperability with fore
etadirective. 21 Restrictions 22 Restrictions to metadirectives are as follows: 23 • Replacement of the metadirective with the directive variant associated with any of the dynamic 24 replacement candidates must result in a conforming OpenMP program. 25 • Insertion of user code at the location of a metadirective must be allowed if the first dynamic 26 replacement candidate does not have a static context selector. 27 • All items must be executable directives if the first dynamic replacement candidate does not have 28 a static context selector. 29 Fortran • A metadirective that appears in the specification part of a subprogram must follow all 30 variant-generating declarative directives that appear in the same specification part. 31 • All directive variants of a metadirective must be pure otherwise the metadirective is not pure. 32 Fortran CHAPTER 7. VARIANT DIRECTIVES 189 7.4.1 when Clause 1 Name: when Properties: default 2 Arguments 3 Name Type Properties directive-variant directive-specification optional, unique 4
es that a directive accepts may form sets. These sets may imply restrictions on their use 22 on that directive or may otherwise capture properties for the clauses on the directive. While specific 23 properties may be defined for a clause set on a particular directive, the following clause-set 24 properties have general meanings and implications as indicated by the restrictions below: required, 25 unique, and exclusive. 26 58 OpenMP API – Version 5.2 November 2021 All clauses that are specified as a clause grouping form a clause set for which properties are 1 specified with the specification of the grouping. Some directives accept a clause grouping for which 2 each member is a directive-name of a directive that has a specific property. These groupings are 3 required, unique and exclusive unless otherwise specified. 4 Restrictions 5 Restrictions to clauses and clause sets are as follows: 6 • A required clause for a directive must appear on the directive. 7 • A unique clause for a directive may appear at most once on t
ch callback for each occurrence of a 19 distribute-chunk-begin event in that thread. The callback occurs in the context of the initial task. 20 The callback has type signature ompt_callback_dispatch_t. 21 Restrictions 22 Restrictions to the distribute construct are as follows: 23 • The logical iteration space of the loops associated with the distribute construct must be the 24 same for all teams in the league. 25 • The region that corresponds to the distribute construct must be strictly nested inside a 26 teams region. 27 • A list item may appear in a firstprivate or lastprivate clause, but not in both. 28 • The conditional lastprivate-modifier must not be specified. 29 Cross References 30 • Consistent Loop Schedules, see Section 4.4.5 31 • ompt_callback_work_t, see Section 19.5.2.5 32 • ompt_work_t, see Section 19.4.4.16 33 • allocate clause, see Section 6.6 34 • collapse clause, see Section 4.4.3 35 • dist_schedule clause, see Section 11.6.1 36 CHAPTER 11. WORK-DISTRIBUTION CONSTRUCTS 255 • firstprivate claus
. . . . . . . . . . . . 607 21.2.5 OMP_AFFINITY_FORMAT . . . . . . . . . . . . . . . . . . . . . . . . . . 608 21.2.6 OMP_CANCELLATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . 610 21.2.7 OMP_DEFAULT_DEVICE . . . . . . . . . . . . . . . . . . . . . . . . . . 610 21.2.8 OMP_TARGET_OFFLOAD . . . . . . . . . . . . . . . . . . . . . . . . . . 610 xiv OpenMP API – Version 5.2 November 2021 21.2.9 OMP_MAX_TASK_PRIORITY . . . . . . . . . . . . . . . . . . . . . . . . 611 21.3 OMPT Environment Variables . . . . . . . . . . . . . . . . . . . . . . . . . . 611 21.3.1 OMP_TOOL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611 21.3.2 OMP_TOOL_LIBRARIES . . . . . . . . . . . . . . . . . . . . . . . . . . 612 21.3.3 OMP_TOOL_VERBOSE_INIT . . . . . . . . . . . . . . . . . . . . . . . . 612 21.4 OMPD Environment Variables . . . . . . . . . . . . . . . . . . . . . . . . . . 613 21.4.1 OMP_DEBUG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 613 21.5 Memory Allocation En
is set to true, the thread affinity policy is implementation defined but 26 must conform to the previous paragraph. The behavior of the program is implementation defined if 27 the value in the OMP_PROC_BIND environment variable is not true, false, or a comma 28 604 OpenMP API – Version 5.2 November 2021 separated list of primary, master (master has been deprecated), close, or spread. The 1 behavior is also implementation defined if an initial thread cannot be bound to the first place in the 2 place-partition-var ICV. 3 The OMP_PROC_BIND environment variable sets the max-active-levels-var ICV to the number of 4 active levels of parallelism that the implementation supports if the OMP_PROC_BIND environment 5 variable is set to a comma-separated list of more than one element. The value of the 6 max-active-level-var ICV may be overridden by setting OMP_MAX_ACTIVE_LEVELS or 7 OMP_NESTED. See Section 21.1.4 and Section 21.1.5 for details. 8 Examples: 9 setenv OMP_PROC_BIND false 10 setenv OMP_PROC_BIND "spread, spread, cl
allback_nest_lock_t, see Section 19.5.2.16 18 18.10 Timing Routines 19 This section describes routines that support a portable wall clock timer. 20 18.10.1 omp_get_wtime 21 Summary 22 The omp_get_wtime routine returns elapsed wall clock time in seconds. 23 Format 24 C / C++ double omp_get_wtime(void); 25 C / C++ Fortran double precision function omp_get_wtime() 26 Fortran Binding 27 The binding thread set for an omp_get_wtime region is the encountering thread. The routine’s 28 return value is not guaranteed to be consistent across any set of threads. 29 CHAPTER 18. RUNTIME LIBRARY ROUTINES 413 Effect 1 The omp_get_wtime routine returns a value equal to the elapsed wall clock time in seconds 2 since some time-in-the-past. The actual time-in-the-past is arbitrary, but it is guaranteed not to 3 change during the execution of the application program. The time returned is a per-thread time, so 4 it is not required to be globally consistent across all threads that participate in an application. 5 18.10.2 omp_get_wt
for fixed source form Fortran to accommodate character 4 position requirements (see Section 3.1.1). Reserved clause names that begin with the ompx_ 5 prefix for implementation-defined clauses on OpenMP directives (see Section 3.2). Reserved 6 names in the base language that start with the omp_ and ompx_ prefix and reserved the omp and 7 ompx namespaces (see Chapter 4) for the OpenMP runtime API and for implementation-defined 8 extensions to that API (see Chapter 18). 9 • Allowed any clause that can be specified on a paired end directive to be specified on the 10 directive (see Section 3.1), including the copyprivate clause (see Section 5.7.2) and the 11 nowait clause in Fortran (see Section 15.6). 12 • For consistency with the syntax of other definitions of the clause, the syntax of the destroy 13 clause on the depobj construct with no argument was deprecated (see Section 3.5). 14 • For consistency with the syntax of other clauses, the syntax of the linear clause that specifies 15 its argument and linear-modifier as li
30 • Cross-iteration dependences across different logical iterations must not exist, except for 31 dependences for the list items specified in an inclusive or exclusive clause. 32 • Intra-iteration dependences from a statement in the structured block sequence that precede a 33 scan directive to a statement in the structured block sequence that follows a scan directive 34 must not exist, except for dependences for the list items specified in an inclusive or 35 exclusive clause. 36 • The private copy of list items that appear in the inclusive or exclusive clause must not be 37 modified in the scan phase. 38 142 OpenMP API – Version 5.2 November 2021 Cross References 1 • do directive, see Section 11.5.2 2 • exclusive clause, see Section 5.6.2 3 • for directive, see Section 11.5.1 4 • inclusive clause, see Section 5.6.1 5 • reduction clause, see Section 5.5.8 6 • simd directive, see Section 10.4 7 5.6.1 inclusive Clause 8 Name: inclusive Properties: unique 9 Arguments 10 Name Type Properties list list of variable lis
ffect of the map clauses on a construct would assign the value of a corresponding list item to 12 an original list item more than once, then an implementation is allowed to ignore additional 13 assignments of the same value to the original list item. 14 In all cases on exit from the region, concurrent reads or updates of any part of the original list item 15 must be synchronized with any update of the original list item that occurs as a result of the map 16 clause to avoid data races. 17 If a single contiguous part of the original storage of a list item with an implicit data-mapping 18 attribute has corresponding storage in the device data environment prior to a task encountering the 19 construct on which the map clause appears, only that part of the original storage will have 20 corresponding storage in the device data environment as a result of the map clause. 21 If a list item with an implicit data-mapping attribute does not have any corresponding storage in the 22 device data environment prior to a task en
not be encountered during execution of a target region. 23 • The result of an omp_set_default_device, omp_get_default_device, or 24 omp_get_num_devices routine called within a target region is unspecified. 25 • The effect of an access to a threadprivate variable in a target region is unspecified. 26 • If a list item in a map clause is a structure element, any other element of that structure that is 27 referenced in the target construct must also appear as a list item in a map clause. 28 • A list item in a data-sharing attribute clause that is specified on a target construct must not 29 have the same base variable as a list item in a map clause on the construct. 30 • A variable referenced in a target region but not the target construct that is not declared in 31 the target region must appear in a declare target directive. 32 • A map-type in a map clause must be to, from, tofrom or alloc. 33 • If a device clause is specified with the ancestor device-modifier, only the device, 34 firstprivate, private, defaultmap, and
tine are as follows. 2 • Freeing the storage returned by omp_target_alloc with any routine other than 3 omp_target_free results in unspecified behavior. 4 • When called from within a target region the effect is unspecified. 5 C / C++ • Unless the unified_address clause appears on a requires directive in the compilation 6 unit, pointer arithmetic is not supported on the device pointer returned by 7 omp_target_alloc. 8 C / C++ Cross References 9 • omp_target_free, see Section 18.8.2 10 • ompt_callback_target_data_op_emi_t and 11 ompt_callback_target_data_op_t, see Section 19.5.2.25 12 • is_device_ptr clause, see Section 5.4.7 13 • target directive, see Section 13.8 14 18.8.2 omp_target_free 15 Summary 16 The omp_target_free routine frees the device memory allocated by the 17 omp_target_alloc routine. 18 Format 19 C / C++ void omp_target_free(void *device_ptr, int device_num); 20 C / C++ Fortran subroutine omp_target_free(device_ptr, device_num) bind(c) 21 use, intrinsic :: iso_c_binding, only : c_ptr, c_int 22 typ
n, OpenMP mapper identifiers specify the name of a user-defined mapper, and 14 OpenMP foreign runtime identifiers specify the name of a foreign runtime. 15 Generic OpenMP types specify the type of expression or variable that is used in OpenMP contexts 16 regardless of the base language. These types support the definition of many important OpenMP 17 concepts independently of the base language in which they are used. 18 The assignable OpenMP type instance is defined to facilitate base language neutrality. An 19 assignable OpenMP type instance can be used as an argument of an OpenMP construct in order for 20 the implementation to modify the value of that instance. 21 C / C++ An assignable OpenMP type instance is an lvalue expression of that OpenMP type. 22 C / C++ Fortran An assignable OpenMP type instance is a variable of that OpenMP type. 23 Fortran 74 OpenMP API – Version 5.2 November 2021 The OpenMP logical type supports logical variables and expressions in any base language. 1 C / C++ Any OpenMP logical expressi
_callback_thread_begin callback for the 13 initial-thread-begin event in an initial thread. The callback occurs in the context of the initial 14 thread. The callback has type signature ompt_callback_thread_begin_t. The callback 15 receives ompt_thread_initial as its thread_type argument. 16 A thread dispatches a registered ompt_callback_implicit_task callback with 17 ompt_scope_begin as its endpoint argument for each occurrence of an initial-task-begin event 18 in that thread. Similarly, a thread dispatches a registered ompt_callback_implicit_task 19 callback with ompt_scope_end as its endpoint argument for each occurrence of an 20 initial-task-end event in that thread. The callbacks occur in the context of the initial task and have 21 type signature ompt_callback_implicit_task_t. In the dispatched callback, 22 (flag & ompt_task_initial) always evaluates to true. 23 A thread dispatches a registered ompt_callback_thread_end callback for the 24 initial-thread-end event in that thread. The callback occurs in the
a corresponding list of their respective sizes. 7 Format 8 C ompd_rc_t ompd_get_device_thread_id_kinds( 9 ompd_address_space_handle_t *device_handle, 10 ompd_thread_id_t **kinds, 11 ompd_size_t **thread_id_sizes, 12 int *count 13 ); 14 C Semantics 15 The ompd_get_device_thread_id_kinds function returns an array of supported native 16 thread identifier kinds and a corresponding array of their respective sizes for a given device. The 17 OMPD library allocates storage for the arrays with the memory allocation callback that the tool 18 provides. Each supported native thread identifier kind is guaranteed to be recognizable by the 19 OMPD library and may be mapped to and from any OpenMP thread that executes on the device. 20 The third-party tool owns the storage for the array of kinds and the array of sizes that is returned via 21 the kinds and thread_id_sizes arguments, and it is responsible for freeing that storage. 22 Description of Arguments 23 The device_handle argument is a pointer to an opaque address space h
hes a registered ompt_callback_implicit_task callback with 1 ompt_scope_begin as its endpoint argument for each occurrence of an implicit-task-begin 2 event in that thread. Similarly, a thread dispatches a registered 3 ompt_callback_implicit_task callback with ompt_scope_end as its endpoint 4 argument for each occurrence of an implicit-task-end event in that thread. The callbacks occur in 5 the context of the implicit task and have type signature ompt_callback_implicit_task_t. 6 In the dispatched callback, (flags & ompt_task_implicit) evaluates to true. 7 A thread dispatches a registered ompt_callback_parallel_end callback for each 8 occurrence of a parallel-end event in that thread. The callback occurs in the task that encounters 9 the parallel construct. This callback has the type signature 10 ompt_callback_parallel_end_t. 11 A thread dispatches a registered ompt_callback_thread_begin callback for the 12 native-thread-begin event in that thread. The callback occurs in the context of the thread. The 13 callba
emi_t and 21 ompt_callback_target_data_op_t 22 Summary 23 The ompt_callback_target_data_op_emi_t and 24 ompt_callback_target_data_op_t types are used for callbacks that are dispatched when 25 a thread maps data to a device. 26 Format 27 C / C++ typedef void (*ompt_callback_target_data_op_emi_t) ( 28 ompt_scope_endpoint_t endpoint, 29 ompt_data_t *target_task_data, 30 ompt_data_t *target_data, 31 ompt_id_t *host_op_id, 32 ompt_target_data_op_t optype, 33 void *src_addr, 34 int src_device_num, 35 CHAPTER 19. OMPT INTERFACE 499 void *dest_addr, 1 int dest_device_num, 2 size_t bytes, 3 const void *codeptr_ra 4 ); 5 typedef void (*ompt_callback_target_data_op_t) ( 6 ompt_id_t target_id, 7 ompt_id_t host_op_id, 8 ompt_target_data_op_t optype, 9 void *src_addr, 10 int src_device_num, 11 void *dest_addr, 12 int dest_device_num, 13 size_t bytes, 14 const void *codeptr_ra 15 ); 16 C / C++ Trace Record 17 C / C++ typedef struct ompt_record_target_data_op_t { 18 ompt_id_t host_op_id; 19 ompt_target_data_op_t optype; 20 v
format that is used to 12 summarize native device trace records. 13 Format 14 C / C++ typedef struct ompt_record_abstract_t { 15 ompt_record_native_t rclass; 16 const char *type; 17 ompt_device_time_t start_time; 18 ompt_device_time_t end_time; 19 ompt_hwid_t hwid; 20 } ompt_record_abstract_t; 21 C / C++ Semantics 22 An ompt_record_abstract_t record contains information that a tool can use to process a 23 native record that it may not fully understand. The rclass field indicates that the record is 24 informational or that it represents an event; this information can help a tool determine how to 25 present the record. The record type field points to a statically-allocated, immutable character string 26 that provides a meaningful name that a tool can use to describe the event to a user. The start_time 27 and end_time fields are used to place an event in time. The times are relative to the device clock. If 28 an event does not have an associated start_time (end_time), the value of the start_time (end_time) 29 field
; 27 332 • at the end of a worksharing-loop construct with a nowait clause and for which the same list 1 item appears in both firstprivate and lastprivate clauses; and 2 • implicit barrier regions. 3 When a thread reaches one of the above cancellation points and if the cancel-var ICV is true, then: 4 • If the thread is at a cancel or cancellation point region and cancel-directive-name is 5 not taskgroup, the thread continues execution at the end of the canceled region if cancellation 6 has been activated for the innermost enclosing region of the type specified. 7 • If the thread is at a cancel or cancellation point region and cancel-directive-name is 8 taskgroup, the encountering task checks for active cancellation of all of the taskgroup sets to 9 which the encountering task belongs, and continues execution at the end of the current task 10 region if cancellation has been activated for any of the taskgroup sets. 11 • If the encountering task is at a barrier region or at the end of a worksharing-loop construct
ive. 28 198 OpenMP API – Version 5.2 November 2021 If a declare variant directive appears between a begin declare variant directive and its 1 paired end directive, the effective context selectors of the outer directive are appended to the 2 context selector of the inner directive to form the effective context selector of the inner directive. If 3 a trait-set-selector is present on both directives, the trait-selector list of the outer directive is 4 appended to the trait-selector list of the inner directive after equivalent trait-selectors have been 5 removed from the outer list. Restrictions that apply to explicitly specified context selectors also 6 apply to effective context selectors constructed through this process. 7 The symbol name of a function definition that appears between a begin declare variant 8 directive and its paired end directive is determined through the base language rules after the name 9 of the function has been augmented with a string that is determined according to the effective 10 context se
ding to a parallel construct or a task region 26 corresponding to a task construct. 27 COMMENTS: 28 A sequential part is enclosed by an implicit parallel region. 29 Executable statements in called routines may be in both a sequential part 30 and any number of explicit parallel regions at different points in the 31 program execution. 32 primary thread An OpenMP thread that has thread number 0. A primary thread may be an initial 33 thread or the thread that encounters a parallel construct, creates a team, 34 generates a set of implicit tasks, and then executes one of those tasks as thread 35 number 0. 36 CHAPTER 1. OVERVIEW OF THE OPENMP API 5 worker thread An OpenMP thread that is not the primary thread of a team and that executes one of 1 the implicit tasks of a parallel region. 2 parent thread The thread that encountered the parallel construct and generated a parallel 3 region is the parent thread of each of the threads in the team of that parallel 4 region. The primary thread of a parallel region is the same
Arguments 10 Name Type Properties list list of variable list item type default 11 Directives 12 dispatch, target 13 Semantics 14 The is_device_ptr clause indicates that its list items are device pointers. Support for device 15 pointers created outside of OpenMP, specifically outside of any OpenMP mechanism that returns a 16 device pointer, is implementation defined. 17 If the is_device_ptr clause is specified on a target construct, each list item privatized 18 inside the construct and the new list item is initialized to the device address to which the original 19 list item refers. 20 Fortran If the is_device_ptr clause is specified on a target construct, if any list item is not of type 21 C_PTR, the behavior is as if the list item appeared in a has_device_addr clause. Support for 22 such list items in an is_device_ptr clause is deprecated. 23 Fortran Restrictions 24 Restrictions to the is_device_ptr clause are as follows: 25 • Each list item must be a valid device pointer for the device data environment. 26 C •
er that uses OMPD should be able to 14 debug a 64-bit OpenMP program by loading a 32-bit OMPD implementation that can manage a 15 64-bit OpenMP runtime. 16 The ompd_dll_locations variable points to a NULL-terminated vector of zero or more 17 null-terminated pathname strings that do not have any filename conventions. This vector must be 18 fully initialized before ompd_dll_locations is set to a non-null value. Thus, if a third-party 19 tool, such as a debugger, stops execution of the OpenMP program at any point at which 20 ompd_dll_locations is non-null, the vector of strings to which it points shall be valid and 21 complete. 22 Cross References 23 • ompd_dll_locations_valid, see Section 20.2.3 24 20.2.3 ompd_dll_locations_valid 25 Summary 26 The OpenMP runtime notifies third-party tools that ompd_dll_locations is valid by allowing 27 execution to pass through a location that the symbol ompd_dll_locations_valid identifies. 28 Format 29 C void ompd_dll_locations_valid(void); 30 C Semantics 31 Since ompd_dll_locati
t, a colon (:) or an 25 asterisk (*). 26 • If a type with deferred or assumed length parameter is specified in a declare reduction 27 directive, no other declare reduction directive with the same type, the same kind 28 parameters and the same reduction-identifier is allowed in the same scope. 29 Fortran 140 OpenMP API – Version 5.2 November 2021 Cross References 1 • OpenMP Combiner Expressions, see Section 5.5.2.1 2 • OpenMP Initializer Expressions, see Section 5.5.2.2 3 • OpenMP Reduction Identifiers, see Section 5.5.1 4 • initializer clause, see Section 5.5.4 5 5.6 scan Directive 6 Name: scan Association: separating Category: subsidiary Properties: default 7 Separated directives 8 do, for, simd 9 Clauses 10 exclusive, inclusive 11 Clause set 12 Properties: unique, required, exclusive Members: exclusive, inclusive 13 Semantics 14 The scan directive separates the final-loop-body of an enclosing simd construct or 15 worksharing-loop construct (or a composite construct that combines them) into a structured block 16
vars argument is the vector of display control variables to be released. 6 Description of Return Codes 7 This routine must return any of the general return codes listed at the beginning of Section 20.5. 8 Cross References 9 • Return Code Types, see Section 20.3.12 10 • ompd_get_display_control_vars, see Section 20.5.9.1 11 20.5.10 Accessing Scope-Specific Information 12 20.5.10.1 ompd_enumerate_icvs 13 Summary 14 The ompd_enumerate_icvs function enumerates ICVs. 15 Format 16 C ompd_rc_t ompd_enumerate_icvs ( 17 ompd_address_space_handle_t *handle, 18 ompd_icv_id_t current, 19 ompd_icv_id_t *next_id, 20 const char **next_icv_name, 21 ompd_scope_t *next_scope, 22 int *more 23 ); 24 C Semantics 25 An OpenMP implementation must support all ICVs listed in Section 2.1. An OpenMP 26 implementation may support additional implementation-specific variables. An implementation may 27 store ICVs in a different scope than Table 2.1 indicates. The ompd_enumerate_icvs function 28 enables a tool to enumerate the ICVs that an Ope
libraries, separated by an implementation specific, platform typical separator. Whether the value of 5 this environment variable is case sensitive is implementation defined. 6 If the tool-var ICV is not enabled, the value of tool-libraries-var is ignored. Otherwise, if 7 ompt_start_tool is not visible in the address space on a device where OpenMP is being 8 initialized or if ompt_start_tool returns NULL, an OpenMP implementation will consider 9 libraries in the tool-libraries-var list in a left-to-right order. The OpenMP implementation will 10 search the list for a library that meets two criteria: it can be dynamically loaded on the current 11 device and it defines the symbol ompt_start_tool. If an OpenMP implementation finds a 12 suitable library, no further libraries in the list will be considered. 13 Example: 14 % setenv OMP_TOOL_LIBRARIES libtoolXY64.so:/usr/local/lib/ 15 libtoolXY32.so 16 Cross References 17 • OMPT Interface, see Chapter 19 18 • ompt_start_tool, see Section 19.2.1 19 • tool-libraries-var ICV
evices or both the host device and non-host devices. If 11 host is specified then only a host device version of the procedure or variable is made available. If 12 any is specified then both host device and non-host device versions of the procedure or variable are 13 made available. If nohost is specified for a procedure then only non-host device versions of the 14 procedure are made available. If nohost is specified for a variable then that variable is not 15 available on the host device. If the device_type clause is not specified, the behavior is as if the 16 device_type clause appears with any specified. 17 Cross References 18 • begin declare target directive, see Section 7.8.2 19 • declare target directive, see Section 7.8.1 20 275 13.2 device Clause 1 Name: device Properties: unique 2 Arguments 3 Name Type Properties device-description expression of integer type default 4 Modifiers 5 Name Modifies Type Properties device-modifier device-description Keyword: ancestor, device_num default 6 Directives 7 dispatch, inte
containing structures. 28 For the array section (*p0).x0[k1].p1->p2[k2].x1[k3].x2[4][0:n], where 29 identifiers pi have a pointer type declaration and identifiers xi have an 30 array type declaration, the containing structures are: *(*p0).x0[k1].p1, 31 (*(*p0).x0[k1].p1).p2[k2] and (*(*p0).x0[k1].p1).p2[k2].x1[k3] 32 base array For C/C++, a containing array of a given lvalue expression or array section that does 33 not appear in the expression of any of its other containing arrays. 34 For Fortran, a containing array of a given variable or array section that does not 35 appear in the designator of any of its other containing arrays. 36 COMMENT: For the array section 37 (*p0).x0[k1].p1->p2[k2].x1[k3].x2[4][0:n], where identifiers pi have a 38 CHAPTER 1. OVERVIEW OF THE OPENMP API 15 pointer type declaration and identifiers xi have an array type declaration, 1 the base array is: (*p0).x0[k1].p1->p2[k2].x1[k3].x2. 2 named array For C/C++, a containing array of a given lvalue expression or array section, or a 3 contai
ime API in its corresponding region, referred to as 12 intervening code. If intervening code is present, then a loop at the same depth within 13 the loop nest is not a perfectly nested loop. 14 C / C++ It must not contain iteration statements, continue statements or break statements 15 that apply to the enclosing loop. 16 C / C++ Fortran It must not contain loops, array expressions, CYCLE statements or EXIT statements. 17 Fortran final-loop-body A structured block that terminates the scope of loops in the loop nest. If the loop nest 18 is associated with a loop-associated directive, loops in this structured block cannot be 19 associated with that directive. 20 C / C++ init-expr One of the following: 21 var = lb 22 integer-type var = lb 23 CHAPTER 4. BASE LANGUAGE FORMATS AND RESTRICTIONS 87 C pointer-type var = lb 1 C C++ random-access-iterator-type var = lb 2 C++ test-expr One of the following: 3 var relational-op ub 4 ub relational-op var 5 relational-op One of the following: 6 < 7 <= 8 > 9 >= 10 != 11 incr-
ration or definition 11 enables the creation of corresponding SIMD versions of the associated function that can be used to 12 process multiple arguments from a single invocation in a SIMD loop concurrently. 13 If a SIMD version is created and the simdlen clause is not specified, the number of concurrent 14 arguments for the function is implementation defined. 15 For purposes of the linear clause, any integer-typed parameter that is specified in a uniform 16 clause on the directive is considered to be constant and so may be used in linear-step. 17 C / C++ The expressions that appear in the clauses of each directive are evaluated in the scope of the 18 arguments of the function declaration or definition. 19 C / C++ C++ The special this pointer can be used as if it was one of the arguments to the function in any of the 20 linear, aligned, or uniform clauses. 21 C++ Restrictions 22 Restrictions to the declare simd directive are as follows: 23 • The function or subroutine body must be a structured block. 24 • The execu
edule(omp_sched_t *kind, int *chunk_size); 34 C / C++ 356 OpenMP API – Version 5.2 November 2021 Fortran subroutine omp_get_schedule(kind, chunk_size) 1 integer (kind=omp_sched_kind) kind 2 integer chunk_size 3 Fortran Binding 4 The binding task set for an omp_get_schedule region is the generating task. 5 Effect 6 This routine returns the run-sched-var ICV in the task to which the routine binds. The first 7 argument kind returns the schedule to be used. It can be any of the standard schedule kinds as 8 defined in Section 18.2.11, or any implementation-specific schedule kind. If the returned schedule 9 kind is static, dynamic, or guided, the second argument chunk_size returns the chunk size to 10 be used, or a value less than 1 if the default chunk size is to be used. The value returned by the 11 second argument is implementation defined for any other schedule kinds. 12 Cross References 13 • run-sched-var ICV, see Table 2.1 14 18.2.13 omp_get_thread_limit 15 Summary 16 The omp_get_thread_limit routine returns the
ment is relaxed. For 31 any other effective memory ordering, the default argument is equal to that effective memory 32 ordering. The weak clause specifies that the comparison performed by a conditional atomic update 33 may spuriously fail, evaluating to not equal even when the values are equal. 34 310 OpenMP API – Version 5.2 November 2021 1 Note – Allowing for spurious failure by specifying a weak clause can result in performance gains 2 on some systems when using compare-and-swap in a loop. For cases where a single 3 compare-and-swap would otherwise be sufficient, using a loop over a weak compare-and-swap is 4 unlikely to improve performance. 5 6 Restrictions 7 Restrictions to the atomic construct are as follows: 8 • acq_rel and release cannot be specified as arguments to the fail clause. 9 Cross References 10 • atomic Clauses, see Section 15.8.2 11 • atomic directive, see Section 15.8.4 12 • memory-order Clauses, see Section 15.8.1 13 15.8.4 atomic Construct 14 Name: atomic Association: block (atomic structured
t are dispatched when masked 32 regions start and end. 33 486 OpenMP API – Version 5.2 November 2021 Format 1 C / C++ typedef void (*ompt_callback_masked_t) ( 2 ompt_scope_endpoint_t endpoint, 3 ompt_data_t *parallel_data, 4 ompt_data_t *task_data, 5 const void *codeptr_ra 6 ); 7 C / C++ Trace Record 8 C / C++ typedef struct ompt_record_masked_t { 9 ompt_scope_endpoint_t endpoint; 10 ompt_id_t parallel_id; 11 ompt_id_t task_id; 12 const void *codeptr_ra; 13 } ompt_record_masked_t; 14 C / C++ Description of Arguments 15 The endpoint argument indicates that the callback signals the beginning of a scope or the end of a 16 scope. 17 The binding of the parallel_data argument is the current parallel region. 18 The binding of the task_data argument is the encountering task. 19 The codeptr_ra argument relates the implementation of an OpenMP region to its source code. If a 20 runtime routine implements the region associated with a callback that has type signature 21 ompt_callback_masked_t then codeptr_ra contains the
End of preview. Expand in Data Studio

YAML Metadata Warning: empty or missing yaml metadata in repo card

Check out the documentation for more information.

OpenMP Spec. Version 5.2. Not cleaned for line numbers or anything.

dataset_info: features: - name: text dtype: string splits: - name: train num_bytes: 1177273 num_examples: 1131 - name: test num_bytes: 131158 num_examples: 126 download_size: 620663 dataset_size: 1308431 configs: - config_name: default data_files: - split: train path: data/train-* - split: test path: data/test-*

Downloads last month
5