rtsIDe (1158448), страница 7
Текст из файла (страница 7)
The base pointer BasePtr has to point to any variable of the same type as that of distributed array element. The value of this variable is not essential because the base pointer is only used to access to the elements from the local part of the distributed array.
The structure and usage of distributed array header (jointly with base pointer) to access to the array local part are considered in section 13.4.
If the flag *StaticSignPtr of the static array creation is not equal to zero, then the created distributed array is not deleted automatically when the control exits from the current program block (see section 8). Such array has to be deleted explicitly using the function delda_.
The parameter *ReDistrParPtr may have the following values:
| 0 | | the array can not be an argument of the function redis_ and can not be redistributed by the function realn_; |
| 1 | | the array can be an argument of the function redis_, but can not be redistributed by the function realn_; |
| 2 | | the array can be redistributed by the function realn_, but this array can not be used in defining the abstract machine representation using the function redis_; |
| 3 | | the array can be used as a reference to the abstract machine representation in the function redis_, and the array can be redistributed by the function realn_. |
The number of the parameters defined in the arrays LowShdWidthArray and HiShdWidthArray (that is the width of low and high shadow edges) has to be equal to the created array rank. See section 12 for more detail description of the shadow edges of the distributed array local parts. Note, that the shadow edge width can be equal to zero.
The function returns zero.
6.2Deleting distributed array
long delda_(long ArrayHeader[]);
ArrayHeader – the header of the array to be deleted.
The function deletes the distributed array created by the function crtda_. After array deleting the user program can use distributed array header for any goal.
The distributed array can be deleted by delda_ function only if it was created in the current subtask and in the current program block (or its sub-block) (see sections 8 and 10). All edge groups, in which the array was included, (see section 12) will be deleted also.
A distributed array can be deleted also by the function delobj_ (see section 17.5).
The function returns zero.
6.3Creating additional header of distributed array
| long addhdr_ ( | long | NewArrayHeader[], |
| NewArrayHeader | | header to be created. |
| ArrayHeader | | one of the existing headers. |
The function creates the distributed array header, which further will be used equitably with existing headers. In particular it can be used to create other additional headers.
When the distributed array is aligned by functions align_ and malign_ (see section 7) all its headers are initialized. The array realigning by the functions realn_, mrealn_, redis_ and mredis_ (see sections 5 and 7) also causes all its headers updating.
The function returns zero.
6.4Deleting distributed array header
long delhdr_ (long ArrayHeader[]);
ArrayHeader header to be deleted.
The function deletes the header, created by addhdr_ function or specified in crtda_ funcôion call. The only header of distributed array can't be deleted.
The function returns zero.
7Mapping distributed array
7.1Aligning distributed array
| long align_ ( | long | ArrayHeader[], |
| ArrayHeader | | the header of the distributed array to be aligned. |
| *PatternRefPtr | | reference to the alignment pattern. |
| AxisArray | | array, which j-th element is a dimension number of the distributed array used in the linear alignment rule for the pattern (j+1)-th dimension. |
| CoeffArray | | array, which j-th element is a coefficient for distributed array index variable used in the 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. |
The function align_ defines the location of the specified distributed array in the assigned abstract machine representation space (in other words the function aligns the distributed array). Besides, the elements of the array are distributed among the child abstract machines incorporating in the representation. The abstract machine representation is defined by means of the pattern, which can be as the representation itself, or a distributed array (this is called "indirect mapping"). In the last case the reference to the pattern is a first word of distributed array header.
Using the distributed array as a pattern is allowed only if this array has already been mapped on an abstract machine representation. Moreover, using an abstract machine representation as a pattern is allowed only if this representation has been mapped on a processor system. So the function align_ only distributes elements of the aligned distributed array among processors from this processor system.
Aligning pattern can be mapped (as final result) on the current processor system or its subsystem only.
It is not allowed to map already mapped distributed array.
Consider distributed array alignment in detail. Let F be a multifunctional with the domain of definition in a space of indexes of the aligned array and with the image in the space of indexes of the pattern:
| F( (I1, ... ,Ii, ... ,In) ) = | F1(I1, ... ,Ii, ... ,In) |
where:
| | | is a symbol of the Cartesian product; |
| n | | rank of the distributed array; |
| m | | rank of the pattern; |
| Ii | | index variable of the i-th dimension of the aligned array; |
| Fj | | multifunction, which range of value is a range of index variable of pattern j-th dimension. |
An alignment of the distributed array with the pattern is a defining the F multifunction. This defining designates that an element (I1, ... ,In) of an aligned array has to be located on the processor if and only if some pattern elements from F((I1, ... ,In)) set are mapped on this processor. The set F((I1, ... ,In)) is an image-set, and components of this set are vectors of space of indexes of the pattern.
The F1, ... , Fm functions are named "coordinate alignment rules". Run-Time System provides the following set of alignment rules.
-
Fj(I1, ... ,In) = {Aj*Ik + Bj} , where:
| k=f(j) | | dimension number of an aligned array (1 k n, f(j1) f(j2) when j1 j2); |
| Aj | | integer; |
| Bj | | nonnegative integer. |
This alignment rule means that for each element (I1,…, In) of index space of the aligned array the corresponding image-set contains one element – Aj*Ik + Bj. This element belongs to the value range of the index variable of the pattern j-th dimension.
Note, that Aj and Bj have to meet the following requirements:
0 Bj MAXj; and 0 Aj*MAXk + Bj MAXj , where:
| MAXj | | maximum of the index variable of the j-th dimension; |
| MAXk | | maximum of the index variable of the aligned array k-th dimension. |
-
Fj(I1, ... ,In) = {q Mj: 0 q MAXj} , where:
| Mj | | range of values of the index value of the pattern j-th dimension; |
| MAXj | | maximum of the index variable of the pattern j-th. |
This mapping rule means that for each element (I1,…, In) of index space of the aligned array a corresponding image-set, consists of whole range of values of index variable of the pattern j-th dimension. In such a case, the symbol "*" ("any of the admissible") is usually used.
Examples.
-
Alignment rule F( (I1,I2) ) = {I1} {I2} means that element of two-dimensional array has to be mapped onto any processor, an element of two-dimensional pattern is mapped on, if the indexes of both elements are equal.
-
Alignment rule F( (I1,I2) ) = {*} {I1+5} {*} means that the element of two-dimensional array has to be mapped onto any processor, an element of three-dimensional pattern is mapped on, if the index of the pattern second dimension is equal to the index of the aligned array first dimension plus 5. The index of the aligned array second dimension and the indexes of the pattern first and third dimension are not considered.
-
Alignment rule F( (I1,I2,I3) ) = {*} {*} means, that each element of three-dimensional array has to be mapped onto each processor, any element of two-dimension pattern is mapped on. The indexes of the aligned array and of the pattern are not considered.
-
Alignment rule F( (I1,I2) ) = {0} {1} {2} means, that an element of two-dimensional array has to be mapped onto each processor, the element (0,1,2) of three-dimensional pattern is mapped on. The indexes of aligned array are not considered.
Defining the aligned array distribution among pattern space (that is the defining F1, ... ,Fm functions) it is necessary to take into account that all elements of the distributed array have to be inside the pattern space. Observance of correct mapping on each stage of a chain of alignments guarantees the correct final distribution of array elements among the processors.
Note that if an array is used as a pattern, then after realignment of this array by the function realn_ (see section 7.3), the array aligned with this pattern keeps its location.















