rtsIDe (1158448), страница 14
Текст из файла (страница 14)
Renewing the shadow edges of the distributed array local parts is an asynchronous operaôion (that is operation executed in parallel with computations). During this operation each element-original (possibly updated) is copied to the corresponding shadow edge element (possibly obsolete). For optimization purpose, the shadow edges of the distributed arrays are combined in a group, and shadow edge exchange is implemented as a set of operations, executed over the specified group of the shadow edges.
12.1Creating shadow edge group
ShadowGroupRef crtshg_(long *StaticSignPtr);
*StaticSignPtr the flag of the static shadow edge group creation.
The function crtshg_ creates empty shadow edge group (that is group that does not contain any shadow edge). The function returns reference to the created group.
If the flag *StaticSignPtr of the static shadow edge group creation is not equal to zero, then the created group does not deleted automatically when the control exits from the current program block (see sections 8). Such shadow edge group has to be deleted explicitly using the function delshg_.
12.2Including shadow edge in the group
| long inssh_ ( | ShadowGroupRef | *ShadowGroupRefPtr, |
| *ShadowGroupRefPtr | | reference to the shadow edge group. |
| ArrayHeader | | the header of the distributed array. |
| LowShdWidthArray | | array, which i-th element is the width of the low shadow edge of the (i+1)-th dimension of the array. |
| HiShdWidthArray | | array, which i-th element is the width of the high shadow edge of the (i+1)-th dimension of the array. |
| *FullShdSignPtr | | flag of full shadow edge renewing (if it is equal to one). |
Including distributed array shadow edge in the group means only registration of this shadow edge as a member of shadow edge group. Run-Time System does not storage the values of this shadow edge in the system renewing buffer.
Specified in the function call shadow edge group must be created in the current subtask. Before including in the shadow edge group the distributed array must be mapped on the processor system (by align_, realn_, malign_ or mrealn_ functions), which each element must belong to the current processor system.
The distributed array can be included in several shadow edge group and also reincluded in the same group. In the last case shadow edge widths, specified in inssh_ function call, must be equal to shadow edge widths, specified in previous inclusion in this group. It is not allowed to include the array in the group, that performs shadow edge exchange or receives (sends) imported (exported) elements. New elements can be included in such group only after completion of these operations (see strtsh_, recvsh_, sendsh_ and waitsh_ function description in sections 12.3-12.6).
The widths of the array shadow edges defined by the LowShdWidthArray and HiShdWidthArray parameters should not fall outside the limits of the shadow edge widths defined in the function crtda_ when the array was created. If the shadow edge width is equal to -1, then the width defined in the function crtda_ is used.
If *FullShdSignPtr = 0, then only low and high shadow edges of all dimensions of the distributed array participate in shadow edge exchange operations. If *FullShdSignPtr = 1, then the full shadow edge of the distributed array participates.
The function returns zero.
The exchange of shadow edges, that is the union of shadow bounds, requires a communication of the current processor with 2*n "neighbors" (n is the rank of the distributed array, 2*n is a number of shadow bounds), and exchange of the full shadow edges requires the communication with 3n-1 "neighbors". So if the shadow edge as union of shadow bounds don't cover task needs and full shadow edge exchange is inadmissible because of overheads, Run-Time System provides a possibility to choice sufficient and optimal scheme of shadow edges exchange. The scheme is based on a representation of the shadow edge as union of elementary shadow n-dimensional parallelepipeds.
Let Q = (q1, ... ,qk, ... ,qn) be n-combination with repetition from the elements of the set {0,1,2} (the combination (0, ... ,0) is not considered). Let n-dimensional parallelepiped PQ = M1 ... Mk ... Mn is corresponded to it, where:
| Mk = | { | M0,k = { Ik Mk: Ik,init | ≤ Ik ≤ Ik,last | } if qk = 0, |
| M1,k = { Ik Mk: Ik,init – LWk | ≤ Ik ≤ Ik,init – 1 | } if qk = 1, | ||
| M2,k = { Ik Mk: Ik,last + 1 | ≤ Ik ≤ Ik,last + HWk | } if qk = 2. |
Here:
| Ik | | index variable of k-th dimension of distributed array (1 k n); |
| Ik,init | | initial value of index variable of k-th dimension; |
| Ik,last | | last value of index variable of k-th dimension; |
| Mk | | range of index variable values of k-th dimension; |
| LWk | | width of low part of the edge of k-th dimension; |
| HWk | | width of high part of the edge of k-th dimension. |
The parallelepiped PQ is called elementary shadow n-dimensional parallelepiped.
The full shadow edge of the distributed array is a union of all elementary shadow parallelepipeds (except of the parallelepiped, corresponding to (0, ... ,0) combination and that is the local part of the distributed array). A number of elementary parallelepipeds, formed the full shadow edge, is A3n - 1 = 3n - 1.
Low (high) shadow bound of k-th dimension is elementary shadow parallelepiped, corresponding to n-combination, where qk = 1(2), and others qi are equal to zero.
Run-Time System allows to specify any set of elementary shadow parallelepipeds for shadow edge exchange using function insshd_, including a shadow edge of a distributed array into the edge group and described below.
| long insshd_ ( | ShadowGroupRef | *ShadowGroupRefPtr, |
| *ShadowGroupRefPtr | | reference to the shadow edge group. |
| ArrayHeader | | header of the distributed array. |
| LowShdWidthArray | | array, which i-th element is the width of the low shadow edge of the (i+1)-th dimension of the array. |
| HiShdWidthArray | | array, which i-th element is the width of the high shadow edge of the (i+1)-th dimension of the array. |
| *MaxShdCountPtr | | maximal possible number of dimensions which code of participation in shadow edge forming more then one for any elementary parallelepiped included in the shadow edge. |
| ShdSignArray | | array, which i-th element contains participation flag of the (i+1)-th dimension of the array in shadow edge forméng. |
The widths of the array shadow edges, specified by the parameters LowShdWidthArray and HiShdWidthArray, must not be more, then shadow edge widths, specified when the considered array was created by the function crtda_. If -1 is set as shadow edge width, then shadow edge width, specified when the array was created, will be used.
A participation flag of (i+1)-th dimension in the edge forming, specified in i-th element of array ShdSignArray, can have the following values:
| 1 | | the array shadow edge contains only those elementary parallelepipeds, for which Mi = M0,i; |
| 2 | | the shadow edge contains only those elementary parallelepipeds, for which Mi = M1,i; |
| 3 | | the shadow edge contains only those elementary parallelepipeds, for which Mi = M0,i or Mi = M1,i; |
| 4 | | the shadow edge contains only those elementary parallelepipeds, for which Mi = M2,i; |
| 5 | | the shadow edge contains only those elementary parallelepipeds, for which Mi = M0,i or Mi = M2,i; |
| 6 | | the shadow edge contains only those elementary parallelepipeds, for which Mi = M1,i or Mi = M2,i; |
| 7 | | the shadow edge must contain elementary parallelepipeds, with any set Mi (M0,i, M1,i or M2,i). |
The parameter *MaxShdCountPtr (positive number) restricts shadow shell of the local part of the distributed array, participating in the shadow edge exchange, by allowing to include in the shell only those elementary parallelepipeds, for which
| n |
|
That is, elementary parallelepipeds, for which a number of dimensions, violating the array local part, is more then *MaxShdCountPtr, can't be included in the shadow edge, participating in the exchange.
The array ShdSignArray must contain at least one element, more than 1 (shadow edge of distributed array must not coincide with its local part).
The function returns zero.
Note. Including shadow edges of distributed array in the shadow edge group using the function inssh_ is equivalent to execution of the function insshd_, if the parameter *MaxShdCountPtr = 1 and all elements of the array ShdSignArray are equal to 7. To include the full shadow edge of the distributed array in the shadow edge group using the function insshd_ the parameter *MaxShdCountPtr has be equal to the distributed array rank, and all elements of the array ShdSignArray has also to be equal to 7.
12.3Starting shadow edge group renewing
long strtsh_ (ShadowGroupRef *ShadowGroupRefPtr);















