rtsIDe (1158448), страница 19
Текст из файла (страница 19)
The function returns zero.
14.5Access to distributed array elements, allocated in remote element buffer
Let r be the buffer rank (a number of remote distributed array dimensions, having non-constant linear sampling rules or being free). Then remote element buffer header, specified in crtrbl_ (crtrba_, crtrbp_) function call can be declared, for example, as
long BufferHeader[2*r+2];
Let also a base pointer, corresponding to remote distributed array element type be BasePtr. Then a remote element, defined by index vector (I1, ... ,Im, ... ,Ir), and located in the buffer local part, is referred by linear index in the following way:
| BasePtr[ | r-1 |
For C language the base pointer can be NULL in crtrbl_, crtrba_ and crtrbp_ function calls. Then the remote element, placed in the buffer local part, can be accessed as:
| | r-1 |
where Type is the type of the element of the remote distributed array.
For remote element buffer, created by crtrbl_ function.
Let m dimension of the buffer correspons to linear sampling rule of remote elements (bounded dimension) and, therefore, to some dimension k of a parallel loop. Then when accessing the buffer element a value of Im coordinate can be replaced by a value of the loop index variable Vk: Im = Vk – min(Vk,init , Vk,last) (Vk,init and Vk,last are initial and last values of the loop index variable Vk). It means, that the crossing from the buffer index space to the parallel loop index space involves a transition to distributed array-buffer with non-zero low index boundaries. Therefore to support access to the buffer elements by the loop index variables, when executing crtrbl_ Run-Time System for all bounded dimensions saves in the buffer header min(Vk,init , Vk,last) values as low shadow edges of the array dimensions (see description of extended header of distributed arrays in section 13.4). Low shadow edges of free buffer dimensions are set to zero in its header.
In C language to access to the buffer elements by parallel loop index variables the following macrocomands can be used:
| <DAElmType> RBElm<Rank> ( | long | BufferHeader[], |
| BufferHeader | | header of the remote element buffer. |
| Rank | | the buffer rank (1-7). |
| RBElmType | | type of the elements in the buffer. |
| Indexi | | index value of the requested element on the i-th dimension of the buffer. |
Each of these macros is L-value in the C language.
It is assumed, that when the buffer was created by crtrbl_ function the base pointer was equal to NULL.
14.6Creating group of remote element buffers
| RegularAccessGroupRef crtbg_ ( | 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 empty buffer group (containing no buffers) and returns 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 delbg_ 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, they are deleted implicitly.
14.7Including remote element buffer in the group
| long insrb_ ( | RegularAccessGroupRef | *RegularAccessGroupRefPtr, |
| *RegularAccessGroupRefPtr | | reference to the buffer group. |
| BufferHeader | | header of a buffer to be inserted. |
As the buffer group as the buffer to be included in the group must be created in the current subtask and can't be in loading state. The buffer can be reincluded in the group, but the buffer can't be included in the group, if it was included in the other group.
The function returns zero.
14.8Starting loading remote element buffers of specified group
| long loadbg_( | RegularAccessGroupRef | *RegularAccessGroupRefPtr, |
| *RegularAccessGroupRefPtr | | reference to the buffer group. |
| *RenewSignPtr | | flag of repeated reloading of already loaded buffer group. |
All buffers of the group, specified in the function call, must be mapped on the processor systems, which each element must belong to the current processor system.
The function loadbg_ can be used for already loaded buffer group. In this case actual reloading is performed if *RenewSignPtr is not equal to zero, and isn't performed otherwise. The buffer group reloading is prohibited (independently on *RenewSignPtr parameter value), if its previous loading (actual or dummy) was not completed by waitbg_ function (see section 14.9).
The function returns zero.
14.9Waiting for completion of loading remote element buffers of specified group
long waitbg_ (RegularAccessGroupRef *RegularAccessGroupRefPtr);
*RegularAccessGroupRefPtr reference to the buffer group.
Loading the buffer group, specified in the function call, must be started by the current subtask. Waiting for completion of not initialized earlier buffer group loading is not allowed.
The function returns zero.
14.10Deleting group of remote element buffers
long delbg_ (RegularAccessGroupRef *RegularAccessGroupRefPtr);
*RegularAccessGroupRefPtr a reference to the buffer group to be deleted.
The buffer group can be deleted by delbg_ 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 the buffer group the function delobj_ can also be used (see section 17.5).
The buffer group, which loading was not completed by waitbg_ function, can't be deleted.
If the buffer group was created by crtbg_ function with non-zero value of *DelBufSignPtr parameter, then when the group is deleted all remote elements buffers, included in the group, will be also deleted.
The function returns zero.
14.11Requesting type of distributed array element access
| long rmkind_ ( | long | ArrayHeader[], |
| ArrayHeader | | distributed array header. |
| BufferHeader | | header of created remote element buffer (for "REMOTE" type access). |
| BasePtr | | base pointer to access remote element buffer (for "REMOTE" type access). |
| *StaticSignPtr | | flag to create static buffer (for "REMOTE" type access). |
| *LoopRefPtr | | reference to parallel loop, requiring distributed array elements for its execution. |
| AxisArray | | array, which i-th element is parallel loop dimension number, corresponding to (i+1)-th dimension of distributed array. |
| CoeffArray | | array, which i-th element is index variable coefficient of linear sampling rule for (i+1)-th dimension of distributed array. |
| ConstArray | | array, which i-th element is constant of linear sampling rule for (i+1)-th dimension of distributed array. |
| LowShdWidthArray | | output array, in which i-th element low edge width of (i+1)-th dimension of distributed array will be written (for "SHADOW" or "FULL SHADOW" type access) |
| HiShdWidthArray | | output array, in which i-th element high edge width of (i+1)-th dimension of distributed array will be written (for "SHADOW" or "FULL SHADOW" type access) |
The function rmkind_ defines type of access to elements of distributed array with ArrayHeader header, which is required for execution of parallel loop, specified by *LoopRefPtr reference.
The array elements, required for the loop execution, are specified similarly to specifying remote array elements, required for parallel loop execution (see section 14.1). BufferHeader, BasePtr, StaticSignPtr, AxisArray, CoeffArray and ConstArray parameters are similarly to same named parameters of crtrbl_ function.
Distributed array must be mapped on processor system, which each element belongs to the current processor system. At the moment of the function call parallel loop must be current and mapped.
The function returns the following values, specifying access type:
1 local access;















