LIBDVM2 (1158351), страница 10
Текст из файла (страница 10)
*RedGroupRefPtr - pointer to the reduction group.
The function waitrd_ awaits the completion of the all reduction operations of the group. It is allowed to use all reduction variables from this group after completion of this function.
The function returns zero.
11.7. Deleting reduction group.
long delrg_ (RedGroupRef *RedGroupRefPtr);
*RedGroupRefPtr - pointer to the reduction group.
The function delrg_ deletes the reduction group created by the function crtrg_. After deleting the group the pointer to the group can be used by user program for any goals.
The function returns zero.
11.8. Deleting reduction.
long delred_ (RedGroupRef *RedGroupRefPtr);
*RedGroupRefPtr - pointer to the reduction group.
The function delred_ deletes the reduction descriptor created by the function crtred_. After deleting the descriptor the pointer to the descriptor can be used by user program for any goals.
The function returns zero.
12. Renewing shadow edges of distributed array.
Let the local part of the distributed array be represented as an aggregate of its elements defined as a set of the index tuples:
{I1 Î M1: I1,low I1 I1,high} x
. . . . . . . . . . . . . . . . . . . . . . . . . . . .
{Im Î Mm: Im,low Im Im,high} x
. . . . . . . . . . . . . . . . . . . . . . . . . . . .
{In Î Mn: In,low In In,high}
where:
| x | - symbol of Cartesian product; |
| n | - rank of the array; |
| Im | - index variable of the m-th dimension (1 m n); |
| Im,low | - the low value of the index variable of the m-th dimension; |
| Im,high | - the high value of the index variable of the m-th dimension; |
| Mm | - the range of values of the index variable of the m-th dimension. |
Suppose that the local part is entirely inside the array (for simplicity). Then low shadow edge of the local part of distributed array of k-th dimension is a set of its elements, defined by a set of the index corteges:
LSBk =
| {I1 | M1 | : I1,low | - FS * LW1 | I1 | I1,high | + FS * HW1 | }x |
| Here: | Lwi | - width of the low part of the shadow edge of i-th dimension; |
| Hwi | - width of the high part of the shadow edge of i-th dimension (parameters LowShadowWidthArray and HiShadowWidthArray of the functions crtda_ , section 6, and inssh_ , section12.2); | |
| FS | - flag of full edge (parameter *FullShadowSignPtr of the function inssh_, section 12.2). |
Similarly high shadow edge of the local part of the distributed array of k-th dimension is defined by the set of index corteges:
HSBk =
| {I1 | M1 | : I1,low | - FS * LW1 | I1 | I1,high | + FS * HW1 | }x |
The low (high) shadow edge of k-th dimension is called full, if FS=1, and is called low (high) shadow bound, if FS=0. The union of full shadow edges of all dimensions is called full shadow edge of the local part of the distributed array.
|
| n | FS=1 |
| n | ||||||||
| U( | {I1 | M1 | : I1,low | - LW1 | I1 | I1,high | + HW1 | }x |
| k=1 | {. . . . | . . . . . . . . | . . . . . . . . | . . . . . . . . | . . . . . . . . | . . . . . . . . . | . . . . . . . . . | }x |
| {Ik-1 | Mk-1 | :Ik-1,low | - LWk-1 | Ik-1 | Ik-1,high | + HWk-1 | }x | |
| {Ik | Mk | :Ik,low | - LWk | Ik | Ik,high | - 1 | }x | |
| {Ik | Mk | :Ik,high | + 1 | Ik | Ik,high | + HWk | }x | |
| {Ik+1 | Mk+1 | :Ik+1,low | -LWk+1 | Ik+1 | Ik+1,high | + HWk+1 | }x | |
| {. . . . | . . . . . . . . | . . . . . . . . | . . . . . . . . | . . . . . . . . | . . . . . . . . . . | . . . . . . . . . . | }x | |
| {In | Mn | :In,low | - LWn | In | In,high | + HWn | } |
Elements of the shadow edge of the local part of the distributed array are called shadow edge elements (or imported). These elements are allocated in the memory together with the local part. In the another side, each edge element belongs to some local part of the distributed array, and so it is allocated in the memory of the processor, this local part is mapped on. For this processor the element is called element-original (or exported element).
Renewing the shadow edges of the distributed array local parts is an asynchronous operation (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.1. Creating 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 pointer 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 section 8). Such shadow edge group has to be deleted explicitly using the function delshg_.
12.2. Including shadow edge in the group.
| long inssh_( | ShadowGroupRef | *ShadowGroupRefPtr, |
| *ShadowGroupRefPtr | - pointer to the shadow edge group. |
| ArrayHeader | - the header of the distributed array. |
| LowShadowWidthArray | - array, which i-th element is the width of the low shadow edge of the (i+1)-th dimension of the array. |
| HiShadowWidthArray | - array, which i-th element is the width of the high shadow edge of the (i+1)-th dimension of the array. |
| *FullShadowSignPtr | the flag of the inclusion of the «corner» elements to the shadow edge. |
Including distributed array shadow edge in the group means only registration of this shadow edge as a member of shadow edge group. Run-Time Library does not storage the values of this shadow edge in the system renewing buffer.
The widths of the array shadow edges defined by the LowShadowWidthArray and HiShadowWidthArray 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 *FullShadowSignPtr = 0, then only low and high shadow edges of all dimensions of the distributed array participate in shadow edge exchange operations. If *FullShadowSignPtr = 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 (2*n is a number of shadow bounds), and exchange of the full shadow edges requires the communication with 3n-1 neighbors (n is the rank of the distributed array). 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 Library 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 x ... x Mk x ... x Mn is corresponded to it, where:
| | { | M0,k = {Ik Mk: Ik,init | Ik Ik,last | } if qk = 0, |
| M1,k = {Ik Mk: Ik,init – LWk | Ik Ik,last –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.















