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