OpenMP API5.0 Page 1 OpenMP OpenMP 5.0 API Syntax Reference Guide The OpenMP API is a portable,scalable Fortran.OpenMP is suitable for a wide range model that gives parallel programmers a of algorithms running on multicore nodes and openmp.org simple and flexible interface for developing chips,NUMA systems,GPUs,and other such portable parallel applications in C/C++and devices attached to a CPU. Fortran content Functionality new/changed in OpenMP 5.0 is in this color,and in OpenMP 4.5 is in this color. C/C++content [nSections in the 5.0spec. [n.n.n]Sections in the 4.5 spec. Deprecated in the5.0 spec. Directives and Constructs variant directives parallel construct Metadirectives I2341 arallel I2611251 vate (s)firstprivate(s) reates a team of OpenMP threads that execute the 侧 metadirective based on context. pragmaomp ause) d pam0mpmebdiotveousd0bug- allel[.Idousel] single [2.8.)7.) irective [clause(L]cause]] du) inetadreive cue omp ingle uselouse Somp end single [end_cause([Jend_clause]-] Somp end metadirective ego6eso fpa面 decare variant 2 default (sharedfrstprivate privateoe) edvariant of a base function and the teams construct eamsj2ioat where the int unctiondefnitionordeclorotion ISomp end workshare (nowait) Worksharing-loop construct te。u8s for/do29227.1 language identifer o doueus r-expression requires directive omp end do nowait Worksharing constructs 5 ections2.8.1]27.2 pragma omp requires clouse[[L clause) Somp requires douse [douse).] pragma omp sections [dausel[]cause).] order(seq_cstl acq_rel relaxed) round-robin fashion in order of thread number. red-block (Somp section ructured-block] Somp end sections nowait Continued) 2019 OpenMP ARB OMP0519-01,OMP5
© 2019 OpenMP ARB OMP0519-01-OMP5 OpenMP API 5.0 Page 1 OpenMP 5.0 API Syntax Reference Guide ® Directives and Constructs An OpenMP executable directive applies to the succeeding structured block. A structured-block is an OpenMP construct or a block of executable statements with a single entry at the top and a single exit at the bottom. OpenMP directives except simd and any declarative directive may not appear in Fortran PURE procedures. variant directives Metadirectives [2.3.4] A directive that can specify multiple directive variants, one of which may be conditionally selected to replace the metadirective based on the enclosing OpenMP context. C/C++ #pragma omp metadirective [clause[ [,] clause] ... ] - or - #pragma omp begin metadirective [clause[ [,] clause] ... ] stmt(s) #pragma omp end metadirective For !$omp metadirective [clause[ [,] clause] ... ] - or - !$omp begin metadirective [clause[ [,] clause] ... ] stmt(s) !$omp end metadirective clause: when (context-selector-specification: [directive-variant]) default (directive-variant) declare variant [2.3.5] Declares a specialized variant of a base function and the context in which it is used. C/C++ #pragma omp declare variant(variant-func-id) clause [#pragma omp declare variant(variant-func-id) clause] [ ... ] function definition or declaration For!$omp declare variant ( & [base-proc-name: ]variant-proc-name) clause clause: match (context-selector-specification) variant-func-id: C/C++ The name of a function variant that is a base language identifier, or, for C++, a template-id. variant-proc-name: For The name of a function variant that is a base language identifier. requires directive requires [2.4] Specifies the features that an implementation must provide in order for the code to compile and to execute correctly. C/C++ #pragma omp requires clause [ [ [,] clause] ... ] For !$omp requires clause [ [ [,] clause] ... ] clause: reverse_offload unified_address unified_shared_memory atomic_default_mem_order(seq_cst | acq_rel | relaxed) dynamic_allocators parallel construct parallel [2.6] [2.5] Creates a team of OpenMP threads that execute the region. C/C++#pragma omp parallel [clause[ [, ]clause] ...] structured-block For!$omp parallel [clause[ [, ]clause] ...] structured-block !$omp end parallel clause: private (list), firstprivate (list), shared (list) copyin (list) reduction ([reduction-modifier, ] reduction-identifier: list) proc_bind (master | close | spread) allocate ([allocator : ]list) C/C++ if ([ parallel : ] scalar-expression) C/C++ num_threads (integer-expression) C/C++ default (shared | none) For if ([ parallel : ] scalar-logical-expression) For num_threads (scalar-integer-expression) For default (shared | firstprivate | private | none) teams construct teams [2.7] [2.10.7] Creates a league of initial teams where the initial thread of each team executes the region. C/C++#pragma omp teams [clause[ [, ]clause] ...] structured-block For!$omp teams [clause[ [, ]clause] ...] structured-block !$omp end teams clause: private (list), firstprivate (list), shared (list) reduction ([default ,] reduction-identifier : list) allocate ([allocator : ]list) C/C++ num_teams (integer-expression) C/C++ thread_limit (integer-expression) C/C++ default (shared | none) For num_teams (scalar-integer-expression) For thread_limit (scalar-integer-expression) For default (shared | firstprivate | private | none) Worksharing constructs sections[2.8.1] [2.7.2] A noniterative worksharing construct that contains a set of structured blocks that are to be distributed among and executed by the threads in a team. C/C++ #pragma omp sections [clause[ [, ] clause] ...] { [#pragma omp section] structured-block [#pragma omp section structured-block] ... } For !$omp sections [clause[[,] clause] ...] [!$omp section] structured-block [!$omp section structured-block] ... !$omp end sections [nowait] clause: private (list), firstprivate (list) lastprivate ([lastprivate-modifier: ] list) reduction ([reduction-modifier,] reduction-identifier: list) allocate ([allocator : ]list) C/C++ nowait single [2.8.2] [2.7.3] Specifies that the associated structured block is executed by only one of the threads in the team. C/C++#pragma omp single [clause[ [, ]clause] ...] structured-block For!$omp single [clause[ [, ]clause] ...] structured-block !$omp end single [end_clause[ [, ]end_clause] ...] clause: private (list), firstprivate (list) allocate ([allocator : ]list) C/C++ copyprivate (list) C/C++ nowait end_clause: For copyprivate (list), nowait workshare [2.8.3] [2.7.4] Divides the execution of the enclosed structured block into separate units of work, each executed only once by one thread. For!$omp workshare structured-block !$omp end workshare [nowait] Worksharing-loop construct for / do [2.9.2] [2.7.1] Specifies that the iterations of associated loops will be executed in parallel by threads in the team. C/C++#pragma omp for [clause[ [, ]clause] ...] for-loops For!$omp do [clause[ [, ]clause] ...] do-loops [!$omp end do [nowait] ] clause: private (list), firstprivate (list) lastprivate ([lastprivate-modifier: ] list) linear (list[ : linear-step]) schedule ([modifier [, modifier] : ] kind[, chunk_size]) collapse (n), ordered [(n)] allocate ([allocator : ]list) order (concurrent) reduction ([reduction-modifier,] reduction-identifier: list) C/C++ nowait kind: • static: Iterations are divided into chunks of size chunk_size and assigned to threads in the team in round-robin fashion in order of thread number. • dynamic: Each thread executes a chunk of iterations then requests another chunk until none remain. • guided: Each thread executes a chunk of iterations then requests another chunk until no chunks remain to be assigned. Chunk size is different for each chunk, with each successive chunk smaller than the last. openmp.org The OpenMP® API is a portable, scalable model that gives parallel programmers a simple and flexible interface for developing portable parallel applications in C/C++ and Fortran. OpenMP is suitable for a wide range of algorithms running on multicore nodes and chips, NUMA systems, GPUs, and other such devices attached to a CPU. Functionality new/changed in OpenMP 5.0 is in this color, and in OpenMP 4.5 is in this color. C/C++ [n.n.n] Sections in the 5.0 spec. [n.n.n] Sections in the 4.5 spec. • Deprecated in the 5.0 spec. C/C++ content For Fortran content Continued4
Page2 OpenMP API5.0 Directives and Constructs (continued) distribute loop constructs scan directive puteeeeautedbyheinitalteam Somp end distribute tonic:Ch s are assigned to thread e be se (n) ienerdhenheloenotd chu distribute simd 】 currently using s: SIMD directives stribute simd [clouse[[lciouse].] octorsnmd, simd stnbute simd &m by distribute or sime Distribute Parallel Worksharing-Loop Tasking constructs task ateenegtl.simdenength task constr apply pr8miopntdou5dL Somp distribute parallel do /oouse!clouse]... on-identfer:st) end (dep Distribute Parallel Worksharing-Loop SIMD Worksharing-Loop SIMD 2 IM cnophtcanhectdwta tribute parallel do simd cousef/clouse).. sion) e6a eclare simd loop construct will be eet pragm ncetondetinaoncrdedbroto Somp dedare simd fproc-nomel![clouse!L,Jdouse). nd loop nel n(argument-list) t e ecto8ut./econltenha:时 if (tas (tas (priv for final 20190 penMP ARB OMP0519-01-OMPS
Page 2 OpenMP API 5.0 © 2019 OpenMP ARB OMP0519-01-OMP5 Directives and Constructs (continued) • auto: The decision regarding scheduling is delegated to the compiler and/or runtime system. • runtime: The schedule and chunk size are taken from the run-sched-var ICV. modifier: • monotonic: Each thread executes the chunks that it is assigned in increasing logical iteration order. Default for static schedule. • nonmonotonic: Chunks are assigned to threads in any order and the behavior of an application that depends on execution order of the chunks is unspecified. Default for all schedule kinds except static. • simd: Ignored when the loop is not associated with a SIMD construct, otherwise the new_chunk_size for all except the first and last chunks is chunk_size/ simd_width * simd_width where simd_width is an implementation-defined value. SIMD directives simd [2.9.3.1] [2.8.1] Applied to a loop to indicate that the loop can be transformed into a SIMD loop. C/C++#pragma omp simd [clause[ [, ]clause] ...] for-loops For!$omp simd [clause[ [, ]clause] ...] do-loops [!$omp end simd] clause: safelen (length), simdlen (length) linear (list[ : linear-step]) aligned (list[ : alignment]) nontemporal (list) private (list) lastprivate ([lastprivate-modifier : ] list) reduction ([ reduction-modifier, ] reduction-identifier : list) collapse (n) order (concurrent) C/C++ if ([simd :] scalar-expression) For if ([simd :] scalar-logical-expression) Worksharing-Loop SIMD [2.9.3.2] [2.8.3] Applied to a loop to indicate that the loop can be transformed into a SIMD loop that will be executed in parallel by threads in the team. C/C++#pragma omp for simd [clause[ [, ]clause] ...] for-loops For!$omp do simd [clause[ [, ]clause] ...] do-loops [!$omp end do simd[nowait] ] clause: Any of the clauses accepted by the simd or for/do directives with identical meanings and restrictions. declare simd [2.9.3.3] [2.8.2] Applied to a function or a subroutine to enable the creation of one or more versions that can process multiple arguments using SIMD instructions from a single invocation in a SIMD loop. C/C++ #pragma omp declare simd [clause[ [, ]clause] ...] [#pragma omp declare simd [clause[ [, ]clause] ...]] [...] function definition or declaration For !$omp declare simd [(proc-name)] [clause[ [, ]clause] ...] clause: simdlen (length) linear (linear-list[ : linear-step]) aligned (argument-list[ : alignment]) uniform (argument-list) inbranch notinbranch distribute loop constructs distribute [2.9.4.1] [2.10.8] Specifies loops which are executed by the initial teams. C/C++#pragma omp distribute [clause[ [, ]clause] ...] for-loops For!$omp distribute [clause[ [, ]clause] ...] do-loops [!$omp end distribute] clause: private (list) firstprivate (list) lastprivate (list) collapse (n) dist_schedule (kind[, chunk_size]) allocate ([allocator : ]list) distribute simd [2.9.4.2] [2.10.9] Specifies loops which are executed concurrently using SIMD instructions and the initial teams. C/C++#pragma omp distribute simd [clause[ [, ]clause] ...] for-loops For!$omp distribute simd [clause[ [, ]clause] ...] do-loops [!$omp end distribute simd] clause: Any of the clauses accepted by distribute or simd. Distribute Parallel Worksharing-Loop [2.9.4.3] [2.10.10] These constructs specify a loop that can be executed in parallel by multiple threads that are members of multiple teams. C/C++#pragma omp distribute parallel for [clause[ [, ]clause] ...] for-loops For!$omp distribute parallel do [clause[ [, ]clause] ...] do-loops [!$omp end distribute parallel do] clause: Any accepted by the distribute or parallel worksharing-loop directives with identical meanings and restrictions. Distribute Parallel Worksharing-Loop SIMD [2.9.4.4] [2.10.11] Specifies a loop that can be executed concurrently using SIMD instructions in parallel by multiple threads that are members of multiple teams. C/C++#pragma omp distribute parallel for simd \ [clause[ [ , ]clause] ...] for-loops For!$omp distribute parallel do simd [clause[ [, ]clause] ...] do-loops [!$omp end distribute parallel do simd] clause: Any accepted by the distribute or parallel worksharing-loop SIMD directives with identical meanings and restrictions. loop construct loop [2.9.5] Specifies that the iterations of the associated loops may execute concurrently and permits the encountering thread(s) to execute the loop accordingly. C/C++#pragma omp loop [clause[ [, ]clause] ...] for-loops For!$omp loop [clause[ [, ]clause] ...] do-loops [!$omp end loop ] clause: bind (binding) collapse (n) order (concurrent) private (list) lastprivate (list) reduction ([default ,]reduction-identifier : list) binding: teams, parallel, thread scan directive scan [2.9.6] Specifies that each iteration of scan computations update the list items. C/C++ loop-associated-directive for-loop-headers { structured-block #pragma omp scan clause structured-block } For loop-associated-directive do-loop-headers structured-block !$omp scan clause structured-block do-termination-stmts(s) [end-loop-associated-directive ] clause: inclusive (list), exclusive (list) loop-associated-directive directives: C/C++ for, for simd, simd [end-]loop-associated-directive directives: For do (end do) do simd (end do simd) simd (end simd) Tasking constructs task [2.10.1] [2.9.1] Defines an explicit task. The data environment of the task is created according to the data-sharing attribute clauses on the task construct and any defaults that apply. C/C++#pragma omp task [clause[ [, ]clause] ...] structured-block For!$omp task [clause[ [, ]clause] ...] structured-block !$omp end task clause: untied, mergeable private (list), firstprivate (list), shared (list) in_reduction (reduction-identifier: list) depend ([depend-modifier, ] dependence-type : locator-list) priority(priority-value) allocate([allocator: ]list) affinity ([aff-modifier: ] locator-list) - where aff-modifier is iterator(iterators-definition) detach (event-handle) - where event-handle is of: type omp_event_handle_t C/C++ kind omp_event_handle_kind For C/C++ default (shared | none) C/C++ if ([ task : ] scalar-expression) C/C++ final (scalar-expression) For default (private | firstprivate | shared | none) For if ([ task : ] scalar-logical-expression) For final (scalar-logical-expression) taskloop [2.10.2] [2.9.2] Specifies that the iterations of one or more associated loops will be executed in parallel using OpenMP tasks. C/C++#pragma omp taskloop [clause[ [, ]clause] ...] for-loops For!$omp taskloop [clause[ [, ]clause] ...] do-loops [!$omp end taskloop ] clause: shared (list), private (list) firstprivate (list), lastprivate (list) reduction ([default ,] reduction-identifier : list) in_reduction (reduction-identifier : list) grainsize (grain-size), num_tasks (num-tasks) collapse (n), priority (priority-value) untied, mergeable, nogroup allocate ([allocator: ]list) C/C++ if ([ taskloop : ] scalar-expression) C/C++ default (shared | none) C/C++ final (scalar-expr) For if ([ taskloop : ] scalar-logical-expression) For default (private | firstprivate | shared | none) For final (scalar-logical-expr) Continued4
OpenMP API5.0 Page3 Directives and Constructs(continued) taskloop simd21o.2到 depend (depend-modifier dependence-type:locator-fist) declare target +h enterdbh:lscotoreprsso op simd (idausel. target exit data Hpragma omp target exit data (clousel[,Iclause/... Somp tareet exdit data fdousel L.Iclousel1 taskyield [2.10.4]12.11.2) n be suspended in favo decare target fclouselL jdousel.... pragma omp taskyield ) Somp taskyield Memory management directive Combined constructs Parallel Worksharing Loop 5 prama omptaretdouse ause lel do [clousef[idause]. omo const mem soace sepepanldb eepteaRh2aeltoodectve parallel loop) promp allocate)cuse m-behavofvrob-c 5 omp allocate作dause epnden-ype amc圆 豆 difier:scal r-expression) ehrtEebtepaaleoropdnetves evice_num Device directives and construct ession of kind omp allocator handle kind target data P3ponsousetbusel- somtegeoed ISomp target update clousel_.] arget enter data es to a econstnahndnooterttetanine #pragma omp target enter data (clousel jclousel.... 50m areet enter data [clousel f.Iclousel.I pmp-type-modiferl 92019 OpenMP AR OMP0519-01-OMP
© 2019 OpenMP ARB OMP0519-01-OMP5 OpenMP API 5.0 Page 3 Directives and Constructs (continued) taskloop simd [2.10.3] [2.9.3] Specifies that a loop can be executed concurrently using SIMD instructions, and that those iterations will also be executed in parallel using OpenMP tasks. C/C++#pragma omp taskloop simd [clause[ [, ]clause] ...] for-loops For!$omp taskloop simd [clause[ [, ]clause] ...] do-loops [!$omp end taskloop simd] clause: Any accepted by the simd or taskloop directives with identical meanings and restrictions. taskyield [2.10.4] [2.11.2] Specifies that the current task can be suspended in favor of execution of a different task. C/C++ #pragma omp taskyield For !$omp taskyield Memory management directive Memory spaces [2.11.1] Predefined memory spaces [Table 2.8, below] represent storage resources for storage and retrieval of variables. Memory space Storage selection intent omp_default_mem_space System default storage. omp_large_cap_mem_space Storage with large capacity. omp_const_mem_space Storage optimized for variables with constant values. omp_high_bw_mem_space Storage with high bandwidth. omp_low_lat_mem_space Storage with low latency. allocate [2.11.3] Specifies how a set of variables is allocated. C/C++ #pragma omp allocate (list) [clause] For !$omp allocate (list) [clause] or !$omp allocate [ (list) ] clause [ !$omp allocate (list) clause [...]] allocate statement clause: allocator (allocator) - where allocator is an expression of: C/C++ type omp_allocator_handle_t For kind omp_allocator_handle_kind Device directives and construct target data [2.12.2] [2.10.1] Creates a device data environment for te extent of the region. C/C++#pragma omp target data clause[ [ [, ]clause] ...] structured-block For!$omp target data clause[ [ [, ]clause] ...] structured-block !$omp end target data clause: map ([[map-type-modifier[ ,] [map-type-modifier[,] ...] map-type: ] locator-list) use_device_ptr (ptr-list), use_device_addr (list) C/C++ if ( [target data : ] scalar-expression) C/C++ device (scalar-expression) For if ( [target data : ] scalar-logical-expression) For device (scalar-integer-expression) target enter data [2.12.3] [2.10.2] Maps variables to a device data environment. C/C++ #pragma omp target enter data [clause[ [, ]clause] ...] For !$omp target enter data [clause[ [, ]clause] ...] clause: map ([map-type-modifier[ ,] [map-type-modifier[ ,] ...] map-type: locator-list) depend ([depend-modifier,] dependence-type : locator-list) nowait C/C++ if ([ target enter data : ] scalar-expression) C/C++ device (integer-expression) For if ([ target enter data : ] scalar-logical-expression) For device (scalar-integer-expression) target exit data [2.12.4] [2.10.3] Unmaps variables from a device data environment. C/C++ #pragma omp target exit data [clause[ [, ]clause] ...] For !$omp target exit data [clause[ [, ]clause] ...] clause: map ([map-type-modifier[ ,] [map-type-modifier[ ,] ...] map-type: locator-list) depend ([depend-modifier, ] dependence-type : locator-list) nowait C/C++ if ([ target exit data : ] scalar-expression) C/C++ device (integer-expression) For if ([ target exit data : ] scalar-logical-expression) For device (scalar-integer-expression) target[2.12.5] [2.10.4] Map variables to a device data environment and execute the construct on that device. C/C++#pragma omp target [clause[ [, ]clause] ...] structured-block For!$omp target [clause[ [, ]clause] ...] structured-block !$omp end target clause: private (list), firstprivate (list) in_reduction (reduction-identifier : list) map ([[map-type-modifier[ ,] [map-type-modifier[,] ...] map-type: ] locator-list) is_device_ptr (list) defaultmap (implicit-behavior[:variable-category]) nowait depend([depend-modifier, ] dependence-type : locator-list) allocate ([allocator : ] list) uses_allocators (allocator[ (allocator-traits-array)] [,allocator[ (allocator-traits-array) ] ...] ) C/C++ if ([ target : ] scalar-expression) C/C++ device([device-modifier:] integer-expression) For if ([ target : ] scalar-logical-expression) For device ([device-modifier:] scalar-integer-expression) device-modifier: ancestor, device_num allocator: C/C++ Identifier of type omp_allocator_handle_t allocator: For Integer expression of kind omp_allocator_handle_kind allocator-traits-array: C/C++ Identifier of const omp_alloctrait_t * type. allocator-traits-array: For Array of type(omp_alloctrait) type target update [2.12.6] [2.10.5] Makes the corresponding list items in the device data environment consistent with their original list items, according to the specified motion clauses. C/C++ #pragma omp target update clause[ [ [, ]clause] ...] For !$omp target update clause[ [ [, ]clause] ...] clause: motion-clause or one of: nowait depend ([depend-modifier, ] dependence-type : locator-list) C/C++ if ([ target update : ] scalar-expression) C/C++ device (integer-expression) For if ([ target update : ] scalar-logical-expression) For device (scalar-integer-expression) motion-clause: to ([mapper(mapper-identifier) : ] locator-list) from ([mapper(mapper-identifier) : ] locator-list) declare target[2.12.7] [2.10.6] A declarative directive that specifies that variables, functions, and subroutines are mapped to a device. C/C++ #pragma omp declare target declarations-definition-seq #pragma omp end declare target - or - #pragma omp declare target (extended-list) - or - #pragma omp declare target clause[ [, ]clause ...] For !$omp declare target (extended-list) - or - !$omp declare target [clause[ [, ]clause] ...] clause: to (extended-list), link (list) device_type (host | nohost | any) extended-list: A comma-separated list of named variables, procedure names, and named common blocks. Combined constructs Parallel Worksharing Loop [2.13.1] [2.11.1] Specifies a parallel construct containing a worksharingloop construct with one or more associated loops. C/C++#pragma omp parallel for [clause[ [, ]clause] ...] for-loop For!$omp parallel do [clause[ [, ]clause] ...] do-loops [!$omp end parallel do] clause: Any accepted by the parallel or for/do directives, except the nowait clause, with identical meanings and restrictions. parallel loop [2.13.2] Shortcut for specifying a parallel construct containing a loop construct with one or more associated loops and no other statements. C/C++#pragma omp parallel loop [clause[ [, ]clause] ...] for-loops For!$omp parallel loop [clause[ [, ]clause] ...] do-loops [!$omp end parallel loop] clause: Any accepted by the parallel or loop directives, with identical meanings and restrictions. parallel sections [2.13.3] [2.11.2] Shortcut for specifying a parallel construct containing a sections construct and no other statements. C/C++ #pragma omp parallel sections [clause[ [, ]clause] ...] { [#pragma omp section] structured-block [#pragma omp section structured-block] ... } For !$omp parallel sections [clause[ [, ]clause] ...] [!$omp section] structured-block [!$omp section structured-block] ... !$omp end parallel sections clause: Any clauses accepted by the parallel or sections directives, with identical meanings and restrictions. parallel workshare [2.13.4] [2.11.3] Shortcut for specifying a parallel construct containing a workshare construct and no other statements. For!$omp parallel workshare [clause[ [, ]clause] ...] structured-block !$omp end parallel workshare clause: Any of the clauses accepted by the parallel directive, with identical meanings and restrictions. Continued4 Continued4
Page4 OpenMPAPI5.0 Directives and Constructs (continued) arlel Worksharin-oo SiMD Worksharing-oo target parallel for [clouselL_ tormning itnd retco e directive allel Worksharing-Loop SIMD paralle do simd se allel do simd eyhetaetorao7oim ute parall target arallel loop arget parallel loop /douselLcouse distrbute parallel do (cbousel[clouse] o-oop 5oaseoatpanleloplobusalLjtbusel ctandgmerannime ,2mePamdeon Tea s Distribute Parallel Worksharing-Loop target simd 2 aster taskloop simd/ oa7baetsndaousalos pendtargetsnmd target teams opletouseljtousal- LCmasterasto re-l cdouseclouse] ns loop (. parallel master taskloop simd otrt86anaraaooteneha target teams distribute ining mastertasoop simd copyin, estric 2019 OpenMP ARB OMP0519-01-OMPS
Page 4 OpenMP API 5.0 © 2019 OpenMP ARB OMP0519-01-OMP5 Directives and Constructs (continued) Parallel Worksharing-Loop SIMD [2.13.5] [2.11.4] Shortcut for specifying a parallel construct containing only one worksharing-loop SIMD construct. C/C++#pragma omp parallel for simd [clause[ [, ]clause] ...] for-loops For!$omp parallel do simd [clause[ [, ]clause] ...] do-loops [!$omp end parallel do simd] clause: Any accepted by the parallel or for/do simd directives except for nowait, with identical meanings and restrictions. parallel master [2.13.6] Shortcut for specifying a parallel construct containing a master construct and no other statements. C/C++#pragma omp parallel master [clause[ [, ]clause] ...] structured-block For!$omp parallel master [clause[ [, ]clause] ...] structured-block $omp end parallel master clause: Any clause used for parallel directive with identical meanings and restrictions. master taskloop [2.13.7] Shortcut for specifying a master construct containing a taskloop construct and no other statements. C/C++#pragma omp master taskloop [clause[ [, ]clause] ...] for-loops For!$omp master taskloop [clause[ [, ]clause] ...] do-loops [$omp end master taskloop] clause: Any clause used for the taskloop directive with identical meanings and restrictions. master taskloop simd [2.13.8] Shortcut for specifying a master construct containing a taskloop simd construct and no other statements. C/C++#pragma omp master taskloop simd \ [clause[ [, ]clause] ...] for-loops For!$omp master taskloop simd [clause[ [, ]clause] ...] do-loops [$omp end master taskloop simd] clause: Any clause used for taskloop simd directive with identical meanings and restrictions. parallel master taskloop [2.13.9] Shortcut for specifying a parallel construct containing a master taskloop construct and no other statements. C/C++#pragma omp parallel master taskloop \ [clause[ [, ]clause] ...] for-loops For!$omp parallel master taskloop [clause[ [, ]clause] ...] do-loops [$omp end parallel master taskloop] clause: Any clause used for parallel or master taskloop directives, except the in_reduction clause, with identical meanings and restrictions. parallel master taskloop simd [2.13.10] Shortcut for specifying a parallel construct containing a master taskloop simd construct and no other statements. C/C++#pragma omp parallel master taskloop simd \ [clause[ [, ]clause] ...] for-loops For!$omp parallel master taskloop simd [clause[ [, ]clause] ...] do-loops [$omp end parallel master taskloop simd] clause: Any clause used for parallel or master taskloop simd directives, except the in_reduction clause, with identical meanings and restrictions. teams distribute [2.13.11] [2.11.10] Shortcut for specifying a teams construct containing a distribute construct and no other statements. . C/C++#pragma omp teams distribute [clause[ [, ]clause] ...] for-loops For!$omp teams distribute [clause[ [, ]clause] ...] do-loops [!$omp end teams distribute] clause: Any accepted by the teams or distribute directives with identical meanings and restrictions. teams distribute simd [2.13.12] [2.11.11] Shortcut for specifying a teams construct containing a distribute simd construct and no other statements. C/C++#pragma omp teams distribute simd \ [clause[ [, ] clause] ...] for-loops For!$omp teams distribute simd [clause[ [, ]clause] ...] do-loops [!$omp end teams distribute simd] clause: Any accepted by the teams or distribute simd directives with identical meanings and restrictions. Teams Distribute Parallel WorksharingLoop [2.13.13] [2.11.14] Shortcut for specifying a teams construct containing a distribute parallel worksharing-loop construct and no other statements. C/C++#pragma omp teams distribute parallel for \ [clause[ [, ]clause] ...] for-loops For!$omp teams distribute parallel do [clause[ [, clause] ...] do-loops [!$omp end teams distribute parallel do] clause: Any clause used for teams or distribute parallel for/ do directives with identical meanings and restrictions. Teams Distribute Parallel Worksharing-Loop SIMD [2.13.14] [2.11.16] Shortcut for specifying a teams construct containing a distribute parallel work-sharing-loop SIMD construct and no other statements. C/C++#pragma omp teams distribute parallel for simd \ [clause[ [, ]clause] ...] for-loops For !$omp teams distribute parallel do simd [clause[ [, ]clause] ...] do-loops [!$omp end teams distribute parallel do simd] clause: Any accepted by teams or distribute parallel for/ do simd, with identical meanings and restrictions. teams loop [2.13.15] Shortcut for specifying a teams construct containing a loop construct and no other statements. C/C++#pragma omp teams loop [clause[ [, ]clause] ...] for -loops For!$omp teams loop [clause[ [, ]clause] ...] do-loops [!$omp end teams loop] clause: Any accepted by the teams or loop directives with identical meanings and restrictions. target parallel [2.13.16] [2.11.5] Shortcut for specifying a target construct containing a parallel construct and no other statements. C/C++#pragma omp target parallel [clause[ [, ]clause] ...] structured-block For!$omp target parallel [clause[ [, ]clause] ...] structured-block [!$omp end target parallel] clause: Any accepted by the target or parallel directives, except for copyin, with identical meanings and restrictions. Target Parallel Worksharing-Loop [2.13.17] [2.11.6] Shortcut for specifying a target construct with a parallel worksharing-loop construct and no other statements. C/C++#pragma omp target parallel for [clause[ [, ]clause] ...] for -loops For!$omp target parallel do [clause[ [, ]clause] ...] do-loops [!$omp end target parallel do] clause: Any accepted by the target or parallel for/do directives, except for copyin, with identical meanings and restrictions. Target Parallel Worksharing-Loop SIMD [2.13.18] [2.11.7] Shortcut for specifying a target construct with a parallel worksharing-loop SIMD construct and no other statements. C/C++#pragma omp target parallel for simd \ [clause[ [, ]clause] ...] for-loops For!$omp target parallel do simd [clause[ [, ]clause] ...] do-loops [!$omp end target parallel do simd] clause: Any accepted by the target or parallel for/do simd directives, except for copyin, with identical meanings and restrictions. target parallel loop [2.13.19] Shortcut for specifying a target construct containing a parallel loop construct and no other statements. C/C++#pragma omp target parallel loop [clause[ [, ]clause] ...] for-loops For!$omp target parallel loop [clause[ [, ]clause] ...] do-loops [!$omp end target parallel loop] clause: Any accepted by the target or parallel loop directives with identical meanings and restrictions. target simd [2.13.20] [2.11.8] Shortcut for specifying a target construct containing a simd construct and no other statements. C/C++#pragma omp target simd [clause[ [, ]clause] ...] for-loops For!$omp target simd [clause[ [, ]clause] ...] do-loops [!$omp end target simd] clause: Any accepted by the target or simd directives with identical meanings and restrictions. target teams [2.13.21] [2.11.9] Shortcut for specifying a target construct containing a teams construct and no other statements. C/C++#pragma omp target teams [clause[ [, ]clause] ...] structured-block For!$omp target teams [clause[ [, ]clause] ...] structured-block !$omp end target teams clause: Any accepted by the target or teams directives with identical meanings and restrictions. target teams distribute [2.13.22] [2.11.12] Shortcut for specifying a target construct containing a teams distribute construct and no other statements. C/C++#pragma omp target teams distribute [clause[ [, ] \ clause] ...] for-loops For!$omp target teams distribute [clause[ [, ]clause] ...] do-loops [!$omp end target teams distribute] clause: Any accepted by the target or teams distribute directives with identical meanings and restrictions. Continued4
OpenMP API5.0 Page5 Directives and Constructs (continued) Synchronization constructs other sta critical [2.1.1 1213.21 associated structured block to a inele thread at a time pagmaomprtcalhomelhtthteprespnl /ISomp end target teams distribute simd 5onmpengm hserCoateessoathatevalsisod Target Teams Loop2B2 d,write,update,capture der-clouse or hint (hint-expression) ssion-stm on-stmr #pragma omp barrier =pe cut for spe ct containing a no other stateme tpragma omp taskwait [clousel[I clouse]] of the followine form eependen-type omdisribue paraedo atrCwnsortpootcstotcmcmt D232211切 suctured-block eeeiawenshamg4opsMD arallel for simd u5h27周23 osofhevaniables naompflushmemryorder-causs tSomp fush memory-order-clouses master construct ory-order-clause:acq rel,release,or acquire erihrea制theesthgteaautedbythe ordered (m me6h omp end maste 2-pe& ]cause]- the first form):threads or simd Continued in columnn poreereependlsnk:ved 2019 OpenMP ARB OMP0519-01-OMP
© 2019 OpenMP ARB OMP0519-01-OMP5 OpenMP API 5.0 Page 5 Directives and Constructs (continued) target teams distribute simd [2.13.23] [2.11.13] Shortcut for specifying a target construct containing a teams distribute simd construct and no other statements. C/C++#pragma omp target teams distribute simd \ [clause[ [, ]clause] ...] for-loops For!$omp target teams distribute simd [clause[ [, ]clause] ...] do-loops [!$omp end target teams distribute simd] clause: Any accepted by the target or teams distribute simd directives with identical meanings and restrictions. Target Teams Loop [2.13.24] Shortcut for specifying a target construct containing a teams loop construct and no other statements. C/C++#pragma omp target teams loop [clause[ [, ]clause] ...] for-loops For!$omp target teams loop [clause[ [, ]clause] ...] do-loops [!$omp end target teams loop] clause: Any clause used for target or teams loop directives with identical meanings and restrictions. Target Teams Distribute Parallel Worksharing-Loop [2.13.25] [2.11.15] Shortcut for specifying a target construct containing a teams distribute parallel worksharing-loop construct and no other statements. C/C++#pragma omp target teams distribute parallel for \ [clause[ [, ]clause] ...] for-loops For !$omp target teams distribute parallel do & [clause[ [, ]clause] ...] do-loops [$omp end target teams distribute parallel do] clause: Any clause used for target or teams distribute parallel for/do directives with identical meanings and restrictions. Target Teams Distribute Parallel Worksharing-Loop SIMD[2.13.26] [2.11.17] Shortcut for specifying a target construct containing a teams distribute parallel worksharing-loop SIMD construct and no other statements. C/C++#pragma omp target teams distribute parallel for simd \ [clause[ [, ]clause] ...] for-loops For !$omp target teams distribute parallel do simd & [clause[ [, ]clause] ...] do-loops [!$omp end target teams distribute parallel do simd] clause: Any clause used for target or teams distribute parallel for/do simd directives with identical meanings and restrictions. master construct master[2.16] [2.13.1] Specifies a structured block that is executed by the master thread of the team. C/C++#pragma omp master structured-block For!$omp master structured-block !$omp end master Synchronization constructs critical [2.17.1] [2.13.2] Restricts execution of the associated structured block to a single thread at a time. C/C++#pragma omp critical [(name) [[,] hint (hint-expression)]] structured-block For!$omp critical [(name) [[,] hint (hint-expression)] ] structured-block !$omp end critical [(name)] hint-expression: C/C++ An integer constant expression that evaluates to a valid synchronization hint hint-expression: For A constant expression that evaluates to a scalar value with kind omp_sync_hint_kind and a value that is a valid synchronization hint barrier[2.17.2] [2.13.3] Specifies an explicit barrier that prevents any thread in a team from continuing past the barrier until all threads in the team encounter the barrier. C/C++ #pragma omp barrier For !$omp barrier taskwait[2.17.5] [2.13.4] Specifies a wait on the completion of child tasks of the current task. C/C++ #pragma omp taskwait [clause[ [, ] clause] ...] For !$omp taskwait [clause[ [, ] clause] ...] clause: depend ([depend-modifier, ] dependence-type : locator-list) taskgroup [2.17.6] [2.13.5] Specifies a region which a task cannot leave until all its descendant tasks generated inside the dynamic scope of the region have completed C/C++#pragma omp taskgroup [clause[ [, ]clause] ...] structured-block For!$omp taskgroup [clause[ [, ]clause] ...] structured-block !$omp end taskgroup clause: task_reduction (reduction-identifier : list) allocate ([allocator: ]list) atomic [2.17.7] [2.13.6] Ensures a specific storage location is accessed atomically. May take one of the following seven forms: C/C++ #pragma omp atomic [clause[[[,] clause] ... ] [,]] \ atomic-clause [[,] clause [[[,] clause] ...]] expression-stmt #pragma omp atomic [clause[[,] clause] ...] expression-stmt #pragma omp atomic [clause[[[,] clause] ... ] [,]] capture \ [[,] clause [[[,] clause] ... ]] structured-block For !$omp atomic [clause[[[,] clause] ... ] [,]] read & [[,] clause [[[,] clause] ...]] capture-statement [!$omp end atomic] !$omp atomic [clause[[[,] clause] ... ] [,]] write & [[,] clause [[[,] clause] ...]] write-statement [!$omp end atomic] !$omp atomic [clause[[[,] clause] ... ] [,]] update & [[,] clause [[[,] clause] ...]] update-statement [!$omp end atomic] !$omp atomic [clause[[,] clause] ...] update-statement [!$omp end atomic] Continued in next column For !$omp atomic [clause[[[,] clause] ... ] [,]] capture & [[,] clause [[[,] clause] ...]] update-statement capture-statement !$omp end atomic !$omp atomic [clause[[[,] clause] ... ] [,]] capture & [[,] clause [[[,] clause] ...]] capture-statement update-statement !$omp end atomic !$omp atomic [clause[[[,] clause] ... ] [,]] capture & [[,] clause [[[,] clause] ...]] capture-statement write-statement !$omp end atomic atomic-clause: read, write, update, capture memory-order-clause: seq_cst, acq_rel, release, acquire, relaxed clause: memory-order-clause or hint (hint-expression) C/C++ expression-stmt: if atomic clause is... expression-stmt: read v = x; write x = expr; update or is not present x++; x--; ++x; --x; x binop= expr; x = x binop expr; x = expr binop x; capture v=x++; v=x--; v=++x; v= --x; v=x binop= expr; v=x = x binop expr; v=x = expr binop x; C/C++ structured-block may be one of the following forms: {v = x; x binop= expr;} {x binop= expr; v = x;} {v = x; x = x binop expr;} {v = x; x = expr binop x;} {x = x binop expr; v = x;} {x = expr binop x; v = x;} {v = x; x = expr;} {v = x; x++;} {v = x; ++x;} {++x; v = x;} {x++; v = x;} {v = x; x--;} {v = x; --x;} {--x; v = x;} {x--; v = x;} For capture-, write-, or update-statement: if atomic clause is... capture or read capture-statement: v = x capture or write write-statement : x = expr capture or update or is not present update-statement: x = x operator expr x = expr operator x x = intrinsic_procedure_name ( x, expr_list) x = intrinsic_procedure_name ( expr_list, x) intrinsic_procedure_name: MAX, MIN, IAND, IOR, IEOR operator is one of +, *, -, /, .AND., .OR., .EQV., .NEQV. flush [2.17.8] [2.13.7] Makes a thread’s temporary view of memory consistent with memory, and enforces an order on the memory operations of the variables. C/C++ #pragma omp flush [memory-order-clause] [(list)] For !$omp flush [memory-order-clause] [(list)] memory-order-clause: acq_rel, release, or acquire ordered [2.17.9] [2.13.8] Specifies a structured block that is to be executed in loop iteration order in a parallelized loop, or it specifies cross iteration dependences in a doacross loop nest. C/C++ #pragma omp ordered [clause[[, ] clause] ] structured-block - or - #pragma omp ordered clause[[[, ] clause]...] For !$omp ordered [clause[[, ] clause]] structured-block !$omp end ordered - or - !$omp ordered clause[[[, ]clause] ...] clause (for the first form): threads or simd clause (for the second form): depend (source) or depend (sink : vec) Continued4 Continued4
Page6 OpenMP API5.0 Directives and Constructs (continued) sn0peniPipegontaiastpdatsoreston 球w omp depobj(dp dause pointnye-cue ce-type:locator) ype Cancellation constructs Data environment directives w cancellahenermestencdosingegon threadprivate apragma omp cancel construct-type-clousefcous Somp cancel coostructstype-dauseif. vpe-list:A list of type names er-dause:initializer (in onstuct-tvo louse:parallel,sections,taskgroup,for f-cause:) arallel,section appear between mapper [2.19.7.3] Runtime Library Routines Execution environment routines omp et um_procs omp_set_num_thr r-identifier:vorl& thre int omp_gt_num procs (oid) se-language identifier or default e identife void omp set_num threads (int num_threods): mp_in_pa omp_get_num_threads int omp_in_parallel (void); 立int omp get num thread冰oidh of the integer function omp_get_num_threads ( void omp_set mested (int nested): oid omp set dynamic lint dynomic边reo时: omp get nested p get max threads (voidl int omp_get nested (void): teger function omp get max threads ( int omp get dynamic (void): logical function omp get nested omhedule int omp get thread pum lvoid): integer function omp_getthread num( 网 logical omp get cancellation ( _schedule for kind. OMP0519-01-0MP
Page 6 OpenMP API 5.0 © 2019 OpenMP ARB OMP0519-01-OMP5 Directives and Constructs (continued) Runtime Library Routines Execution environment routines omp_set_num_threads [3.2.1] [3.2.1] Affects the number of threads used for subsequent parallel constructs not specifying a num_threads clause, by setting the value of the first element of the nthreads-var ICV of the current task to num_threads. C/C++ void omp_set_num_threads (int num_threads); Forsubroutine omp_set_num_threads (num_threads) integer num_threads omp_get_num_threads [3.2.2] [3.2.2] Returns the number of threads in the current team. The binding region for an omp_get_num_threads region is the innermost enclosing parallel region. If called from the sequential part of a program, this routine returns 1. C/C++ int omp_get_num_threads (void); For integer function omp_get_num_threads () omp_get_max_threads [3.2.3] [3.2.3] Returns an upper bound on the number of threads that could be used to form a new team if a parallel construct without a num_threads clause were encountered after execution returns from this routine. C/C++ int omp_get_max_threads (void); For integer function omp_get_max_threads () omp_get_thread_num [3.2.4] [3.2.4] Returns the thread number of the calling thread, within the current team. C/C++ int omp_get_thread_num (void); For integer function omp_get_thread_num () omp_get_num_procs [3.2.5] [3.2.5] Returns the number of processors that are available to the current device at the time the routine is called. C/C++ int omp_get_num_procs (void); For integer function omp_get_num_procs () omp_in_parallel [3.2.6] [3.2.6] Returns true if the active-levels-var ICV is greater than zero; otherwise it returns false. C/C++ int omp_in_parallel (void); For logical function omp_in_parallel () omp_set_dynamic [3.2.7] [3.2.7] Enables or disables dynamic adjustment of the number of threads available for the execution of subsequent parallel regions by setting the value of the dyn-var ICV. C/C++ void omp_set_dynamic (int dynamic_threads); Forsubroutine omp_set_dynamic (dynamic_threads) logical dynamic_threads omp_get_dynamic [3.2.8] [3.2.8] This routine returns the value of the dyn-var ICV, which is true if dynamic adjustment of the number of threads is enabled for the current task. C/C++ int omp_get_dynamic (void); For logical function omp_get_dynamic () omp_get_cancellation [3.2.9] [3.2.9] Returns the value of the cancel-var ICV, which is true if cancellation is activated; otherwise it returns false. C/C++ int omp_get_cancellation (void); For logical function omp_get_cancellation () •omp_set_nested [3.2.10] [3.2.10] Enables or disables nested parallelism, by setting the max-active-levels-var ICV. C/C++ void omp_set_nested (int nested); For subroutine omp_set_nested (nested) logical nested • omp_get_nested [3.2.11] [3.2.11] Returns whether nested parallelism is enabled or disabled, according to the value of the max-active-levels-var ICV. C/C++ int omp_get_nested (void); For logical function omp_get_nested () omp_set_schedule [3.2.12] [3.2.12] Affects the schedule that is applied when runtime is used as schedule kind, by setting the value of the run-sched-var ICV. C/C++ void omp_set_schedule(omp_sched_t kind, int chunk_size); For subroutine omp_set_schedule (kind, chunk_size) integer (kind=omp_sched_kind) kind integer chunk_size See omp_get_schedule for kind. depobj [2.17.10.1] Stand-alone directive that initalizes, updates, or destroys an OpenMP depend object. C/C++ #pragma omp depobj (depobj) clause For !$omp depobj (depobj) clause clause: depend (dependence-type : locator) destroy update (dependence-type) Cancellation constructs cancel [2.18.1] [2.14.1] Requests cancellation of the innermost enclosing region of the type specified. C/C++ #pragma omp cancel construct-type-clause[ [, ] if-clause] For !$omp cancel construct-type-clause[ [, ]if-clause] C/C++ construct-type-clause: parallel, sections, taskgroup, for if-clause: if ([ cancel : ] scalar-expression) For construct-type-clause: parallel, sections, taskgroup, do if-clause: if ([ cancel : ] scalar-logical-expression) cancellation point[2.18.2] [2.14.2] Introduces a user-defined cancellation point at which tasks check if cancellation of the innermost enclosing region of the type specified has been activated. C/C++ #pragma omp cancellation point construct-type-clause For !$omp cancellation point construct-type-clause construct-type-clause: C/C++ parallel, sections, taskgroup, for For parallel, sections, taskgroup, do Data environment directives threadprivate [2.19.2] [2.15.2] Specifies that variables are replicated, with each thread having its own copy. Each copy of a threadprivate variable is initialized once prior to the first reference to that copy. C/C++ #pragma omp threadprivate (list) For !$omp threadprivate (list) list: C/C++ A comma-separated list of file-scope, namespacescope, or static block-scope variables that do not have incomplete types list: For A comma-separated list of named variables and named common blocks. Common block names must appear between slashes. declare reduction [2.19.5.7] [2.16] Declares a reduction-identifier that can be used in a reduction clause. C/C++#pragma omp declare reduction ( \ reduction-identifier : typename-list : combiner) \ [initializer-clause] For!$omp declare reduction & (reduction-identifier : type-list : combiner) [initializer-clause] C/C++ typename-list: A list of type names initializer-clause: initializer (initializer-expr) where initializer-expr is omp_priv = initializer or function-name (argument-list) reduction-identifier: A base language identifier (for C), or an idexpression (for C++), or one of the following operators: +, -, *, &, |, ^, &&, || combiner: An expression For type-list: A list of type names initializer-clause: initializer (initializer-expr) where initializer-expr is omp_priv = initializer or function-name (argument-list) reduction-identifier: A base language identifier, user defined operator, or one of the following operators: +, -, *, .and., .or., .eqv., .negv., or one of the following intrinsic procedure names: max, min, iand, ior, ieor. combiner: An assignment statement or a subroutine name followed by an argument list. declare mapper [2.19.7.3] Declares a user-defined mapper for a given type, and may define a mapper-identifier for use in a map clause. C/C++#pragma omp declare mapper ([mapper-identifier : ]\ type var) [clause[ [,] clause] ... ] For!$omp declare mapper([mapper-identifier: ]type :: var)& [clause[ [,] clause] ... ] mapper-identifier: A base-language identifier or default type: A valid type in scope var: A valid base-language identifier clause: map ([[map-type-modifier[,] [map-typemodifier[,] ...]] map-type:] list) map-type: alloc, to, from, tofrom map-type-modifier: always, close Continued4
OpenMP API5.0 Page7 Runtime Library Routines (continued) lprntepbcpartomvorlCvatheinemot place mums int omp_etiveevel(od integer function ompgetativelevel omp_in final uted in a final task region: e device b int omp_in_final (void): void_format(c char m omp_get_proc bind omp_get_thread_limit epni.omar*bfe int omp_get_thread_limit (void): omp proc_bind tomp get_proc_bind (void) hpe928ak2emt网 nteger tu p on using the void_(void) omp_display_affinity (const): integer function omp get supported active levels ( mo m ent in the olace时 int omp_get_num_places(void): void omp set max active levels (int max levels): a ent in the sodce int omp get max active levels (voidl: integer function omp get_max_active levels ( omp_get place proc_ids 盟eri论defa.device (m ntel th a2 int omp get level (void): int omp_get_default_device (void); integer function omp_get_level ( empnume2n2 thread num lint levei int omp_get_num_devices(id): integerfunction omp_get_place_mum( er function omp get num devices mp5eame20l2 m to which t remtte nt thread belo int get_patition_num places (void) int omp_getdevice_num (vid) m(in integer function omp_get_device_num() omp get team sire (even bers corres 2019 OpenMP ARB OMP0519-01-OMP
© 2019 OpenMP ARB OMP0519-01-OMP5 OpenMP API 5.0 Page 7 Runtime Library Routines (continued) omp_get_schedule [3.2.13] [3.2.13] Returns the value of run-sched-var ICV, which is the schedule applied when runtime schedule is used. C/C++void omp_get_schedule ( omp_sched_t *kind, int *chunk_size); Forsubroutine omp_get_schedule (kind, chunk_size) integer (kind=omp_sched_kind) kind integer chunk_size kind for omp_set_schedule and omp_get_schedule is an implementation-defined schedule or: omp_sched_static omp_sched_dynamic omp_sched_guided omp_sched_auto Use + or | operators (C/C++) or the + operator (For) to combine the kinds with the modifier omp_sched_monotonic. omp_get_thread_limit [3.2.14] [3.2.14] Returns the value of the thread-limit-var ICV: the maximum number of OpenMP threads available in contention group. C/C++ int omp_get_thread_limit (void); For integer function omp_get_thread_limit () omp_get_supported_active_levels [3.2.15] Returns the number of active levels of parallelism supported. C/C++ void omp_get_supported_active_levels( void); For integer function omp_get_supported_active_levels () omp_set_max_active_levels [3.2.16] [3.2.15] Limits the number of nested active parallel regions, by setting max-active-levels-var ICV. C/C++ void omp_set_max_active_levels (int max_levels); For subroutine omp_set_max_active_levels (max_levels) integer max_levels omp_get_max_active_levels [3.2.17] [3.2.16] Returns the value of max-active-levels-var ICV, which determines the maximum number of nested active parallel regions. C/C++ int omp_get_max_active_levels (void); For integer function omp_get_max_active_levels () omp_get_level [3.2.18] [3.2.17] Returns the value of the levels-var ICV for the current device, which is the number of nested parallel regions on the device that enclose the task containing the call. C/C++ int omp_get_level (void); For integer function omp_get_level () omp_get_ancestor_thread_num [3.2.19] [3.2.18] Returns, for a given nested level of the current thread, the thread number of the ancestor of the current thread. C/C++ int omp_get_ancestor_thread_num (int level); For integer function omp_get_ancestor_thread_num (level) integer level omp_get_team_size [3.2.20] [3.2.19] Returns, for a given nested level of the current thread, the size of the thread team to which the ancestor or the current thread belongs. C/C++ int omp_get_team_size (int level); For integer function omp_get_team_size (level) integer level omp_get_active_level [3.2.21] [3.2.20] Returns the value of the active-level-vars ICV for the current device, which is the number of active, nested parallel regions on the device enclosing the task containing the call. C/C++ int omp_get_active_level (void); For integer function omp_get_active_level () omp_in_final [3.2.22] [3.2.21] Returns true if the routine is executed in a final task region; otherwise, it returns false. C/C++ int omp_in_final (void); For logical function omp_in_final () omp_get_proc_bind [3.2.23] [3.2.22] Returns the thread affinity policy to be used for the subsequent nested parallel regions that do not specify a proc_bind clause. C/C++ omp_proc_bind_t omp_get_proc_bind (void); For integer (kind=omp_proc_bind_kind) function omp_get_proc_bind () Valid return values include: omp_proc_bind_false omp_proc_bind_true omp_proc_bind_master omp_proc_bind_close omp_proc_bind_spread omp_get_num_places[3.2.24] [3.2.23] Returns the number of places available to the execution environment in the place list. C/C++ int omp_get_num_places (void); For integer function omp_get_num_places () omp_get_place_num_procs [3.2.25] [3.2.24] Returns the number of processors available to the execution environment in the specified place. C/C++ int omp_get_place_num_procs (int place_num); For integer function omp_get_place_num_procs (place_num) integer place_num omp_get_place_proc_ids [3.2.26] [3.2.25] Returns numerical identifiers of the processors available to the execution environment in the specified place. C/C++ void omp_get_place_proc_ids ( int place_num, int *ids); For subroutine omp_get_place_proc_ids(place_num, ids) integer place_num integer ids (*) omp_get_place_num [3.2.27] [3.2.26] Returns the place number of the place to which the encountering thread is bound. C/C++ int omp_get_place_num (void); For integer function omp_get_place_num () omp_get_partition_num_places [3.2.28] [3.2.27] Returns the number of places in the place-partition-var ICV of the innermost implicit task. C/C++ int omp_get_partition_num_places (void); For integer function omp_get_partition_num_places () omp_get_partition_place_nums [3.2.29] [3.2.28] Returns the list of place numbers corresponding to the places in the place-partition-var ICV of the innermost implicit task. C/C++ void omp_get_partition_place_nums ( int *place_nums); For subroutine omp_get_partition_place_nums( place_nums) integer place_nums (*) omp_set_affinity_format [3.2.30] Sets the affinity format to be used on the device by setting the value of the affinity-format-var ICV. C/C++ void omp_set_affinity_format (const char *format); For subroutine omp_set_affinity_format (format) character(len=*), intent(in) :: format omp_get_affinity_format [3.2.31] Returns the value of the affinity-format-var ICV on the device. C/C++ size_t omp_get_affinity_format (char *buffer, size_t size); For integer function omp_get_affinity_format (buffer) character(len=*), intent(out) :: buffer omp_display_affinity [3.2.32] Prints the OpenMP thread affinity information using the format specification provided. C/C++ void omp_display_affinity (const char *format); For subroutine omp_display_affinity (format) character(len=*), intent(in) :: format omp_capture_affinity [3.2.33] Prints the OpenMP thread affinity information into a buffer using the format specification provided. C/C++ size_t omp_capture_affinity (char *buffer, size_t size, const char *format) For integer function omp_capture_affinity (buffer, format) character(len=*), intent(out) :: buffer character(len=*), intent(in) :: format omp_set_default_device [3.2.34] [3.2.29] Assigns the value of the default-device-var ICV, which determines default target device. C/C++ void omp_set_default_device (int device_num); For subroutine omp_set_default_device (device_num) integer device_num omp_get_default_device [3.2.35] [3.2.30] Returns the value of the default-device-var ICV, which determines the default target device. C/C++ int omp_get_default_device (void); For integer function omp_get_default_device () omp_get_num_devices [3.2.36] [3.2.31] Returns the number of target devices. C/C++ int omp_get_num_devices (void); For integer function omp_get_num_devices () omp_get_device_num [3.2.37] Returns the device number of the device on which the calling thread is executing. C/C++ int omp_get_device_num (void); For integer function omp_get_device_num () Continued4 Continued4
Page8 OpenMPAPI5.0 Runtime Library Routines (continued) nae6eaaa e a teams reeion. d by omp eet wtime integer function omp_get_num_teams doublepredionfunciol o get team num [3.2391 [3.2.33] rt OpenMP event objects,which int omp.gct team_num (void): omp_ful event see217.12的the spe Destroy lock void omp_fulfill_event (omp_event_handle_t event): omp is initial device() Device memory routines int ompinitiadevice(oid); integer nitial_device( void omp_(omp_ok d omp_set_nest lock (omp_nest_lock_ omp. omp get max task priority ( omp_pause_resource [.24] mp_p 7 void omp_unset_ock (omp_ck) id omp_unset_nest_lock (omp_nest_lock_t*lock): e8oppnad ompauour inlok。 ens ona pause_resource_kind)kind ice nu int omp test nest lock (omp nest lock t"lock oeeteseootha ock routines t(hind-md sions,int dst device num Timing routines double precision function omp get_wtime ( 20190 penMP ARB OMP0519-01-OMPS
Page 8 OpenMP API 5.0 © 2019 OpenMP ARB OMP0519-01-OMP5 Runtime Library Routines (continued) omp_get_num_teams [3.2.38] [3.2.32] Returns the number of teams in the current teams region, or 1 if called from outside a teams region. C/C++ int omp_get_num_teams (void); For integer function omp_get_num_teams () omp_get_team_num [3.2.39] [3.2.33] Returns the team number of the calling thread. The team number is an integer between 0 and one less than the value returned by omp_get_num_teams, inclusive. C/C++ int omp_get_team_num (void); For integer function omp_get_team_num () omp_is_initial_device [3.2.40] [3.2.34] Returns true if the current task is executing on the host device; otherwise, it returns false. C/C++ int omp_is_initial_device (void); For integer function omp_is_initial_device () omp_get_initial_device [3.2.41] [3.2.35] Returns a device number representing the host device. C/C++ int omp_get_initial_device (void); For integer function omp_get_initial_device() omp_get_max_task_priority [3.2.42] [3.2.36] Returns the maximum value that can be specified in the priority clause. C/C++ int omp_get_max_task_priority (void); For integer function omp_get_max_task_priority () omp_pause_resource [3.2.43] omp_pause_resource_all [3.2.44] Allows the runtime to relinquish resources used by OpenMP on the specified device. Valid kind values include omp_pause_soft and omp_pause_hard. C/C++ int omp_pause_resource ( omp_pause_resource_t kind, int device_num); int omp_pause_resource_all ( omp_pause_resource_t kind); For integer function omp_pause_resource ( kind, device_num) integer (kind=omp_pause_resource_kind) kind integer device_num integer function omp_pause_resource_all (kind) integer (kind=omp_pause_resource_kind) kind Lock routines General-purpose lock routines. Two types of locks are supported: simple locks and nestable locks. A nestable lock can be set multiple times by the same task before being unset; a simple lock cannot be set if it is already owned by the task trying to set it. Initialize lock [3.3.1] [3.3.1] Initialize an OpenMP lock. C/C++ void omp_init_lock (omp_lock_t *lock); void omp_init_nest_lock (omp_nest_lock_t *lock); For subroutine omp_init_lock (svar) integer (kind=omp_lock_kind) svar subroutine omp_init_nest_lock (nvar) integer (kind=omp_nest_lock_kind) nvar Initialize lock with hint [3.3.2] [3.3.2] Initialize an OpenMP lock with a hint. C/C++ void omp_init_lock_with_hint ( omp_lock_t *lock, omp_sync_hint_t hint); void omp_init_nest_lock_with_hint ( omp_nest_lock_t *lock, omp_sync_hint_t hint); For subroutine omp_init_lock_with_hint (svar, hint) integer (kind=omp_lock_kind) svar integer (kind=omp_sync_hint_kind) hint subroutine omp_init_nest_lock_with_hint (nvar, hint) integer (kind=omp_nest_lock_kind) nvar integer (kind=omp_sync_hint_kind) hint hint: [see 2.17.12 in the specification] Destroy lock [3.3.3] [3.3.3] Ensure that the OpenMP lock is uninitialized. C/C++ void omp_destroy_lock (omp_lock_t *lock); void omp_destroy_nest_lock (omp_nest_lock_t *lock); For subroutine omp_destroy_lock (svar) integer (kind=omp_lock_kind) svar subroutine omp_destroy_nest_lock (nvar) integer (kind=omp_nest_lock_kind) nvar Set lock [3.3.4] [3.3.4] Sets an OpenMP lock. The calling task region is suspended until the lock is set. C/C++ void omp_set_lock (omp_lock_t *lock); void omp_set_nest_lock (omp_nest_lock_t *lock); For subroutine omp_set_lock (svar) integer (kind=omp_lock_kind) svar subroutine omp_set_nest_lock (nvar) integer (kind=omp_nest_lock_kind) nvar Unset lock [3.3.5] [3.3.5] Unsets an OpenMP lock. C/C++ void omp_unset_lock (omp_lock_t *lock); void omp_unset_nest_lock (omp_nest_lock_t *lock); For subroutine omp_unset_lock (svar) integer (kind=omp_lock_kind) svar subroutine omp_unset_nest_lock (nvar) integer (kind=omp_nest_lock_kind) nvar Test lock [3.3.6] [3.3.6] Attempt to set an OpenMP lock but do not suspend execution of the task executing the routine. C/C++ int omp_test_lock (omp_lock_t *lock); int omp_test_nest_lock (omp_nest_lock_t *lock); For logical function omp_test_lock (svar) integer (kind=omp_lock_kind) svar integer function omp_test_nest_lock (nvar) integer (kind=omp_nest_lock_kind) nvar Timing routines Timing routines support a portable wall clock timer. These record elapsed time per-thread and are not guaranteed to be globally consistent across all the threads participating in an application. omp_get_wtime [3.4.1] [3.4.1] Returns elapsed wall clock time in seconds. C/C++ double omp_get_wtime (void); For double precision function omp_get_wtime () omp_get_wtick [3.4.2] [3.4.2] Returns the precision of the timer (seconds between ticks) used by omp_get_wtime. C/C++ double omp_get_wtick (void); For double precision function omp_get_wtick () Event routine Event routines support OpenMP event objects, which must be accessed through the routines described in this section or through the detach clause of the task construct. omp_fulfill_event [3.5.1] Fulfills and destroys an OpenMP event. C/C++ void omp_fulfill_event (omp_event_handle_t event); For subroutine omp_fulfill_event (event) integer (kind=omp_event_handle_kind) event Device memory routines These routines support allocation and management of pointers in the data environments of target devices. omp_target_alloc [3.6.1] [3.5.1] Allocates memory in a device data environment. C/C++ void *omp_target_alloc (size_t size, int device_num); omp_target_free [3.6.2] [3.5.2] Frees the device memory allocated by the omp_target_alloc routine. C/C++void omp_target_free (void *device_ptr, int device_num); omp_target_is_present [3.6.3] [3.5.3] Validates whether a host pointer has an associated device buffer on a given device. C/C++int omp_target_is_present (const void *ptr, int device_num); omp_target_memcpy [3.6.4] [3.5.4] Copies memory between any combination of host and device pointers. C/C++ int omp_target_memcpy (void *dst, const void *src, size_t length, size_t dst_offset, size_t src_offset, int dst_device_num, int src_device_num); omp_target_memcpy_rect [3.6.5] [3.5.5] Copies a rectangular subvolume from a multi-dimensional array to another multi-dimensional array. C/C++ int omp_target_memcpy_rect (void * dst, const void * src, size_t element_size, int num_dims, const size_t* volume, const size_t* dst_offsets, const size_t* src_offsets, const size_t* dst_dimensions, const size_t* src_dimensions, int dst_device_num, int src_device_num); omp_target_associate_ptr [3.6.6] [3.5.6] Maps storage to which a device pointer points to storage to which a host pointer points. The device pointer may be the result of a call to omp_target_alloc or have been obtained from implementation-defined runtime routines. C/C++ int omp_target_associate_ptr (const void * host_ptr, const void * device_ptr, size_t size, size_t device_offset, int device_num); omp_target_disassociate_ptr [3.6.7] [3.5.7] Removes the association between a host pointer and a device address on a given device. C/C++ int omp_target_disassociate_ptr (const void * ptr, int device_num); Continued4
OpenMP API5.0 Page9 Runtime Library Routines (continued) Memory management routines ompsetdefautallcatr Tool control routine e omp_control_tool sto an active to 学出 ee om 电%o2pae6& oo omp coco Clauses ding to the g rles of the f Allocate Clause Defaultmap Clause one,default Data Copying Clauses frtprtates o be private to a task,and initi Depend Clause rivate (st) cinalRenhswhenheonstrL8merg ibling task en8peaio te list iter d (ce in:The gen d near-st做or modifier(list) modifier:ref,val,or uval (C:modifier may only be val) 920190 penMP AR阳 OMP0519-01-OMP
© 2019 OpenMP ARB OMP0519-01-OMP5 OpenMP API 5.0 Page 9 Runtime Library Routines (continued) Memory management routines Memory Management Types [3.7.1] The omp_alloctrait_t struct in C/C++ and omp_alloctrait type in Fortran define members named key and value, with these types and values: enum omp_alloctrait_key_t (C/C++ ) integer omp_alloctrait_key_kind (For) omp_atk_X where X may be one of sync_hint, alignment, access, pool_size, fallback, fb_data, pinned, partition enum omp_alloctrait_value_t (C/C++) integer omp_alloctrait_val_kind (For) omp_atv_X where X may be one of false, true, default, contended, uncontended, sequential, private, all, thread, pteam, cgroup, default_mem_fb, null_fb, abort_fb, allocator_fb, environment, nearest, blocked, interleaved omp_init_allocator [3.7.2] Initializes allocator and associates it with a memory space. C/C++ omp_allocator_handle_t omp_init_allocator ( omp_memspace_handle_t memspace, int ntraits, const omp_alloctrait_t traits[]); For integer (kind=omp_allocator_handle_kind) & function omp_init_allocator (& memspace, ntraits, traits) integer (kind=omp_memspace_handle_kind), & intent (in) :: memspace integer, intent (in) :: ntraits type (omp_alloctrait), intent (in) :: traits (*) omp_destroy_allocator [3.7.3] Releases all resources used by the allocator handle. C/C++ void omp_destroy_allocator ( omp_allocator_handle_t allocator); For subroutine omp_destroy_allocator (allocator) integer (kind=omp_allocator_handle_kind), & intent (in) :: allocator omp_set_default_allocator [3.7.4] Sets the default memory allocator to be used by allocation calls, allocate directives, and allocate clauses that do not specify an allocator. C/C++void omp_set_default_allocator ( omp_allocator_handle_t allocator); Forsubroutine omp_set_default_allocator (allocator) integer (kind=omp_allocator_handle_kind), & intent (in) :: allocator omp_get_default_allocator [3.7.5] Returns the memory allocator to be used by allocation calls, allocate directives, and allocate clauses that do not specify an allocator. C/C++ omp_allocator_handle_t omp_get_default_allocator (void); For integer (kind=omp_allocator_handle_kind) & function omp_get_default_allocator () omp_alloc [3.7.6] Requests a memory allocation from a memory allocator. C void *omp_alloc (size_t size, omp_allocator_handle_t allocator); C++ void *omp_alloc (size_t size, omp_allocator_handle_t allocator=omp_null_allocator); omp_free [3.7.7] Deallocates previously allocated memory. C void omp_free (void *ptr, omp_allocator_handle_t allocator); C++ void omp_free (void *ptr, omp_allocator_handle_t allocator=omp_null_allocator); Tool control routine omp_control_tool [3.8] Enables a program to pass commands to an active tool. C/C++ int omp_control_tool (int command, int modifier, void *arg); For integer function omp_control_tool (& command, modifier) integer (kind=omp_control_tool_kind) command integer modifier command: omp_control_tool_start Start or restart monitoring if it is off. If monitoring is already on, this command is idempotent. If monitoring has already been turned off permanently, this command will have no effect. omp_control_tool_pause Temporarily turn monitoring off. If monitoring is already off, it is idempotent. omp_control_tool_flush Flush any data buffered by a tool. This command may be applied whether monitoring is on or off. omp_control_tool_end Turn monitoring off permanently; the tool finalizes itself and flushes all output. Clauses All list items appearing in a clause must be visible according to the scoping rules of the base language. Not all of the clauses listed in this section are valid on all directives. Allocate Clause [2.11.4] allocate ([allocator:] list) Specifies the memory allocator to be used to obtain storage for private variables of a directive. allocator: C/C++ Expression of type omp_allocator_handle_t For Integer expression of kind omp_allocator_handle_kind Data Copying Clauses [2.19.6] [2.15.4] copyin (list) Copies the value of the master thread’s threadprivate variable to the threadprivate variable of each other member of the team executing the parallel region. copyprivate (list) Broadcasts a value from the data environment of one implicit task to the data environments of the other implicit tasks belonging to the parallel region. Data Sharing Attribute Clauses [2.19.4] [2.15.3] Applies only to variables whose names are visible in the construct on which the clause appears. default (shared | none) C/C++ default (private | firstprivate | shared | none) For Explicitly determines default data-sharing attributes of variables referenced in a parallel, teams, or task generating construct, causing all variables referenced in the construct that have implicitly determined datasharing attributes to be as specified. shared (list) Declares list items to be shared by tasks generated by parallel, teams, or task-generating construct. Storage shared by explicit task region must not reach the end of its lifetime before the explicit task region completes execution. private (list) Declares list items to be private to a task or a SIMD lane. Each task or SIMD lane that references a list item in the construct receives only one new list item, unless the construct has one or more associated loops and the order(concurrent) clause is also present. firstprivate (list) Declares list items to be private to a task, and initializes each of them with the value that the corresponding original item has when the construct is encountered. lastprivate ([ lastprivate-modifier:] list) Declares one or more list items to be private to an implicit task or SIMD lane, and causes the corresponding original list item to be updated after the end of the region. lastprivate-modifier: conditional linear (linear-list[: linear-step]) Declares one or more list items to be private and to have a linear relationship with respect to the iteration space of a loop associated with the construct on which the clause appears. linear-list: list or modifier(list) modifier: ref, val, or uval (C: modifier may only be val) Defaultmap Clause [2.19.7.2] [2.15.5.2] defaultmap (implicit-behavior[: variable-category]) Explicitly determines the data-mapping attributes referenced in a target construct and would otherwise be implicitly determined. implicit-behavior: alloc, to, from, tofrom, firstprivate, none, default variable-category: C/C++ scalar, aggregate, pointer variable-category: scalar, aggregate, pointer, allocatable For Depend Clause [2.17.11] [2.13.9] Enforces additional constraints on the scheduling of tasks or loop iterations, establishing dependences only between sibling tasks or between loop iterations. depend (dependence-type) dependence-type must be source. depend (dependence-type : vec) dependence-type must be sink and vec is the iteration vector with form: x1 [± d1], x2 [± d2], . . . , xn [± dn] depend ([depend-modifier,]dependence-type : locator-list) depend-modifier: iterator (iterators-definition) dependence-type: in, out, inout, mutexinoutset, depobj • in: The generated task will be a dependent dependent task of all previously generated sibling tasks that reference at least one of the list items in an out or inout dependence-type list. Continued4 Continued4
Page 10 OpenMP API 5.0 Clauses(continued) Depend(continued) askeducioneducton-denitierlel Tasking Clauses edtcion-tcrferSanesoethcion out,mute ce-tut a9kop】 eduction-moaper: cp f the on this page.(Not used n task.) ask will be a dep of that ing operato a si depend ndence-type nax min.iand.ior.icor auses and f Clause in this at be f Clause [2is](212] Cantposiv teger expression wh 6 gainstelgrothste ession) modfer:]scolar-ogicalexpression)Fo Map Clause on) lastprivate ap-ypose (Not used in task) Attribute Clauses,page 9 of this guide Ordered Clause imdlen ler oops or how many loops to associate with Reduction Clauses rguments to ha ve an invariant he tifier:Same as for re pmiory Iterators identifier:A base language identifier d to multiple values in the clause on which they angea range-specifica torbeoin:cnd:tcpl heir type tor (terato guid torea6-e1ieenfer=ronge-pecfcation iterator-type:A type specifier.Fo 2019 OpenMP ARB OMP0519-01-OMPS
Page 10 OpenMP API 5.0 © 2019 OpenMP ARB OMP0519-01-OMP5 Clauses (continued) Depend (continued) • out and inout: The generated task will be a dependent task of all previously generated sibling tasks that reference at least one of the list items in an in, out, mutexinoutset, or inout dependence-type list. • mutexinoutset: If the storage location of at least one of the list items is the same as that of a list item appearing in a depend clause with an in, out, or inout dependence-type on a construct from which a sibling task was previously generated, then the generated task will be a dependent task of that sibling task. If the storage location of at least one of the list items is the same as that of a list item appearing in a depend clause with a mutexinoutset dependence-type on a construct from which a sibling task was previously generated, then the sibling tasks will be mutually exclusive tasks. • depobj: The task dependences are derived from the depend clause specified in the depobj constructs that initialized dependences represented by the depend objects specified on in the depend clause as if the depend clauses of the depobj constructs were specified in the current construct. If Clause [2.15] [2.12] The effect of the if clause depends on the construct to which it is applied. For combined or composite constructs, it only applies to the semantics of the construct named in the directive-name-modifier if one is specified. If none is specified for a combined or composite construct then the if clause applies to all constructs to which an if clause can apply. if ([directive-name-modifier :] scalar-expression) C/C++ if ([directive-name-modifier :] scalar-logical-expression) For Map Clause [2.19.7.1] [2.15.5.1] map ([[map-type-modifier[,] [map-type-modifier[,] ... ] map-type : ] locator-list) Map an original list item from the current task’s data environment to a corresponding list item in the device data environment of the device identified by the construct. map-type: alloc, to, from, tofrom, release, delete map-type-modifier: always, close, mapper (mapper-identifier) Ordered Clause [2.9.2] ordered [ (n) ] Indicates the loops or how many loops to associate with a construct. Reduction Clauses [2.19.5] [2.15.3.6] in_reduction (reduction-identifier: list) Specifies that a task participates in a reduction reduction-identifier: Same as for reduction task_reduction (reduction-identifier: list) Specifies a reduction among tasks. reduction-identifier: Same as for reduction reduction ([ reduction-modifier ,] reduction-identifier : list) Specifies a reduction-identifier and one or more list items. reduction-modifier: inscan, task, default reduction-identifier: C++ Either an id-expression or one of the following operators: +, -, *, &, |, ^, &&, || reduction-identifier: C Either an identifier or one of the following operators: +, -, *, &, |, ^, &&, || reduction-identifier: For Either a base language identifier, a user-defined operator, one of the following operators: +, -, *, .and., .or., .eqv., .neqv., or one of the following intrinsic procedure names: max, min, iand, ior, ieor. SIMD Clauses [2.9.3] [2.8] Also see Data Sharing Attribute Clauses and If Clause in this guide. aligned (argument-list[:alignment]) Declares one or more list items to be aligned to the specified number of bytes. alignment, if present, must be a constant positive integer expression. collapse (n) A constant positive integer expression that specifies how many loops are associated with the construct. (Not used in declare simd.) inbranch Specifies that the function will always be called from inside a conditional statement of a SIMD loop. (Not used in simd.) nontemporal (list) Specifies that accesses to the storage locations to which the list items refer have low temporal locality across the iterations in which those storage locations are accessed. notinbranch Specifies that the function will never be called from inside a conditional statement of a SIMD loop. (Not used in simd.) safelen (length) If used then no two iterations executed concurrently with SIMD instructions can have a greater distance in the logical iteration space than the value of length. (Not used in declare simd.) simdlen (length) A constant positive integer expression that specifies the preferred number of iterations to be executed concurrently. uniform (argument-list) Declares one or more arguments to have an invariant value for all concurrent invocations of the function in the execution of a single SIMD loop. (Not used in simd.) Tasking Clauses [2.10] [2.9] affinity ([aff-modifier: ] locator-list) A hint to execute closely to the location of the list items. aff-modifier is iterator (iterators-definition). (Not used in taskloop.) allocate ([allocator: ]list) See Allocate Clause, page 9 of this guide. collapse (n) See SIMD Clauses on this page. (Not used in task.) default (shared | none) C/C++ default (private | firstprivate | shared | none) For See Data Sharing Attribute Clauses, page 9 of this guide. depend ([depend-modifier, ] dependence-type : locator-list) See Depend Clause, page 9 of this guide. (Not used in taskloop.) detach (list) Causes an implicit reference to the variable list in all enclosing constructs. (Not used in taskloop.) final (scalar-expression) C/C++ final (scalar-logical-expression) For The generated task will be a final task if the final expression evaluates to true. firstprivate (list) See Data Sharing Attribute Clauses, page 9 of this guide. grainsize (grain-size) Causes the number of logical loop iterations assigned to each created task to be greater than or equal to the minimum of the value of the grain-size expression and the number of logical loop iterations, but less than twice the value of the grain-size expression. (Not used in task.) if ([ task : ] scalar-expression) C/C++ if ([ task : ] scalar-logical-expression) For Also see If Clause on this page. in_reduction (reduction-identifier: list) See Reduction Clauses on this page. lastprivate (list) See Data Sharing Attribute Clauses, page 9 of this guide. (Not used in task.) mergeable Specifies that the generated task is a mergeable task. nogroup Prevents an implicit taskgroup region to be created. (Not used in task.) num_tasks (num-tasks) Create as many tasks as the minimum of the num-tasks expression and the number of logical loop iterations. (Not used in task.) priority (priority-value) A non-negative numerical scalar expression that specifies a hint for the priority of the generated task. private (list) See Data Sharing Attribute Clauses, page 9 of this guide. reduction ([ reduction-modifier ,] reduction-identifier : list) See Reduction Clauses on this page. (Not used in task.) shared (list) See Data Sharing Attribute Clauses, page 9 of this guide. untied If present, any thread in the team can resume the task region after a suspension. Iterators iterators [2.1.6] Identifiers that expand to multiple values in the clause on which they appear. iterator (iterators-definition) iterators-definition: iterator-specifier [, iterators-definition ] iterators-specifier: [ iterator-type ] identifier = range-specification identifier: A base language identifier. range-specification: begin : end[: step] begin, end: Expressions for which their types can be converted to iterator-type step: An integral expression. iterator-type: A type name. C/C++ iterator-type: A type specifier. For