rtsIDe (1158448), страница 8
Текст из файла (страница 8)
When the function align_ is called the parameters of the alignment rule Fj(I1,...,In)= {Aj*Ik + Bj} for the j-th pattern dimension have to be defined as follows:
| AxisArray[j-1] | contains value k; |
| CoeffArray[j-1] | contains value Aj; |
| ConstArray[j-1] | contains value Bj. |
To define alignment rule Fj(I1, ... ,In) with image in set of all values of the index variable of j-th dimension of template for any I1, ... ,In, the value AxisArray[j-1] (k value) has to be set to -1. The values CoeffArray[j-1] and ConstArray[j-1] are irrelevant in this case.
The number of the alignment rules has to be equal to the rank of the pattern, when the function align_ is called.
The function returns non-zero value, if mapped array has a local part on the current processor, and zero otherwise.
Note. The distributed array mapping, specified for function align_, may be implemented only in the case, if for all the processors, at least one array element is mapped onto, a local size of each array dimension, obtained as a result of mapping, is not less than widths of high and low shadow edges of the dimension.
7.2Alignments superposition
Let the function G defines the location of the n-dimensional array in the space of the r-dimensional pattern; and let the function P defines the location of the r-dimensional array in the space of the m-dimensional pattern:
| G((I1, ... ,Ii, ... ,In)) = | G1(I1, ... ,Ii, ... ,In) |
| P((J1, ... ,Jj, ... ,Jr)) = | P1(J1, ... ,Jj, ... ,Jr) |
Then the result of alignment P (by function align_) of r-dimensional array PatternDA in m-dimensional pattern Pattern space; and of next alignment G of n-dimensional array DA in r-dimensional array PatternDA space is alignment F of n-dimensional array DA in m-dimensional pattern Pattern space. F is a product (superposition) of P and G:
| F((I1, ... ,Ii, ... ,In)) = P * G = | U{P(v)} = V G((I1, ... ,In)) | F1(I1, ... ,Ii, ... ,In) |
The coordinate alignment rules Fs (0 s m) from F mapping are a superposition of the coordinate alignment rules for P and G mappings:
1. Let Ps((J1, ... ,Jr)) = { q Ms: 0 q MAXs } , where:
| MAXs | | maximum of the index variable of the s-th dimension of Pattern; |
| Ms | | range of values of the index variable of the pattern Pattern s-th dimension. |
Then Fs(I1, ... ,In) ) = Ms, that is the full replication of the array DA along the s-th dimension of the pattern Pattern.
| 2. | Let | Ps((J1, ... ,Jr)) = Cs*Jk + Ds and |
where:
| Jk | | index variable of the k-th dimension of the array PatternDA; |
| Il | | index variable of the l-th dimension of the array DA; |
| Cs, Qs | | integers; |
| Dk, Rk | | nonnegative integers. |
Then Fs((I1, ... ,In)) = As*Il + Bs , where As = Cs*Qk and Bs = Cs*Rk + Ds.
| 3. | Let | Ps((J1, ... ,Jr)) = Cs*Jk + Ds and |
where:
| Jk | | index variable of the k-th dimension of the array PatternDA; |
| Cs | | integer; |
| Ds | | nonnegative integer; |
| MAXk | | maximum of the index variable of the k-th dimension of the array PatternDA; |
| Mk | | range of values of the index variable of the PatternDA array k-th dimension. |
Then
| Fs((I1, ... ,In)) = | U {Cs*Jk + Ds} , |
that is the partial replication (stretched by the linear function Ps) of the array DA along the s-th dimension of the pattern Pattern.
The described alignment F is equivalent to the sequence of the alignments P and G. Consider the case, when the pattern Pattern is not an abstract machine representation. Then it is aligned by some function Q with another pattern. In this case, the alignment functions F and Q may be substituted by their superposition Q*F. So, the resulting alignment of the array DA with the abstract machine representation can be built substituting sequential alignment functions by their superposition (Run-Time System does it to align the array DA by the pattern PatternDA when the function align_ is called).
7.3Realigning distributed array
| long realn_( | long | ArrayHeader[], |
| ArrayHeader | | the header of the distributed array to be realigned. |
| *PatternRefPtr | | reference to the alignment pattern. |
| AxisArray | | array, which j-th element is a dimension number of the distributed array used in linear alignment rule for pattern (j+1)-th dimension. |
| CoeffArray | | array, which j-th element is a coefficient for the distributed array index variable used in linear alignment rule for the pattern (j+1)-th dimension. |
| ConstArray | | array, which j-th element is a constant used in the linear alignment rule for the pattern (j+1)-th dimension. |
| *NewSignPtr | | the flag of updating of the distributed array (to be equal to 1). |
The function realn_ cancels the allocation of the distributed array with header *ArrayHeaderPtr, defined previously by the function align_(or malign_, see section 7.5). The function sets a new allocation for this array according to the parameters AxisArray, CoefArray and ConstArray. If this array has been used as pattern of alignment of some arrays, nevertheless the allocations of these arrays are not changed.
As remapped distributed array, as alignment pattern must be mapped on the current processor system or its subsystem (perhaps, each one on its own).
The contents of realigned array will be updated (cleared), if the value *NewSignPtr is not equal zero and will be kept in other case. When the array is remapped, the values of its shadow edges (see section 12) are not kept.
The array can be realigned by function realn_ only, if it was created by the function crtda_ with parameter *ReDistrParPtr equal to 2 or 3 (see section 6).
The distributed array, specified in the function call, can be not mapped earlier. In this case realn_ function is executed as align_ function, and *NewSignPtr parameter value is irrelevant. *ReDistrParPtr parameter value of the distributed array creation is also irrelevant.
The funcôion returns non-zero, if realigned array has a local part on the current processor, and zero in other case.
7.4Requesting map
| ArrayMapRef arrmap_( | long | ArrayHeader[], |
| ArrayHeader | | header of the distributed array. |
| *StaticSignPtr | | flag of static map creation. |
The function arrmap_ creates an object (a map), describing current mapping of the distributed array onto the processor system representation, and returns a reference to the created object.
The map contains in particular the following information:
-
a reference to the abstract machine representation that distributed array is mapped on;
-
alligning rules for all dimensions of the representation;
-
the ranks of the distributed array and the abstract machine representation (for checking).
If flag of static map *StaticSignPtr is not equal to zero, then the map will not be deleted when control exits a program block (see section 8). Such map can be deleted only explicitly by function delarm_ considered in section 7.7.
7.5Specifying distributed array mapping according to map
| long malign_( | long | ArrayHeader[], |
| ArrayHeader | | header of the distributed array. |
| *AMViewRefPtr | | reference to the abstract machine representation, being alignment pattern. |
| *ArrayMapRefPtr | | reference to map of the distributed array. |
The function malign_ performs distributed array mapping onto abstract machine representation according to map.















