fdvmDDe (1158418), страница 5
Текст из файла (страница 5)
DO label I1 = ...
. . .
DO label In = ...
loop-body
label CONTINUE
is translated into
[ ACROSS-block-1 ]
[ REDUCTION-block-1 ]
* creating parallel loop
ipl = crtpl(n)
[ SHADOW-RENEW-block-1 ]
[ SHADOW-START-block ]
[ SHADOW-WAIT-block ]
* mapping parallel loop (1)
it = mappl(ipl,A,...)
[ SHADOW-RENEW-block-2 ]
[ REDUCTION-block-2 ]
[ REMOTE-ACCESS-block ]
* inquiry of continuation of parallel loop execution
lab1 if(dopl(ipl) .eq. 0) go to lab2
DO label I1 = ...
. . .
DO label In = ...
loop-body
label CONTINUE
go to lab1
* terminating parallel loop
lab2 it = endpl(ipl)
[ ACROSS-block-2 ]
[ REDUCTION-block-3 ]
The function generates and inserts in procedure all the statements preceeding the DO nest. In addition, the initial, end and step value of do-variables in parallel DO-nest are changed. The statements following end statement of parallel loop:
label CONTINUE
are generated by TransFunc( ) when this statement is processing.
If compilation mode is set on debugging, the CALL statements:
call dbegpl(...)
call diter(...)
call dendl(...)
are created and inserted in block (1) 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 (1).
The following functions are called to create blocks implementing ACROSS, SHADOW_RENEW, REDUCTION, and REMOTE_ACCESS specifications:
DepList
ShadowList
doIfForReduction
ReductionList
RemoteVariableList
void ParallelLoop_Debug ( SgStatement *stmt )
| stmt | - pointer to the PARALLEL 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. This function generates the REDUCTION-block-1 and REDUCTION-block-2 if need be.
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 ReductionList ( | SgExpression | *el, | ||
| el | - reduction list | |||
| gref | - pointer to the reduction group reference expression | |||
| st | - pointer to the PARALLEL directive with REDUCTION clause containing the reduction list el | |||
| stmt1 | - pointer to the statement after which the new statements is inserted | |||
| stmt2 | - pointer to the statement after which the new statements is inserted | |||
Generates and inserts in procedure the statements:
* creating reduction
dvm000(irv) = crtrgf(reduction-function, red-var,…)
* including reduction in reduction group
dvm000(i) = insred(gref,dvm000(irv),…)
for each reduction in reduction list. The first statement is inserted after stmt1 and the second one after stmt2.
| void ShadowList ( | SgExpression | *el, | ||
| el | - renewee-list | |||
| st | - pointer to the PARALLEL directive with SHADOW_RENEW clause or to the SHADOW_GROUP directive containing the renewee-list el | |||
| gref | - pointer to the shadow group reference expression | |||
Generates and inserts in procedure the statement:
* including shadow edge in the group
dvm000(i) = inssh(gref,array,...)
for each array in the renewee-list.
| void RemoteVariableList ( | SgSymbol | *group | ||
| group | - pointer to the symbol of group | |||
| rml | - array reference list | |||
| stmt | - pointer to the PARALLEL directive with REMOTE_ACCESS clause or to the REMOTE_ACCESS directive containing the array reference list rml | |||
The function generates and inserts in procedure the statements for reading remote data in buffer (REMOTE-ACCESS-block).
1) In case of synchronous REMOTE_ACCESS specification the following statements are generated:
{
* creating buffer array
it = crtrbl(array-header,buffer-header,…)
* starting load of buffer array
it = loadrb(buffer-header,0)
* waiting for completion of loading buffer array
it = waitrb(buffer-header)
* correcting coefficient CNB of buffer array elements addressing,
* where NB is rank of buffer array
buffer-header(NB+2) = buffer-header(NB+1)-
* buffer-header(NB)*buffer-header(NB+3) … -
* buffer-header(3)*buffer-header(2*NB+2)
}... for each remote-access reference
2) In case of asynchronous REMOTE_ACCESS specification (with group RMG) the following statements are generated:
IF (RMG(2) .EQ. 0) THEN
{
* creating buffer array
it = crtrbl(array-header,buffer-header,…)
* correcting coefficient CNB of buffer array elements addressing
buffer-header(NB+2) = buffer-header(NB+1)-
* buffer-header(NB)*buffer-header(NB+3) … -
* buffer-header(3)*buffer-header(2*NB+2)
* starting load of buffer array
it = loadrb(buffer-header,0)
* waiting for completion of loading buffer array
it = waitrb(buffer-header)
* including buffer array in group RMG
it = insrb(RMG(1),buffer-header)
}... for each remote-access reference
ELSE
IF (RMG(3) .EQ. 1) THEN
* waiting for completion of loading all the buffer arrays of group
it = waitbg(RMG(1))
RMG(3) = 0
ENDIF
ENDIF
5.2Translating input/output statements (module io.cpp)
The compiler module io.cpp involves the functions for translating input/output statements.
In DVM model, input, output and other operations with external files are executed by single processor ( I/O processor ), which is determined by run-time system. I/O of a replicated variable deals with variable copy allocated on I/O processor. I/O of a distributed array deals with buffer array allocated on I/O processor. Inputted data are sent to all other processors owing the variables of input list. When the distributed array is outputted, data are transferred into the buffer from other processors owing elements of the array.
| int TestIOList ( | SgExpression | *iol, | ||
| iol | - I/O item list | |||
| stmt | - pointer to the I/O statement | |||
The function analyzes input/output item list. If there are not any distributed array references in the list, this function returns 1, else it returns 0.
Calls ImplicitLoopTest( ) , IOitemTest( ).
| int ImplicitLoopTest( | SgExpression | *eim, | ||
| eim | - pointer to the implicit loop | |||
| stmt | - pointer to the I/O statement | |||
The function analyzes item list of implicit loop. If there are not any distributed array references in the list, this function returns 1, else it returns 0.
| int IOitemTest ( | SgExpression | *e, | ||
| e | - pointer to item of I/O list | |||
| stmt | - pointer to the I/O statement | |||
If the I/O item is not a distributed array reference this function returns 1, else it returns 0.
| int IOcontrol ( | SgExpression | *e, | ||
| e | - control information list | |||
| ioc | - array of I/O control parameters | |||
| type | - variant tag of I/O statement(PRINT_STAT, WRITE_STAT, READ_STAT) | |||
The function analyzes the control information list of the data transfer statement and assigns the value of control parameters (UNIT,FMT,ERR, and so on) to the elements of array ioc[]. If there are some syntax errors it returns 0, else 1.
| int control_list1 ( | SgExpression | *e, | ||
| e | - control information list | |||
| ioc | - array of I/O control parameters | |||
The function analyzes the control information list of the BACKSPACE, REWIND and ENDFILE statement and assigns the value of control parameters (UNIT,ERR, and so on) to the elements of array ioc[]. If there are some syntax errors it returns 0, else 1.
| int control_list_open ( | SgExpression | *e, | ||
| e | - control information list | |||
| ioc | - array of I/O control parameters | |||
The function analyzes the control information list of the OPEN, CLOSE and INQUIRE statement and assigns the value of control parameters (UNIT,ERR, and so on) to the elements of array ioc[]. If there are some syntax errors it returns 0, else 1.
| void IO_ThroughBuffer( | SgSymbol | *ar, | ||
| e | - pointer to the symbol of distributed array | |||
| stmt | - pointer to the I/O statement | |||
In case of I/O of distributed array the memory is allocated in user program for buffer I/O.
Let A(N1,N2,...,Nk) is distributed array of rank k, BUF(L) - vector of the same type as array A (named i000io if A is of type integer, or r000io if A is of type real,...).
The function replaces a statement I/O of A with the sequence of statements according to the following scheme:
s0 = L
si = [si-1 / Ni] i {1 : k}
n = max(i)
si 0, i{0 : k}
m = 1 (if n = k)















