rtsIDe (1158448), страница 6
Текст из файла (страница 6)
When mdistr_ function is called, abstract machine (parental), which representation is specified by *AMViewRefPtr reference, must be already mapped.
If PSRefPtr is NULL or *PSRefPtr is zero, then the subsystem, whose reference is in the map, will be used as the processor subsystem.
All processors of the system, specified by *PSRefPtr reference or by a reference, contained in the map, must belong to elementary intersection of the current processor system and the processor system, the parental abstract machine is mapped on.
The ranks of the abstract machine representation and the processor subsystem must be equal to the corresponding ranks in the map.
It is impossible to map the abstract machine representation, already mapped by distr_ (redis_, mdistr_, mredis_) function or the representation, where at least one element is mapped on some processor system by mapam_ function (see section 10).
The function returns non-zero, if remapped representation has a local part on the current processor, and zero in the other case.
5.5Remapping abstract machine representation according to the map
| long mredis_ ( | AMViewRef | AMViewRefPtr, |
| *AMViewRefPtr | | reference to abstract machine representation to be remapped. |
| *PSRefPtr | | reference to the processor system, determining resource structure for new mapping. |
| *AMViewMapRefPtr | | reference to map of the abstract machine representation. |
| *NewSignPtr | | flag of renewing all redistributed arrays (if it is equal to 1). |
The function mredis_ cancels resource distribution of the abstract machine, implemented earlier by the function mdistr_ (or distr_, see section 5.1) for descendant abstract machines, included to the representation, specified by reference *AMViewRefPtr, and redistributes the given representation according to specified map. All distributed arrays, aligned earlier with the considered representation by the functions align_ and malign_ (as explicitly as implicitly) will be remapped according to the old aligning rules (see section 7). If *NewSignPtr is not equal to zero, then the arrays will be updated (cleared) and kept in other case. When the arrays are remapped the contents of their shadow edges (see section 12) is not kept.
All elements of specified representation must be terminals of abstract machine tree (must not have descendants).
If PSRefPtr is NULL or *PSRefPtr is zero, then the subsystem, whose reference is in the map, will be used as the processor subsystem.
All processors of the system, specified by *PSRefPtr reference or by a reference, contained in the map, must belong to elementary intersection of the current processor system and the processor system, the parental processor system is mapped on.
The ranks of the abstract machine representation and the processor subsystem must be equal to corresponding ranks in map.
Remapped representation may be specified indirectly, if the header of the distributed array, created by function crtda_ with parameter *ReDistrParPtr is equal to1 or 3, is uses as parameter *AMViewRefPtr (see section 6).
The abstract machine representation, specified in the function call, can be not mapped earlier. In this case mredis_ function is executed as distr_ function, and *NewSignPtr parameter value is irrelevant.
The function returns non-zero, if remapped representation has a local part on the current processor, and zero in the other case.
5.6Deleting map
long delmvm_(AMViewMapRef *AMViewMapRefPtr);
*AMViewMapRefPtr reference to the map of the abstract machine representation.
The function deletes map of the abstract machine representation created by function amvmap_. After deleting map the reference may be used by the user program for its own goals.
The map can be deleted by delmvm_ function only if it was created in the current subtask and in the current ðrogram block (or its sub-block) (see sections 8 and 10).
To delete the map the function delobj_ can also be used (see section 17.5).
The function returns zero.
Note. One of possible usage of the abstract machine representation mapping functions according to the map is keeping and restoring the abstract machine mapping and therefore the allocation of the arrays, aligned with the mapping, in the procedures, dealing with external distributed arrays with their redistribution.
Note, that when map is used for mapping and remapping, the abstract machine representation, being the source of the map, may not exist.
5.7Imbalanced block distribution
All notations, used in this section, except of newly introduced is assumed to be coincided with the notations from section 5.1.
Considered in section 5.1 the abstract machine representation mapping onto the processor system is the balanced distribution of the parental abstract machine resources onto the representation elements. In this case for k-th dimension of abstract machine representation the size of BLSIZEk block is assumed to be independent of a value of j-th coordinate of the processor system element. Such uniformity for each dimension is a result of supposed in section 5.1 equal weights of all its elements: the optimal weights of all processor coordinates are equal and equal to 1(see section 4.5).
Let us consider now a case of imbalanced elements of the processor system. Let the block BLSIZEk has a fixed size for k-th dimension (as in section 5.1), but a "number" of blocks per the processor system element with coordinate Pj for j-th dimension is equal to optimal weight of the coordinate. Then the first of the mapping rules, considered in section 5.1, (i.e. function Fj(I1, ... ,In)) is determined by inequalities
| Fj(I1,...,In)-1 | Fj(I1,...,In) |
where WEIGHTopt,j(Pj) is optimal weight of the coordinate Pj.
The value BLSIZEk is determined as follows:
| BLSIZEk ={ | min( DistrParamArray[j-1], AMSIZEk ) if DistrParamArray[j-1] ≠ 0 , [AMSIZEk / PSWEIGHTopt,j] if DistrParamArray[j-1] = 0 , |
where:
|
| PSSIZEj-1 | (optimal weight of j-th dimension of the processor system). |
Since maximal allowed value Ik is
min( ([PSWEIGHTopt,j * BLSIZEk] - 1) , AMSIZEk - 1 ) ,
for full coverage of k-th dimension of the abstract machine representation by the mapping rule the following inequality must be satisfied:
AMSIZEk PSWEIGHTopt,j * BLSIZEk ,
It is achieved if
DistrParamArray[j-1] AMSIZEk / PSWEIGHTopt,j
or if
DistrParamArray[j-1] = 0 .
6Distributed array creating and deleting
6.1Creating distributed array
| long crtda_ ( | long | ArrayHeader[], |
| ArrayHeader | | header of the array to be created. |
| *ExtHdrSignPtr | | flag of extended header. |
| BasePtr | | base pointer, used to access to the distributed array elements. |
| *RankPtr | | rank of the created array. |
| *TypeSizePtr | | size of the array element (in bytes). |
| SizeArray | | array, which i-th element is a size of the (i+1)-th dimension of the created (0 i *RankPtr-1). |
| *StaticSignPtr | | the flag of the static array creation. |
| *ReDistrParPtr | | the permission flag of using of created distributed array as a parameter in the function redis_ and realn_ (see sections 5.2 and 7.3). |
| LowShdWidthArray | | array, which i-th element is a width of the low shadow edge of the (i+1)-th dimension of the distributed array. |
| HiShdWidthArray | | array, which i-th element is a width of the high shadow edge of the (i+1)-th dimension of the distributed array. |
The creation of a distributed array using function crtda_ means only an initialization of the internal system structures describing the array. The memory for the distributed array elements is allocated only after mapping this array on an abstract machine by the function align_. (In another words, memory is allocated after evaluating for each processor abstract machine it is mapped onto, a local part of distributed array according to its distribution, see section 7.1). An access to array elements is performed through Run-Time System functions (see section 13).
A header of the created array is an array of *RankPtr+1 (if *ExtHdrSignPtr = 0) or *RankPtr*2+2 (if *ExtHdrSignPtr = 1) elements of "long" type. The user program has to allocate this header in memory (whether statically or dynamically). Run-Time System only initializes this header. The main purpose of this header is to provide an effective access to the elements of the local part of the distributed array.















