fdvmDDe (1158418), страница 7
Текст из файла (страница 7)
The function is called from DistArrayRef( ) when an assignment statement inside the range of INDEPENDENT loop is processing.
| void *IND_UsedDistArrayRef( | SgExpression | *e, | |
| e | - pointer to the distributed array element reference | ||
| st | - pointer to the assignment statement which contains the expression e | ||
The function determines the kind of reference and includes it in the list (IND_refs) which is processed by function RemoteVariableListIND( ). The function calls function IND_DistArrayRef( ) to linearize the reference.
The function is called from DistArrayRef( ) when an executable statement inside the range of INDEPENDENT loop is processing.
| void *IND_DistArrayRef( | SgExpression | *e, | |
| e | - pointer to the distributed array element reference | ||
| st | - pointer to the assignment statement which contains the expression e | ||
| el | - pointer to the element of reference list | ||
Linearizes distributed array element reference in right part of assignment statement, that is, replaces the reference
A(I1,I2, ..., IN)
by
N
base(HeaderCopy(N+2) + HeaderCopy(N+1)*I1 + HeaderCopy(N-j+2) * Ij )
i=2
where HeaderCopy - array of coefficients for addressing this distributed array element
which are calculated as linear function of array header elements
base - i0000m , if A is of type integer
r0000m , if A is of type real
d0000m , if A is of type double precision
c0000m , if A is of type complex
l0000m , if A is of type logical
5.4.2INDEPENDENT loop
void IndependentLoop ( SgStatement *stmt )
| stmt | - pointer to the INDEPENDENT directive |
The INDEPENDENT loop nest:
*HPF$ INDEPENDENT
DO label I1 = ...
. . .
*HPF$ INDEPENDENT
DO label In = ...
loop-body
label CONTINUE
is translated into
* creating parallel loop
ipl = crtpl(n)
* mapping parallel loop
it = mappl(ipl,...)
[ inquiry-block ]
* inquiry of continuation of parallel loop execution
lab1 if(dopl(ipl) .eq. 0) go to lab2 (2)
DO label I1 = ...
. . .
DO label In = ...
loop-body
label CONTINUE
go to lab1
* terminating parallel loop
lab2 it = endpl(ipl)
The function generates and inserts in procedure all the statements preceeding the DO nest exept inquiry-block. Becides, the initial, end and step value of do-variables in parallel DO-nest are changed. The statements following last statement of parallel loop are generated by TransFunc( ) when it is processing. The inquiry-block is created by function RemoteVariableListIND( ).
If compilation mode is set on debugging, the CALL statements:
call dbegpl(...)
call diter(...)
call dendl(...)
are created and inserted in block (2) before IF statement, before first statement of parallel loop body ,and after the statement
go to lab1
accordingly.
If compilation mode is set on performance analyzing, the CALL statements:
call bploop(...)
call eloop(...)
are created and inserted before the first and after the last statement of the block (2).
void IndependentLoop_Debug ( SgStatement *stmt )
| stmt | - pointer to the INDEPENDENT directive |
If compilation mode is set on debugging, the CALL statements:
call dbegpl(...)
call diter(...)
are created and inserted before the DO loop nest and before the first statement of parallel loop body accordingly.
If compilation mode is set on performance analyzing, the CALL statements:
call bploop(...)
call eloop(...)
is created and inserted before and after the DO loop nest.
void RemoteVariableListIND ( )
If distributed array references occur in right part of assignment statements inside the range of INDEPENDENT loop, the following block of statements for reading remote data is generated:
ishg = 0
ibg = 0
{
* inquiring about kind of accessing distributed array element(s)
kind = rmkind(array-header,buffer-header,…,
* low-shadow-array,high-shadow-array)
IF (kind .EQ. 4) THEN
IF (ishg .EQ. 0) THEN
* creating remote data buffers group
ibg = crtbg(0,1)
ENDIF
* including buffer array in group RMG
it = insrb(ibg, buffer-header)
* calculating coefficients of array elements addressing
* NB is rank of buffer array
header-copy(1) = buffer-header(2)
. . .
header-copy(NB-1) = buffer-header(NB)
header-copy(NB) = 1
header-copy(NB+1) = buffer-header(NB+1)-
* buffer-header(NB)*buffer-header(NB+3) … -
* buffer-header(3)*buffer-header(2*NB+2)
ELSE
IF (kind .NE. 1) THEN
IF (ishg .EQ. 0) THEN
* creating shadow edges group
ishg = crtshg(0)
ENDIF
* including shadow edge in the group
* (with corner elements or not)
IF (kind .EQ. 2) THEN
it = inssh(ishg,array-header,low-shadow-array,
* high-shadow-array,0)
ELSE
it = inssh(ishg,array-header,low-shadow-array,
* high-shadow-array,1)
ENDIF
* calculating coefficients of array elements addressing
header-copy(1) = f1(array-header,IkN)
. . .
header-copy(NB) = f1(array-header,Ik1)
header-copy(NB+1) = f2(buffer-header(2:N+1),I1,…,IN)
ENDIF
}... for each occured distributed array reference
* renewing shadow edges group
IF (ishg .NE. 0) THEN
it = strtsh(ishg)
it = waitsh(ishg)
ENDIF
* loading remote data buffers group
IF (ibg .NE. 0) THEN
it = loadbg(ibg,1)
it = waitbg(ibg)
ENDIF
This block (inquiry-block) is inserted before first DO statement of INDEPENDENT loop nest.















