@@ -156,21 +156,18 @@ \section{Memory Allocators}
156
156
An allocator is initialized for the \scode {target} region in the \scode {uses_allocators} clause,
157
157
and the traits specified in \splc {cgroup_traits} are included by the \scode {traits} modifier.
158
158
159
- As shown above, the \scode {uses_allocators} clause creates a new allocator for the
160
- \scode {target} region, and uses only traits specified in the clause with a modifier.
161
159
In CASE 3, the \splc {cgroup_alloc} variable is initialized on the host with traits
162
- and a memory space. However, these are ignored by the \scode {uses_allocators} clause,
163
- because a new allocator is initialized, and has no traits specified within the clause .
160
+ and a memory space. However, these are ignored by the \scode {uses_allocators} clause
161
+ and a new allocator for the \scode {target} region is initialized with default traits .
164
162
165
163
\cexample [5.2]{allocators}{5}
166
164
\ffreeexample [5.2]{allocators}{5}
167
165
168
- The following example shows how to make an allocator, defined on the host, available in a \scode {target} region.
166
+ \index {dynamic_allocators clause@\scode {dynamic_allocators} clause}
167
+ \index {clauses!dynamic_allocators@\scode {dynamic_allocators}}
169
168
170
- When the \scode {requires} directive is specified with a \scode {dynamic_allocators}
171
- clause, allocators initialized on the host can be used in a \scode {target} region
172
- without specifying a \scode {uses_allocators} clause. This applies to predefined
173
- allocators and user-defined allocators.
169
+ The following example shows how to make an allocator available in a \scode {target} region
170
+ without specifying a \scode {uses_allocators} clause.
174
171
175
172
In CASE 1, the predefined \scode {omp_cgroup_mem_alloc} allocator is used in the \scode {target}
176
173
region as in CASE 1 of the previous example, but without specifying a \scode {uses_allocators} clause.
@@ -179,9 +176,14 @@ \section{Memory Allocators}
179
176
restrictions on allocator usage in \scode {target} regions.
180
177
181
178
CASE 2 also uses the \scode {dynamic_allocators} clause to remove allocator
182
- restrictions in the \scode {target} region. Here, an allocator initialized
183
- on the host is used for target array allocations of an \scode {allocate} clause.
184
-
179
+ restrictions in \scode {target} regions. Here, an allocator is initialized
180
+ by calling the \scode {omp_init_allocator} routine in the \code {target} region.
181
+ The allocator is then used for the allocations of array \plc {xbuf} in
182
+ an \scode {allocate} clause of the \code {target}~\code {teams} construct
183
+ for each team and destroyed after its use.
184
+ The use of separate \code {target} regions is needed here since
185
+ no statement is allowed between a \code {target} directive and
186
+ its nested \code {teams} construct.
185
187
186
188
\cexample [5.2]{allocators}{6}
187
189
\ffreeexample [5.2]{allocators}{6}
0 commit comments