rtsIDe (1158448), страница 16
Текст из файла (страница 16)
To use a full scope of the source or target array without requesting the size of the object by some dimension (see section 17.2), Run-Time System supposes that the value of the initial index value can be equal to -1. In that case, the initial index value is supposed to be equal to zero, the step be equal to 1, and the last index value be equal to the size of the dimension minus 1.
One of the arrays (but not the both) can be not distributed but rather a normal one replicated among all the processors (Run-Time System determines this case if the pointer of the array is not the pointer to the header of the distributed array). The types of the elements of replicated and distributed arrays must be the same. It is assumed that the replicated array is one-dimensional, and that the elements of this array are allocated in the memory consequently and continuously. Run-Time System ignores the parameters of the indexes of such array.
If the one of the arrays is not a distributed one, then the copy mode is determined by the value of the *CopyRegimPtr flag:
-
if *CopyRegimPtr is zero, "usual" ("normal") array is considered to be located on all the processors of the current processor system;
-
if the flag *CopyRegimPtr is positive, then Run-Time System assumes that the "normal" array is allocated on the I/O processor only;
-
if *CopyRegimPtr is negative (it is allowable only for "normal" array to be read), then the distributed array, specified by the parameter ToArrayHeader, will be filled by an element with address, specified by the parameter FromArrayHeader.
If both arrays are non-distributed ones, then the copying is not executed.
If both arrays are distributed ones, then these arrays can be different in the rank and in the size of each dimension, but the types of the element of the arrays have to be the same.
As read distributed array as written one must be mapped in the processor systems, which each element must belong to the current processor system.
The function returns the number of the copied elements.
13.3Asynchronous coping distributed arrays
| long arwelm_ ( | long | FromArrayHeader[], |
| long arwelf_ ( | long | FromArrayHeader[], |
| long acopel_( | long | FromArrayHeader[], |
| long aelmcp_ ( | long | FromArrayHeader[], |
| long aarrcp_ ( | long | FromArrayHeader[], |
Described above functions arwelm_, arwelf_, acopel_, aelmcp_ and aarrcp_ starts coping operations, executed by the functions rwelm_, rwelmf_, copelm_, elmcpy_, and arrcpy_. All parameters of considered functions, except of the last one, are similar to the same named parameters of their synchronous analogous. The last parameter CopyFlagPtr is the pointer to the flag of completion of the started coping operation.
Waiting for completion of coping is performed by the function
long waitcp_ (AddrType *CopyFlagPtr);
*CopyFlagPtr flag of coping operation completion, specified when starting the operation.
The function returns zero.
13.4Access to elements of local part of distributed array
Let n be the rank of the distributed array. Then the header of this array in the function crtda_ call with zero value of *ExtHdrSignPtr parameter can be declared for example as:
long ArrayHeader[n+1]; /* standard header */
Let the base pointer corresponding to the type of the elements of the distributed array be BasePtr. Then the element (I1, ... , In) from the local part of the distributed array can be accessed through linear index in the following manner:
| | n-1 |
For C the value of the base pointer in crtda_ function call may be NULL. In that case the element of the local part of the distributed array may be accessed in the following manner:
| | n-1 |
where Type is the type of the element of the distributed array.
Run-Time System calculates the coefficients ArrayHeader[1], ... ,ArrayHeader[n-1] and the address constant ArrayHeader[n] in the functions of the array alignment align_ and realn_ in the following manner.
Let:
| Ii,init | | the initial index value of the local part of the distributed array on the i-th dimension; |
| Ii,last | | the last index value of the local part of the distributed array on the i-th dimension; |
| LWi | | the width of the low shadow edge of the distributed array on the i-th dimension; |
| HWi | | the width of the high shadow edge of the distributed array on the i-th dimension; |
| ArrayPtr | | pointer to the local part of the array (that is the part allocated in the memory together with the shadow edges); |
| TypeSize | | the size of the element of the distributed array (in bytes). |
Then:
|
| n |
| | n-1 |
| ArrayHeader[n] = | ArrayHeader[n] ( (long)ArrayPtr (long)BasePtr )/TypeSize | if BasePtr ≠ NULL, if BasePtr = NULL. |
In crtda_ function call with non-zero *ExtHdrSignPtr parameter the distributed array header can be statically specified as
long ArrayHeader[2*n+2]; /* extended header */
Fist (n+1) words of extended header coincide with standard header, considered above. The words from (n+2) to (2*n+1) must be specified by user's program before the array allocating in the memory by align_ (malign) function (it is assumed, that these words will contain low values of distributed array indexes, used in Fortran). When mapping or remapping the array on processor system Run-Time System calculates (n+1)-th word of extended header as
| | n i=2 |
Note, that Run-Time System allocates (during the execution of the functions align_ and realn_) the local part of the distributed array in the memory in so manner that the difference (ArrayPtr – BasePtr) must be multiple of the TypeSize.
The access to the elements of the local part of the distributed array is performed either directly by its header and the base pointer, or by the functions rlocel_, wlocel_ and clocel_ (that is less effective) described below.
13.4.1Requesting if array element is allocated in local part of distributed array
| long tstelm_( | long | ArrayHeader[], |
| ArrayHeader | | header of distributed array. |
| IndexArray | | IndexArray[i] is the index of the element of the distributed array by (i+1)-th dimension. |
The number of specified indexes has to be equal to the rank of the distributed array.
The function returns non-zero value, if specified element is allocated in the local part of the specified distributed array, and zero in other case.
13.4.2Requesting initial and last index values of local part of distributed array
| long locind_( | long | ArrayHeader[], |
| ArrayHeader | | header of distributed array. |
| InitIndexArray | | array, which i-th element will be assigned by initial value of the index of the local part of distributed array on (i+1)-th dimension. |
| LastIndexArray | | array, which i-th element will be assigned by last value of the index of the local part of the distributed array on (i+1)-th dimension. |
The sizes of the arrays InitIndexArray and LastIndexArray must be equal to the distributed array rank.
The function returns non-zero value, if the specified array has a local part and zero in other case. If the array has no the local part, the arrays InitIndexArray and LastIndexArray are not updated.
13.4.3Reading element of local part of distributed array
| long rlocel_( | long | ArrayHeader[], |
| ArrayHeader | | a header of the distributed array. |
| IndexArray | | array, which i-th element is index value of read element of the distributed array on (i+1)-th dimension. |
| BufferPtr | | pointer to the memory area, the element will be written in. |
The function can be executed successfully only by the processor, in whose memory the specified element is allocated.
The size of distributed array element in bytes (a number of read bytes) is returned.
13.4.4Assigning value to element of local part of distributed array
| long wlocel_( | void | *BufferPtr, |
| ArrayHeader | | a header of the distributed array. |
| IndexArray | | array, which i-th element is index value of modified element of the distributed array on (i+1)-th dimension. |
| BufferPtr | | pointer to the memory area, where the value is located. |
The function can be executed successfully only by the processor, in whose memory the specified element is located.















