10
H. Murai et al.
2 Data Mapping
2.1 nodes Directive
The nodes directive declares a node array, which is an array-like arrangement of
nodes in a node set. A node array can be multi-dimensional.
XcalableMP C
#pragma xmp nodes p[4]
XcalableMP Fortran
!$xmp nodes p(4)
The nodes directive declares a one-dimensional node array p that includes four
nodes. In XMP/C, it is zero-based and consists of p[0], p[1], p[2], and p[3].
In XMP/Fortran, it is one-based and consists of p(1), p(2), p(3), and p(4).
XcalableMP C
#pragma xmp nodes p[2][3]
XcalableMP Fortran
!$xmp nodes p(3,2)
The nodes directive declares two-dimensional node array p that includes six
nodes. In XMP/C, it consists of p[0][0], p[0][1], p[0][2], p[1][0],
p[1][1], and p[1][2]. In XMP/Fortran, it consists of p(1,1), p(2,1),
p(3,1), p(1,2), p(2,2), and p(3,2).
Note The ordering of the elements in a node array follows that of a normal array
in the base language, C or Fortran.
XcalableMP C
#pragma xmp nodes p[ * ]
XcalableMP Fortran
!$xmp nodes p( * )
An asterisk can be specified as the size in the nodes directive to declare a
dynamic node array. In the above code, one-dimensional dynamic node array p
is declared with an asterisk as the size. The actual size of a dynamic node array is
determined at runtime to fit the size of the current executing node set. For example,
when the programmer runs the sample code with three nodes, the node array p
includes three nodes.
The programmer can also declare multi-dimensional dynamic node arrays with
an asterisk.
XcalableMP C
#pragma xmp nodes p[ * ][3]
Précédent

- 18/265

Suivant