BindingThe binding task set for a targetdata region is the generating task. The targetdata
region binds to the region of the generating task.
DescriptionWhen a targetdata construct is encountered, the encountering task executes the region. If
there is no device clause, the default device is determined by the default-device-var ICV. When an if
clause is present and the if clause expression evaluates to false, the device is the host. Variables are
mapped for the extent of the region, according to any data-mapping attribute clauses, from the data
environment of the encountering task to the device data environment.
Pointers that appear in a use_device_ptr clause are privatized and the device pointers
to the corresponding list items in the device data environment are assigned into the private
versions.
List items that appear in a use_device_addr clause have the address of the corresponding object in the
device data environment inside the construct. For objects, any reference to the value of the object will be to
the corresponding object on the device, while references to the address will result in a valid device
address that points to that object. Array sections privatize the base of the array section and
assign the private copy to the address of the corresponding array section in the device data
environment.
If one or more of the use_device_ptr or use_device_addr clauses and one or more map
clauses are present on the same construct, the address conversions of use_device_addr and
use_device_ptr clauses will occur as if performed after all variables are mapped according to those
map clauses.
Execution Model Events
The events associated with entering a target data region are the same events as associated with a target enter
data construct, described in Section 2.12.3 on page 461.
The events associated with exiting a target data region are the same events as associated with a target exit
data construct, described in Section 2.12.4 on page 469.
Tool Callbacks
The tool callbacks dispatched when entering a target data region are the same as the tool callbacks
dispatched when encountering a target enter data construct, described in Section 2.12.3 on
page 461.
The tool callbacks dispatched when exiting a target data region are the same as the tool callbacks dispatched
when encountering a target exit data construct, described in Section 2.12.4 on page 469.
Restrictions
A
program
must
not
depend
on
any
ordering
of
the
evaluations
of
the
clauses
of
the
targetdata
directive,
except
as
explicitly
stated
for
map
clauses
relative
to
use_device_ptr
and
use_device_addr
clauses,
or
on
any
side
effects
of
the
evaluations
of
the
clauses.
At
most
one
device
clause
can
appear
on
the
directive.
The
device
clause
expression
must
evaluate
to
a
non-negative
integer
value
less
than
the
value
of
omp_get_num_devices()
or
to
the
value
of
omp_get_initial_device().
At
most
one
if
clause
can
appear
on
the
directive.
A
map-type
in
a
map
clause
must
be
to,
from,
tofrom
or
alloc.
At
least
one
map,
use_device_addr
or
use_device_ptr
clause
must
appear
on
the
directive.
A
list
item
in
a
use_device_ptr
clause
must
hold
the
address
of
an
object
that
has
a
corresponding
list
item
in
the
device
data
environment.
A
list
item
in
a
use_device_addr
clause
must
have
a
corresponding
list
item
in
the
device
data
environment.
A
list
item
that
specifies
a
given
variable
may
not
appear
in
more
than
one
use_device_ptr
clause.
A
reference
to
a
list
item
in
a
use_device_addr
clause
must
be
to
the
address
of
the
list
item.