128
A. Tabuchi et al.
Fig. 4 XACC code with enter_data directive
memory. Note that a is globally-indexed. In line 9, the data directive transfers the
whole of b from host memory to accelerator memory.
2.2 Work Mapping
In order to parallelize a loop statement among nodes and on accelerators, the XMP
loop directive and OpenACC loop directive are used. While an XMP loop
directive parallelizes a loop statement among nodes, an OpenACC loop directive
further parallelizes the loop statement on accelerators within each node. For ease of
writing, the nesting order of XMP loop directive and OpenACC loop directive
does not matter.
When an acc clause appears in an XMP loop directive with a reduction
clause, the directive performs a reduction operation for the variable specified in the
reduction clause on accelerator memory.
Restriction
• In an OpenACC compute region, no XMP directives except for loop directive
without reduction clauses is allowed.
• In an OpenACC compute region, the parameter (i.e., the lower bound, upper
bound, and step) of the target loop must remain unchanged.
• An acc clause can be specified in an XMP loop directive only when a
reduction clause is also specified.
Example 1
In lines 2–6 of Fig. 5, the directives declare global arrays a and b. In line 8, the
copy clause on the parallel directive transfers a and b from host memory
A. Tabuchi et al.
Fig. 4 XACC code with enter_data directive
memory. Note that a is globally-indexed. In line 9, the data directive transfers the
whole of b from host memory to accelerator memory.
2.2 Work Mapping
In order to parallelize a loop statement among nodes and on accelerators, the XMP
loop directive and OpenACC loop directive are used. While an XMP loop
directive parallelizes a loop statement among nodes, an OpenACC loop directive
further parallelizes the loop statement on accelerators within each node. For ease of
writing, the nesting order of XMP loop directive and OpenACC loop directive
does not matter.
When an acc clause appears in an XMP loop directive with a reduction
clause, the directive performs a reduction operation for the variable specified in the
reduction clause on accelerator memory.
Restriction
• In an OpenACC compute region, no XMP directives except for loop directive
without reduction clauses is allowed.
• In an OpenACC compute region, the parameter (i.e., the lower bound, upper
bound, and step) of the target loop must remain unchanged.
• An acc clause can be specified in an XMP loop directive only when a
reduction clause is also specified.
Example 1
In lines 2–6 of Fig. 5, the directives declare global arrays a and b. In line 8, the
copy clause on the parallel directive transfers a and b from host memory
