rtsIDe (1158448), страница 20
Текст из файла (страница 20)
2 "SHADOW" type access;
3 "FULL SHADOW" type access;
4 "REMOTE" type access (remote access).
Access type is defined in the following way. Let PS be the processor system, specified parallel loop is mapped on. Then
-
The access is local one, if at each processor of PS system all distributed array elements, required for the loop execution, belong to the array local part;
-
The access is "SHADOW" type access if at each processor of PS system all required elements of distributed array belong to the array local part, extended by shadow edges;
-
The access is "FULL SHADOW" type access if at each processor of PS system all required elements of the array belong to the array local part, extended by full shadow edge;
-
The access is remote ("REMOTE") if at least one processor of PS at least one required element of the array doesn't belong to the array local part, extended by full shadow edge;
If access has "SHADOW" or "FULL SHADOW" type, distributed array shadow edge widths, specified when the array was created, are written to LowShdWidthArray and HiShdWidthArray arrays.
In the case of remote access rmkind_ function calls crtrbl_ function to create remote element buffer with BufferHeader header.
15Non-regular access to remote data
A scheme of non-regular access to the remote elements of distributed array is similar to scheme of the regular access, considered in section 14. But its application area is restricted by the arrays, having the only distributed dimension (all other dimensions are replicated). The remote elements, required in the current processor buffer, are specified by a set of the index vectors of the form:
| {C1} ... {Ck-1} | U{ ME[Vk,J+1] M: 0 ≤ J < ME[Vk,0] } |
| {Ck+1} … {Cn} | , |
where:
| N | | rank of distributed array; |
| K | | number of its distributed dimension; |
| Ck, ... ,Ck-1,Ck+1, … ,Cn | | integer non-negative numbers (constant sampling rules for replicated dimensions); |
| ME | | matrix of global indexes (or index matrix); |
| Vk , J | | index variables of sampling rule of distributed dimension; |
| Vk,init , Vk,last | | initial and last values of index variable Vk for the current processor. |
The index matrix ME is the distributed array, with the first distributed dimension and the second replicated one (the segment [Vk,init, Vk,last] is the local part of the index matrix by the first dimension for the current processor). The size Size2 of the second dimension of the matrix ME is equal to
MAX(ME[Vk,0]) + 1 , where Size1 the size of its first dimension. 0 Vk < Size1
The meaning of the index matrix elements are:
| ME[Vk,0] | | for each Vk: the number of corresponding to it coordinates of the distributed dimension of the array; |
| ME[Vk,J] | | for each Vk and J: the value of the coordinate of the distributed dimension of the array (0 J < ME[Vk,0]). |
15.1Creating remote element buffer of non-regular access
| long crtib_ ( | long | ArrayHeader[], |
| ArrayHeader | | header of the distributed array. |
| BufferHeader | | header of the remote element buffer to be created. |
| BasePtr | | base pointer for an access to remote element buffer. |
| *StaticSignPtr | | flag of static buffer creation. |
| MEHeader | | header of the index matrix. |
| ConstArray | | array, which i-th element is the constant of the remote element sampling for (I+1)-th dimension of the distributed array (Ci+1). |
The function crtib_ creates a buffer to allocate the remote elements of the distributed array with the header ArrayHeader, satisfying to remote access conditions.
The header BufferHeader of the created buffer is the array of 3 elements of "long" type. The buffer header allocation in memory (static or dynamic) is performed by a user program, but its initialization is performed by Run-Time System when executing the function crtib_.
The base pointer BasePtr must refer to any variable of the same type as the type of the distributed array elements (the variable value is irrelevant).
In detail dealing with the header of remote elements buffer and the base pointer is considered in section 15.5.
If the flag *StaticSignPtr is not equal to zero, then the created buffer will not be deleted, when the control exits the a program block (see section 8). Such buffer can be deleted only explicitly using the function delib_ considered below.
The index matrix header MEHeader is the array of 3 elements of "long" type. When the function crtib_ is called, the index matrix and the distributed array must be allocated in the memory (mapped).
A value of ConstArray[k-1] is irrelevant (k is a number of the distributed dimension of the array with header ArrayHeader).
The function returns zero.
15.2Starting loading remote element buffer of non-regular access
long loadib_ (long BufferHeader[]);
BufferHeader header of the remote element buffer of non-regular access.
The function loadib_ initializes loading specified buffer by the distributed array elements, for which the buffer was created by the function crtib_.
The function returns zero.
15.3Waiting for completion of loading remote element buffer of non-regular access
long waitib_ (long BufferHeader[]);
BufferHeader header of the remote element buffer of non-regular access.
The function returns zero.
15.4Deleting råmote element buffer of non-òegular access
long delib_ (long BufferHeader[]);
BufferHeader header of the remote element buffer to be deleted.
The remote element buffer can be deleted by delib_ function only if it was created in the current subtask and in the current program block (or its sub-block (see sections 8 and 10).
To delete remote element buffer the function delobj_ can also be (see section 17.5).
The function returns zero.
15.5Access to remote elements, allocated in the buffer
At any processor the remote element buffer of non-regular access is similar to a local part of two-dimensional distributed array. Therefore its header may be declared, for example, as
long BufferHeader[3];
The access to allocated in the buffer remote element, is implemented by index variables of sampling rule of the array distributed dimension (by the index variables of the matrix of global indexes):
BasePtr[ BufferHeader[1]*Vk + J + BufferHeader[2] ] ,
where:
| BasePtr | | base pointer, corresponding to the element type of the distributed array; |
| Vk , J | | the index variables of 1-th и 2-th dimensions of global index matrix. |
For C language the value of the base pointer can be specified equal to NULL in the function crtib_ call. Then the access to the allocated in the buffer remote element can be performed as follows:
( (Type *)BufferHeader[2] )[ BufferHeader[1]*Vk + J ] ,
where Type is the type of the distributed array elements.
The coefficient BufferHeader[1] and the address constant BufferHeader[2] are calculated by Run-Time System when executing the function crtrb_ in the following way.
Let:
| BufferPtr | | address of remote element buffer; |
| TypeSize | | size in bytes of distributed array element. |
Then:
| BufferHeader[1] = | MAX( ME[Vk,0] ); |
BufferHeader[2] = BufferHeader[1] * Vk,init;
| | { | BufferHeader[2] ((long)BufferPtr (long)BasePtr) / TypeSize if BasePtr NULL; BufferHeader[2]*TypeSize (long)BufferPtr if BasePtr = NULL. |
Note. To access to the råmote elements, allocated in the buffer, the functions and macros, considered in section 13, can be used. When they are used:
-
the buffer header is necessary to use instead of the distributed array header;
-
the array rank is equal to 2;
-
the vector of the index variables values (Vk and J) of the distributed dimension sampling rule is used as the index vector of the element.
15.6Creating group of remote element buffers of non-regular access
| IndirectAccessGroupRef crtig_ ( | long | *StaticSignPtr, |
| *StaticSignPtr | | flag of creating static group of buffers. |
| *DelBufSignPtr | | flag of deleting all buffers, included in the group, when deleting the group. |
The function crtbg_ creates an empty buffer group (not containing buffers) and returns a reference to the group.
If the flag *StaticSignPtr of static group is not equal to zero, then the created group will not be deleted, when the control exits the program block (see section 8). Such group can be deleted only explicitly using the function delig_, considered below.
If *DelBufSignPtr is not equal to zero, then all included in the group buffers will be deleted when the group is deleted. If deleting is explicit, all included buffers are deleted explicitly , and if deleting is implicit, the ones are deleted implicitly.
15.7Including remote element buffer of non-regular access in the group
| long insib_ ( | IndirectAccessGroupRef | *IndirectAccessGroupRefPtr, |
| *IndirectAccessGroupRefPtr | | reference to the buffer group. |
| BufferHeader | | header of the buffer to be included. |
The function returns zero.
15.8Starting loading remote element buffers of specified group
long loadig_ (IndirectAccessGroupRef *IndirectAccessGroupRefPtr);
*IndirectAccessGroupRefPtr reference to the buffer group.
The function returns zero.
15.9Waiting for completion of loading remote element buffers of specified group
long waitig_ (IndirectAccessGroupRef *IndirectAccessGroupRefPtr);
*IndirectAccessGroupRefPtr reference to the buffer group.
The function returns zero.
15.10Deleting group of remote element buffers of non-regular access
long delig_ (IndirectAccessGroupRef *IndirectAccessGroupRefPtr);
*IndirectAccessGroupRefPtr reference to the buffer group to be deleted.















