LIBDVM2 (1158351), страница 11
Текст из файла (страница 11)
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 Library 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. A shadow edge of a distributed array includes low (high) shadow edge of k-th dimension, if it contains all allowable by other dimensions elementary shadow parallelepipeds, for which Mk = M1,k(M2,k). The dimension k participates in shadow edge forming, if it includes low or high shadow edge of this dimension. The dimension k don't participate in the distributed array shadow edge forming, if the shadow edge contains only the elementary shadow parallelepipeds, for which Mk = M0,k.
| long insshd_( | ShadowGroupRef | *ShadowGroupRefPtr, |
| *ShadowGroupRefPtr | - pointer to the shadow edge group. |
| ArrayHeader | - 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 |
| *MaxShadowCountPtr | - maximal number of array dimensions, which can take part in shadow edge forming (positive number). |
| ShadowSignArray | - array, which i-th element contains participation flag of the (i+1)-th dimension of the array in shadow edge forming. |
The widths of the array shadow edges, specified by the parameters LowShadowWidthArray and HiShadowWidthArray, 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 ShadowSignArray, can have the following values:
0 - (i+1)-th dimension doesn't participate in shadow edge forming;
1 - shadow edge has to include low shadow edge of (i+1)-th dimension;
2 - shadow edge has to include high shadow edge of (i+1)-th dimension;
3 - shadow edge has to include as low as high shadow edges of (i+1)-th dimension;
The array ShadowSignArray has to contain at least one non-zero element.
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 *MaxShadowCountPtr = 1 and all elements of the array ShadowSignArray are equal to 3. To include the full shadow edge of the distributed array in the shadow edge group using the function insshd_ the parameter *MaxShadowCountPtr has be equal to the distributed array rank, and all elements of the array ShadowSignArray has also to be equal to 3.
12.3. Starting shadow edge group renewing.
long strtsh_ (ShadowGroupRef *ShadowGroupRefPtr);
*SShadowGroupRefPtr - pointer to the shadow edge group.
The function strtsh_ initializes the system renewing buffer (if the shadow edge group is renewed at first time) and starts the shadow edge renewing operation for all shadow edges registered by the function inssh_. It is not allowed to include new distributed array shadow edges in the group after the first start of the shadow edge renewing.
The function returns zero.
12.4. Initializating receiving imported elements of specified shadow edge group.
long recvsh_(ShadowGroupRefPtr *ShadowGroupRefPtr);
*ShadowGroupRefPtr - pointer to a shadow edges group.
Waiting for completion of receiving imported elements is performed by the function waitsh_ (see section 12.6).
The function returns zero.
12.5. Initializing sending exported elements of specified shadow edges group.
long sendsh_ (ShadowGroupRefPtr *ShadowGroupRefPtr);
*ShadowGroupRefPtr - pointer to a shadow edges group.
Waiting for completion of sending exported elements is performed by the function waitsh_ (see section 12.6).
The function returns zero.
Note. The sequence of function calls
recvsh_(ShadowGroupRefPtr);
sendsh_(ShadowGroupRefPtr);
is equivalent to the call
strtsh_(ShadowGroupRefPtr);
12.6. Waiting for completion of shadow edge group renewing.
long waitsh_(ShadowGroupRef *ShadowGroupRefPtr);
*ShadowGroupRefPtr - pointer to the shadow edge group.
The function returns zero.
12.7. Deleting shadow edge group.
long delshg_(ShadowGroupRef *ShadowGroupRefPtr);
*ShadowGroupRefPtr - pointer to the shadow edge group.
The function delshg_ deletes the shadow edge group created by the function the crtshg_. After deleting of the group the pointer to this group can be used by user program for any goal.
Note, that non-static shadow edge group can be deleted by the function delshg_ only if it was created in the current program block.
The function returns zero.
13. Access to distributed array elements.
13.1. Coping distributed array element.
13.1.1. Reading distributed array element and assigning value to element.
| long rwelm_( | long | FromArrayHeader[], |
| FromArrayHeader | - the header to the source distributed array or the pointer to the source memory area. |
| ToArrayHeader | - the header to the distributed array, which contains the target element, or the pointer to the target memory area. |
| IndexArray | - array, which i-th element is an index of the source or target element on the (i+1)-th dimension. |
If the function rwelm_ is used to read the element of the distributed array, then:
| FromArrayHeader | - the header of the distributed array containing the source element; |
| ToArrayHeader | - pointer to the target memory area; |
| IndexArray | - array of the indexes of the source element. |
If the function rwelm_ is used to assign the value to the element of the distributed array, then:
| FromArrayHeader | - pointer to the source memory area; |
| ToArrayHeader | - the header of the distributed array, containing the target element; |
| IndexArray | - array of the indexes of the target element. |
Reading is executed on all the processors. Writing (modification of the element of the distributed array) is executed only on the processors, where the element is allocated.
The number of the indexes in the array IndexArray has to be equal to the rank of the source or target array.
The function returns the number of bytes actually read or written (that is the element size of the source or target array).
Note. To avoid warnings from Fortran-compiler when the function rwelm_ is called with different types of variables, the distributed array element will be assigned to, Run-Time Library provides the function
| long rwelmf_ ( | long | FromArrayHeader[], |
distinguished from the function rwelm_ in the second parameter:
| *ToArrayHeaderPtr | - pointer to a memory area, the distributed array element cast to type AddrType by one of the functions from section 17.7 will be written in. |
Other parameters of the function rwelmf_ are similar to the corresponding parameters of the function rwelm_.
13.1.2. Copying one element of distributed array to another.
| long copelm_ ( | long | FromArrayHeader[], |
| FromArrayHeader | - the header of the source distributed array. |
| FromIndexArray | - array, which i-th element is the index of the source element on the (i+1)-th dimension. |
| ToArrayHeader | - the header of the target distributed array. |
| ToIndexArray | - array, which j-th element is the index of the target element on the (i+1)-th dimension. |
The types of the source and target elements have to be the same. The function returns the number of the copied bytes.
13.1.3. Unified coping of element of distributed array.
| long elmcpy_( | long | FromArrayHeader[], |
| FromArrayHeader | - the header of the source distributed array, or the pointer to the source memory area. |
| FromIndexArray | - array, which i-th element is the index of the source element on the (i+1)-th dimension. |
| ToArrayHeader | - the header of the target distributed array. |
| ToIndexArray | - array, which j-th element is the index of the target element on the (i+1)-th dimension. |
| *CopyRegimPtr | - the mode of copying. |
The function elmcpy_ is a generalization of the more specialized functions rwelm_ and copelm_ discussed above.
If FromArrayHeader and ToArrayHeader are the headers of the distributed arrays, then the types of the elements of this arrays have to be the same.
If FromArrayHeader (ToArrayHeader) is the pointer to the memory area, then the values of the array FromIndexArray (ToIndexArray) is ignored. In this case, the copying is controlled by the *CopyRegimPtr flag. If *CopyRegimPtr is not equal to zero, then the memory is assumed to be allocated on the I/O processor only. The pointers FromArrayHeader and ToArrayHeader must not be both the pointers to a memory area.
The function returns the number of the copied bytes.
13.2. Coping distributed arrays.
| long arrcpy_( | long | FromArrayHeader[], |















