正在加载图片...
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
向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有