rtsIDe (1158448), страница 5
Текст из файла (страница 5)
The BLSIZEk value is determined as follows. Let:
| AMSIZEk | | the size of the k-th dimension of the abstract machine representation; |
| PSSIZEj | | the size of the j-th dimension of the processor system. |
Then:
| BLSIZEk = { | min(DistrParamArray[j-1], AMSIZEk) if DistrParamArray[j-1] ≠ 0; (AMSIZEk-1) / PSSIZEj] + 1 if DistrParamArray[j-1] = 0. |
Note, that the maximum value of Ik is
min( (PSSIZEj * BLSIZEk 1) , AMSIZEk 1 ).
Therefore, to use the mapping rule for the whole range of the k-th dimension of the abstract machine representation the following is required:
AMSIZEk PSSIZEj * BLSIZEk ,
that is true, when
DistrParamArray[j-1] AMSIZEk / PSSIZEj
or when
DistrParamArray[j-1] = 0.
-
Fj(I1, ... ,In) = {q Mj: 0 q PSSIZEj-1} , where:
| Mj | | range of values of the index variable of the processor system j-th imension. |
This mapping rule means that for each element (I1,…, In) of index space of the abstract machine representation the corresponding image-set consists of the whole range of values of the index variable of the processor system j-th dimension. In such a case, the symbol "*" ("any of the admissible") is usually used.
-
Fj(I1, ... ,In) = { Const } , where 0 Const PSSIZEj-1 .
This mapping rule means that for each element (i1,…, in) of index space of the abstract machine representation the corresponding image-set contains one element Const belonging to the range of values of the index variable of the processor system j-th dimension.
As a result of mapping of specified representation of parental abstract machine on specified processor system, performed by distr_ function, every element of the representation (i.e. descendant abstract machine) will be matched with a processor system (a set of processors, which is an image of the representation element for F mapping function considered above). The abstract machine together with its processor image forms parallel subtask. The subtask is activated (started) when control enters corresponding parallel loop iteration. The subtask execution is parallel loop iteration execution (see section 9). Another way of parallel subtask creation and startup is considered in section 10.
Examples.
-
Let the abstract machine and the processor systems be defined by matrices:
| AM[9][8] | (0 I1 8 , 0 I2 7); |
| PS[3][4] | (0 J1 2 , 0 J2 3). |
Then the function F( (I1,I2) ) = {[I1/3]} {[I2/2]} sets the following correspondence:
element PS[j1][j2] sub-matrix AM[3*j1 I1 3*j1 + 2][2*j2 I2 2*j2 + 1] (block [3][2]).
-
Let the abstract machine and the processor systems be defined as arrays:
| AM[12] | (0 I 11); |
| PS[4][3] | (0 J1 3 , 0 J2 2). |
Then the function F( (I) ) = {2} {[I/4]} sets the following correspondence:
element PS[2][j2] vector AM[4*j2 I 4*j2 + 3] (block [4]).
The image of F does not include rows 0, 1 and 3 of the processor system.
-
Let the abstract machine and the processor systems be defined as arrays:
| AM[8][12] | (0 I1 7 , 0 I2 11); |
| PS[3] | (0 J 2). |
Then the function F( (I1,I2) ) = {[I2/4]} sets the following correspondence:
element PS[j] sub-matrix AM[0 I1 7][4*j I2 4*j + 3] (block [8][4]).
-
Let the abstract machine and the processor systems be defined as arrays:
| AM[12] | (0 I 11); |
| PS[4][3] | (0 J1 3 , 0 J2 2). |
Then the function F( (I) ) = {*} {[I/4]} sets the following correspondence:
element PS[j1][j2] vector AM[4*j2 I 4*j2 + 3] (block [4]).
That is, the image of F from the b) example is replicated along rows of the processor system.
-
Let the abstract machine and the processor systems be defined as matrices:
| AM[9][8] | (0 I1 8 , 0 I2 7); |
| PS[3][4] | (0 J1 2 , 0 J2 3). |
Then the function F( (I1,I2) ) = {*} {*} sets the following correspondence:
element PS[j1][j2] sub-matrix AM[0 I1 8][0 I2 7] (block [9][8]),
that is the whole space of the abstract machine representation.
Note. If an abstract machine representation from an example e) is given as template for the function align_ (realn_), then fully replicated distributed array (each element of an array is represented on each virtual processor, see section 7.1) can be obtained.
When the function distr_ is called, the coordinate mapping rule Fj(I1, ..., In) = { [Ik/BLSIZEk] } for j-th dimension of the processor system is defined as following:
| AxisArray[j-1] | contains value k; |
| DistrParamArray[j-1] | contains value BLSIZEk. |
If DistrParamArray[j-1] is equal to zero, then Run-Time System evaluates BLSIZEk as described above.
To specify rule Fj(I1, ... ,In), with image in set of all values of index variable of j-th dimension of processor system for any I1, ... ,In, value AxisArray[j-1] (value k) must be set to zero. The value DistrParamArray[j-1] is irrelevant in this case.
The mapping rule Fj(I1, ... ,In) = { Const } is defined as follows:
| AxisArray[j-1] | = -1; |
| DistrParamArray[j-1] | contains value Const. |
The function returns non-zero, if mapped representation has local part on current processor, and zero in other case.
5.2Remapping abstract machine representation onto processor system (resource redistribution)
| long redis_ ( | AMViewRef | *AMViewRefPtr, |
| *AMViewRefPtr | | reference to the parental abstract machine representation, which mapping has to be redistributed. |
| *PSRefPtr | | reference to the processor system, which defines resource structure of a new distribution. |
| *ParamCountPtr | | the number of parameters, defined in arrays AxisArray and DistrParamArray. |
| AxisArray | | array, which j-th element is a dimension number of the abstract machine representation used in the mapping rule for processor system (j+1)-th dimension. |
| DistrParamArray | | array, which j-th element is a mapping rule parameter for parallel system (j+1)-th dimension (DistrParamArray[j] is a nonnegative integer). |
| *NewSignPtr | | the flag that defines whether to save contents of realigned arrays or not. |
The function redis_ cancels the resource distribuôion of the parental abstract machine previously defined for child abstract machines from *AMViewRefPtr representation by the function distr_ (or mdistr_ , see section 5.4). The function defines new distribution of this representation according to specified parameters. All the distributed arrays aligned with this representation by the function align_ and malign_ (whether directly or not), are remapped according to old alignment rules (see section 7). If the value *NewSignPtr is not equal zero, then the arrays will be updated (cleared), and will be kept in other case. When the arrays are remapped, the values of their shadow edges (see section 12) is not kept.
All elements of specified representation must be terminals of abstract machine hierarchy (must not have descendants).
All processors of the system, specified by *PSRefPtr reference, must belong to elementary intersection of the current processor system and the processor system, the parental processor system is mapped on. If *PSRefPtr = 0 or PSRefPtr = NULL, the current processor system will be used for resource distribution.
Remapped representation may be specified indirectly, if a header of distributed array, created by the function crtda_ with parameter *ReDistrParPtr equal to 1 or 3, is used as parameter *AMViewRefPtr (see section 6).
The abstract machine representation, passed in the function call, can be not mapped earlier. In this case redis_ function is executed as distr_ function, and *NewSignPtr parameter value is irrelevant.
The function returns non-zero, if remapped representation has a local part on the current processor, and zero in the other case.
5.3Requesting map
| AMViewMapRef amvmap_ ( | AMViewRef | AMViewRefPtr, |
| *AMViewRefPtr | | reference to the abstract machine representation. |
| *StaticSignPtr | | flag of static map creation. |
The function amvmap_ creates an object (a map), describing the current mapping of abstract machine representation onto the processor system, and returns a reference to the created object.
The map of the abstract machine representation contains in particular the following information:
-
the reference to the processor subsystem that the abstract machine representation is mapped onto;
-
mapping rules for all dimensions of the processor subsystem;
-
the ranks of abstract machine representation and the processor subsystem (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 the function delmvm_ considered in section 5.6.
5.4Specifying abstract machine representation mapping according to map
| long mdistr_ ( | AMViewRef | *AMViewRefPtr, |
| *AMViewRefPtr | | reference to the abstract machine representation to be mapped. |
| *PSRefPtr | | reference to the processor system, determining distributed resource structure. |
| *AMViewMapRefPtr | | reference to the map of the abstract machine representation. |
The function mdistr_ specifies mapping the abstract machine representation onto specified processor subsystem according to the map.















