FDVM_DD (1158349), страница 5
Текст из файла (страница 5)
* creating distributed array
dvm000(i+1) = crtda(dvm000(j),i0000m,n,...)
. . .
* aligning distributed array
dvm000(i+2) = align(dvm000(j),dvm000(iamv),n,...)
* copying distributed arrays
dvm000(i+3) = arrcpy(array-header,...,dvm000(j),...)
4.4 Input/Output (io.cpp module)
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, | ||
| SgStatement | *stmt | ) | ||||
| 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, | ||
| SgStatement | *stmt | ) | ||||
| 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, | ||
| SgStatement | *stmt | ) | ||||
| 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, | ||
| SgExpression | *ioc[], | |||||
| int | type | ) | ||||
| 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, | ||
| SgExpression | *ioc[] | ) | ||||
| 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, | ||
| SgExpression | *ioc[] | ) | ||||
| 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, | ||
| SgStatement | *stmt | ) | ||||
| 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)
}
DO label In+2 = 0, Nn+2-1. . . n+2 k
DO label Ik = 0, Nk-1
}
DO label In+1 = 0, Nn+1-1, snif (In+1 .LE. Nn+1) then
m = sn n+1 k
else
m = Nn+1 - In+1
endif
input:
IF(tstio( ) .eq. 0 ) READ (...) (BUF(j), j = 1, N1 * ...*Nn * m)
| n 1 |
copying-arrray-section (BUF(1 : N1 * ...*Nl* m),
| n 1 |
A(1: N1,...,1:Nn , In+1 +1: In+1 +m , In+2 +1, ..., Ik +1) )
| n 1 | n+1 k | n+2 k |
output:
copying-arrray-section (BUF(1 : N1 * ...*Nl* m),
n 1
A(1: N1,...,1:Nn , In+1 +1: In+1 +m , In+2 +1, ..., Ik +1) )
| n 1 | n+1 k | n+2 k |
IF(tstio( ) .eq. 0 ) WRITE (...) (BUF(j), j = 1, N1 * ...*Nn * m)
| n 1 |
label CONTINUE
(An operation of copying-arrray-section is implemented by function arrcpy( ).)
4.5 Inserting new statements in parse tree (stmt.cpp module)
| void | InsertNewStatementAfter | ( | SgStatement | *stat, | ||
| SgStatement | *current, | |||||
| SgStatement | *cp | ) | ||||
| stat | - pointer to the inserted statement | |||||
| current | - pointer to the statement stat is inserted after | |||||
| cp | - pointer to the control parent | |||||
The statement stat is inserted in the parse tree (program) after statement current and its control parent is cp.
| void | InsertNewStatementBefore | ( | SgStatement | *stat, | ||
| SgStatement | *current | ) | ||||
| stat | - pointer to the inserted statement | |||||
| current | - pointer to the statement stat is inserted before | |||||
The statement stat is inserted in the parse tree (program) before statement current.
| void | doAssignStmt | ( | SgExpression | *re | ) | |
| re | - pointer to the expression that is the right part of the assignment statement | |||||
Creates the assign statement with right part re :
dvm000(i) = re
and inserts it before the statement where (global variable).
| SgExpression | *LeftPart_AssignStmt | ( | SgExpression | *re | ) | |
| re | - pointer to the expression that is the right part of the assignment statement | |||||
Creates the assign statement with right part re :
dvm000(i) = re
and inserts it before the statement where (global variable). The function returns left part of this statement.
| void | doAssignTo | ( | SgExpression | *le, | ||
| SgExpression | *re | ) | ||||
| le | - pointer to the expression that is the left part of the assignment statement | |||||
| re | - pointer to the expression that is the right part of the assignment statement | |||||
Creates the assign statement:















