正在加载图片...
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, namespace￾scope, 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 id￾expression (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-type￾modifier[,] ...]] map-type:] list) map-type: alloc, to, from, tofrom map-type-modifier: always, close Continued4
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有