SummaryThe targetupdate directive makes the corresponding list items in the device data
environment consistent with their original list items, according to the specified motion clauses. The
targetupdate construct is a stand-alone directive.
Syntax
The syntax of the targetupdate construct is as follows:
BindingThe binding task set for a targetupdate region is the generating task, which is the target task
generated by the targetupdate construct. The targetupdate region binds to the corresponding
target task region.
DescriptionFor each list item in a to or from clause there is a corresponding list item and an original list
item. If the corresponding list item is not present in the device data environment then no assignment occurs
to or from the original list item. Otherwise, each corresponding list item in the device data environment has
an original list item in the current task’s data environment. If a mapper() modifier appears in a to clause,
each list item is replaced with the list items that the given mapper specifies are to be mapped with a to or
tofrom map-type. If a mapper() modifier appears in a from clause, each list item is replaced
with the list items that the given mapper specifies are to be mapped with a from or tofrom
map-type.
For each list item in a from or a to clause:
For
each
part
of
the
list
item
that
is
an
attached
pointer:
On
exit
from
the
region
that
part
of
the
original
list
item
will
have
the
value
it
had
on
entry
to
the
region;
On
exit
from
the
region
that
part
of
the
corresponding
list
item
will
have
the
value
it
had
on
entry
to
the
region;
On
exit
from
the
region
that
part
of
the
original
list
item,
if
associated,
will
be
associated
with
the
same
pointer
target
with
which
it
was
associated
on
entry
to
the
region;
On
exit
from
the
region
that
part
of
the
corresponding
list
item,
if
associated,
will
be
associated
with
the
same
pointer
target
with
which
it
was
associated
on
entry
to
the
region.
For each part of the list item that is not an attached pointer:
If
the
clause
is
from,
the
value
of
that
part
of
the
corresponding
list
item
is
assigned
to
that
part
of
the
original
list
item;
If
the
clause
is
to,
the
value
of
that
part
of
the
original
list
item
is
assigned
to
that
part
of
the
corresponding
list
item.
To avoid data races:
Concurrent
reads
or
updates
of
any
part
of
the
original
list
item
must
be
synchronized
with
the
update
of
the
original
list
item
that
occurs
as
a
result
of
the
from
clause;
Concurrent
reads
or
updates
of
any
part
of
the
corresponding
list
item
must
be
synchronized
with
the
update
of
the
corresponding
list
item
that
occurs
as
a
result
of
the
to
clause.
The list items that appear in the to or from clauses may use shape-operators.
The list items that appear in the to or from clauses may include array sections with stride
expressions.
The targetupdate construct is a task generating construct. The generated task is a target task. The
generated task region encloses the targetupdate region.
All clauses are evaluated when the targetupdate construct is encountered. The data environment of
the target task is created according to the data-sharing attribute clauses on the targetupdate construct,
per-data environment ICVs, and any default data-sharing attribute rules that apply to the targetupdate
construct. A variable that is mapped in the targetupdate construct has a default data-sharing attribute
of shared in the data environment of the target task.
Assignment operations associated with mapping a variable (see Section 2.19.7.1 on page 939) occur when
the target task executes.
If the nowait clause is present, execution of the target task may be deferred. If the nowait clause is not
present, the target task is an included task.
If a depend clause is present, it is associated with the target task.
The device is specified in the device clause. If there is no device clause, the device is determined by the
default-device-var ICV. When an if clause is present and the if clause expression evaluates to false then
no assignments occur.
Execution Model Events
Events associated with a target task are the same as for the task construct defined in Section 2.10.1 on
page 384.
The target-update-begin event occurs when a thread enters a targetupdate region.
The target-update-end event occurs when a thread exits a targetupdate region.
Tool Callbacks
Callbacks associated with events for target tasks are the same as for the task construct defined in
Section 2.10.1 on page 384; (flags&ompt_task_target) always evaluates to true in the dispatched
callback.
A thread dispatches a registered ompt_callback_target callback with ompt_scope_begin as its
endpoint argument and ompt_target_update as its kind argument for each occurrence of a
target-update-begin event in that thread in the context of the target task on the host. Similarly, a thread
dispatches a registered ompt_callback_target callback with ompt_scope_end as its endpoint
argument and ompt_target_update as its kind argument for each occurrence of a target-update-end
event in that thread in the context of the target task on the host. These callbacks have type signature
ompt_callback_target_t.
Restrictions
A
program
must
not
depend
on
any
ordering
of
the
evaluations
of
the
clauses
of
the
targetupdate
directive,
or
on
any
side
effects
of
the
evaluations
of
the
clauses.
At
least
one
motion-clause
must
be
specified.
A
list
item
can
only
appear
in
a
to
or
from
clause,
but
not
both.
A
list
item
in
a
to
or
from
clause
must
have
a
mappable
type.
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.
At
most
one
nowait
clause
can
appear
on
the
directive.