rtsIDe (1158448), страница 23
Текст из файла (страница 23)
The function getrnk_ returns the rank of the object, defined by the reference *ObjectRefPtr.
The following entities can be used as objects:
-
a distributed array (in that case the reference is the first word of the array header);
-
a representation of the abstract machine;
-
a processor system;
-
map of the abstract machine representation;
-
map of the distributed array;
-
a parallel loop.
If the reference *ObjectRefPtr is not a reference to any of the mentioned above objects, then the function returns zero.
For the map (of array or abstract machine representation) the rank of the object, that is the source for the map, is returned.
17.2Requesting size of object dimension
| long getsiz_( | ObjectRef | *ObjectRefPtr, |
The function returns the size of the dimension *AxisPtr of the object, defined by the reference *ObjectRefPtr.
The following entities can be used as objects:
-
distributed array (in that case the reference to the object is the first word of the array header);
-
the representation of the abstract machine;
-
the processor system;
-
parallel loop.
The size of the distributed array dimension is equal to
ceil( (LastIndex - InitIndex + 1) / Step ) ,
where:
| InitIndex | initial value of the index variable of the parallel loop for the dimension *AxisPtr; |
| LastIndex | last value of the index variable of the parallel loop for the dimension *AxisPtr; |
| Step | step of the index variable of the parallel loop for the dimension *AxisPtr; |
| ceil | a function to get the least integer, not less than value of its argument. |
If *AxisPtr = 0, the size of the object (product of sizes of all dimensions) is returned.
If the reference *ObjectRefPtr is not a reference to any of the mentioned above objects, then the function returns zero.
| long locsiz_( | ObjectRef | *ObjectRefPtr, |
The function locsiz_ is similar to the function getsiz_, but it returns the local size of dimension *AxisPtr (or the local size of the object), i.e. the size of the object part, mapped on the current processor. If the object is a processor system, then the values, returned by the functions getsiz_ and locsiz_ are the same.
Note, that a local size of the object, having no a local part on the current processor, is equal to zero.
17.3Requesting if object is distributed array
long tstda_ (ObjectRef *ObjectRefPtr);
The function tstda_ allowes to determine whether the object, specified by the reference *ObjectRefPtr, is a distributed array.
The following values are returned:
0 the object is not a distributed array;
1 the object is a distributed array;
2 the object is a fully replicated distributed array.
17.4Requesting size of distributed array element
long getlen_ (long ArrayHeader[]);
ArrayHeader header of the distributed array.
The function getlen_ returns the size in bytes of element of specified distributed array in bytes.
17.5Deleting object
long delobj_(ObjectRef *ObjectRefPtr);
*ObjectRefPtr reference to the deleted object.
It is possible to use the followings as an object:
-
distributed array (in that case the reference is the first word of the header of the array);
-
the representation of the abstract machine;
-
the processor system;
-
map of abstract machine representation;
-
map of distributed array;
-
reduction variable;
-
reduction group;
-
shadow edge group;
-
remote element buffer of regular access;
-
group of remote element buffers of regular access;
-
remote element buffer of non-regular access;
-
group of remote element buffers of non-regular access.
The object can be deleted by delobj_ 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).
The function returns zero.
17.6Requesting whether current processor is I/O processor
long tstio_(void);
The function returns 1 if the current processor is the I/O processor, and returns zero in another case.
17.7Sending memory areas of I/O processor
| long srmem_( | long | *MemoryCountPtr, |
| *MemoryCountPtr | | the number of the sent areas of the memory. |
| StartAddrArray | | array, which i-th element is the start address of (i+1)-th area (adjusted to AddrType type). |
| LengthArray | | array, which i-th element is the size of the (i+1)-th area (in bytes). |
The function srmem_ sends the memory areas of the I/O processor to another processors. During this operation the I/O processor sends the data, and the other processors receive the data. The number of the parameters in the arrays LenghtArray and StartAddrArray has to be equal to *MemoryCountPtr. The length of the each sent area has not to exceed the maximum of the positive integer (LengthArray[i] (unsigned int)-1 >> 1).
The function returns zero.
To transform an address acceptable for the function srmem_, Run-Time System has the function
AddrType dvmadr_(void *VarPtr);
This function is intended for usage in Fortran.
The following functions can be also used for Fortran variables of different types:
| AddrType | getash_ | (void *VarPtr); |
| AddrType | getai_ | (void *VarPtr); |
| AddrType | getal_ | (void *VarPtr); |
| AddrType | getaf_ | (void *VarPtr); |
| AddrType | getad_ | (void *VarPtr); |
| AddrType | getac_ | (void *VarPtr); |
| AddrType | getach_ | (void *VarPtr, long StrLength); |
These functions are similar to the function dvmadr_ (parameter VarPtr is the address of text string, and StrLength is its size, formed by Fortran compiler).
The functions srmem_ and dvmadr_ (getash_, getai_, getal_, getaf_, getad_, getac_, getach_) can be used for implementation of input/output operations.
18Using Run-Time System in Fortran language
To coordinate allocation of the arrays in the memory, (along the columns in the Fortran , and along the rows in the C) inverse order of specifying the array indexes (in comparison with the order in the C ) is required. In addition, in this document it is supposed that the initial array index value is equal to zero, that is conformed to the C language. In the Fortran language this index is equal to 1.
Data types (except C base types, DVMFILE* and DVMHANDLE*) used in Run-Time System functions are defined as "unsigned long". They can be used only in assignment operators and as actual parameters in function and subroutine calls.
Each C base type, used in Run-Time System function calls, must have equivalent representation as some construction of Fortran language. Checking correctness of C base data type in Fortran is implemented by the representation size using the function
| void tpcntr_( | long | *ElmNumberPtr, |
| *ElmNumberPtr | | a number of elements, specified in FirstAddrArray, NextAddrArray, TypeLengthArray and TypeCodeArray arrays. |
| FirstAddrArray, NextAddrArray |
| arrays, which i-th elements contain addresses of two adjacent elements of the type with TypeCodeArray[i] number (in Fortran representation). |
| TypeLengthArray | | array, which i-th element contains supposed size of the type with TypeCodeArray[i] number. |
| TypeCodeArray | | array, which contains numbers (codes) of C data types to be checked. |
The function tpcntr_ assumes the following numeration of C types:
-
"int";
-
"long";
-
"float";
-
"double";
-
"char";
-
"short".
If while executing tpcntr_ function it will be detected, that the length of data of the type with TypeCodeArray[i] number is not equal to the difference (NextAddrArray[i] – FirstAddrArray[i]) or TypeLengthArray[i] value, the user program is terminated with diagnostics, which contains:
-
i value;
-
actual and assumed sizes of TypeCodeArray[i]-th type data;
-
difference (NextAddrArray[i] – FirstAddrArray[i]).
The tpcntr_ function call must precede Run-Time System initialization from Fortran program by linit_ function (see section 2).
Example.
integer getac, getash, getai, getal, getaf, getad, linit
integer dvm
integer faddr(8), naddr(8), tlen(8), tcode(8)
integer tint(2)
logical tlog(2)
character*1 tchar (2)
real tfloat (2)
double precision tdouble (2)
integer*2 tint2 (2)















