LIBDVM2 (1158351), страница 5
Текст из файла (страница 5)
The ranks of the abstract machine representation and the processor subsystem must be equal to corresponding ranks in map.
If PSRefPtr is NULL or *PSRefPtr is zero, then the subsystem, whose pointer is in the map, will be used as the processor subsystem.
The function returns non-zero, if remapped representation has a local part on the current processor, and zero in the other case.
5.6. Deleting map.
long delmvm_(AMViewMapRef *AMViewMapRefPtr);
*AMViewMapRefPtr - pointer 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 pointer may be used by the user program for its own goals.
Note, that non-static map can be deleted by the function delmvm_ only if it was created in the current program block.
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.7. Imbalanced 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, if DistrParamArray[j-1] = 0, |
where:
| | PSSIZEj-1 | |
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.
6. Distributed array creating and deleting.
6.1. Creating distributed array.
| long crtda_ ( | long | ArrayHeader[], |
| ArrayHeader | - header of the array to be created. |
| 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). |
| LowShadowWidthArray | - array, which i-th element is a width of the low shadow edge of the (i+1)-th dimension of the distributed array. |
| HiShadowWidthArray | - 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 Library functions (see section 13).
A header of the created array is an array of *RankPtr+1 elements of «long» type. The user program has to allocate this header in memory (whether statically or dynamically). Run-Time Library 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.
The base pointer BasePtr has to point to any variable of the same type as that of distributed array element. The value of this variable is not essential because the base pointer is only used to access to the elements from the local part of the distributed array.
See section 13.4 for more detail information about dealing with the header of the distributed array and the base pointer.
If the flag *StaticSignPtr of the static array creation is not equal to zero, then the created distributed array is not deleted automatically when the control exits from the current program block (see Section 8). Such array has to be deleted explicitly using the function delda_.
The parameter *ReDistrParPtr may have the following values:
| 0 | - the array can not be an argument of the function redis_ and can not be redistributed by the function realn_; |
| 1 | - the array can be an argument of the function redis_, but can not be redistributed by the function realn_; |
| 2 | - the array can be redistributed by the function realn_, but this array can not be used in defining the abstract machine representation using the function redis_; |
| 3 | - the array can be used as a pointer to the abstract machine representation in the function redis_, and the array can be redistributed by the function realn_. |
The number of the parameters defined in the arrays LowShadowWidthArray and HiShadowWidthArray (that is the width of low and high shadow edges) has to be equal to the created array rank. See section 12 for more detail description of the shadow edges of the distributed array local parts. Note, that the shadow edge width can be equal to zero.
The function returns zero.
6.2. Deleting distributed array.
long delda_(long ArrayHeader[]);
ArrayHeader – the header of the array to be deleted.
The function deletes the distributed array created by the function crtda_. After array deleting the user program can use distributed array header for any goal.
Note, that non-static distributed array can be deleted by the function delda_ only, if it was created in the current program block.
A distributed array can be deleted also by the function delobj_ (see section 17.5).
The function returns zero.
6.3. Creating additional header of distributed array.
| long addhdr_ ( | long | NewArrayHeader[], |
| NewArrayHeader | - header to be created. |
| ArrayHeader | - one of the existing headers. |
The function creates the distributed array header, which further will be used equitably with existing headers. In particular it can be used to create other additional headers.
When the distributed array is aligned by functions align_ and malign_ (see section 7) all its headers are initialized. The array realigning by the functions realn_, mrealn_, redis_ and mredis_ (see sections 5 and 7) also causes all its headers updating.
The function returns zero.
6.4. Deleting distributed array header.
long delhdr_ (long ArrayHeader[]);
ArrayHeader - header to be deleted.
The function deletes the header, created by the function addhdr_. The header, specified as parameter of the array creation by the function crtda_ (the main header) cannot be deleted.
The function returns zero.
7. Mapping distributed array.
7.1. Aligning distributed array.
| long align_ ( | long | ArrayHeader[], |
| ArrayHeader | - the header of the distributed array to be aligned. |
| *PatternRefPtr | - pointer to the alignment pattern. |
| AxisArray | - array, which j-th element is a dimension number of the distributed array used in the linear alignment rule for the pattern (j+1)-th dimension. |
| CoeffArray | - array, which j-th element is a coefficient for distributed array index variable used in the linear alignment rule for the pattern (j+1)-th dimension. |
| ConstArray | - array, which j-th element is a constant used in the linear alignment rule for the pattern (j+1)-th dimension. |
The function align_ defines the location of the specified distributed array in the assigned abstract machine representation space (in other words the function aligns the distributed array). Besides, the elements of the array are distributed among the child abstract machines incorporating in the representation. The abstract machine representation is defined by means of the pattern, which can be as the representation itself, or a distributed array (this is called «indirect mapping»). In the last case the pointer to the pattern is a first word of distributed array header.















