rtsIDe (1158448), страница 4
Текст из файла (страница 4)
| *PSRefPtr | | reference to the processor system, for which elements coordinate weights will be set. |
| *AMViewRefPtr | | reference to abstract machine representation, to map which the coordinate weights, computed by setelw_ function, will be used. |
| LoadWeightAddr | | array, which i-th element is cast to AddrType type pointer to the array containing coordinate weights of processor loading for (i+1)-th dimension of the processor system, specified by *PSRefPtr reference. |
| WeightNumber | | array, which i-th element is the number of elements (coordinate weights of loading) in the array, the pointer on which is specified in LoadWeightAddr[i]. |
| *AddrNumberPtr | | a number of elements in LoadWeightAddr and WeightNumber arrays. |
The function setelw_ calculates computational coordinate weights of elements of the processor system, specified by *PSRefPtr reference and then assigns them using setbld_ function (see section 4.5).
Assigned weights of processor coordinates will be used only for mapping or remapping given representation of abstract machine on given processor system.
When setelw_ function is called the abstract machine (parental) with representation, specified by *AMViewRefPtr reference, must be already mapped.
All processors of the system, specified by *PSRefPtr reference, must belong to elementary intersection of the current processor system with the processor system, the parental abstract machine is mapped on.
NULL value of PSRefPtr pointer or zero value of *PSRefPtr reference means, that coordinate weights of the current processor system elements are assigned.
The computational weights of the processor coordinates are defined so that to provide best balanced processor loading: for each dimension of given processor system maximal coordinate loading of the processors must be minimal.
Formally, for each (i+1)-th dimension of given processor system setelw_ function solves the task (relative to Ik,init and Ik,last)
| MAX ( | Ik,last |
where:
| N | | size of (i+1)-th dimension of given processor system; | |
| Ik,init ≤ Ik,last; | |||
| Ik+1,init = Ik,last + 1; | |||
| I0,init = 0, | In-1,last = m 1; | ||
| m | | a number of loading coordinate weights, specified for (i+1)-th dimension of the processor system (WeightNumber[i]); m n); | |
| LWJ | | J-th loading coordinate weight, specified for (i+1)-th dimension of processor system (J-th element of the array which pointer is specified in LoadWeightAddr[i]). | |
After finding the task (1) solution (denote it as Ik,init,even , Ik,last,even; k = 0, ... , n - 1) computational weight of k-th coordinate of (i+1)-th dimension of specified processor system will be equal to
Ik,last,even Ik,init,even + 1 (k = 0, ... , n - 1).
Loading coordinate weights must be non-negative float numbers (double).
Zero value of LoadWeightAddr[i] means, that for (i+1)-th dimension of the specified processor system processor coordinate weights will be equal to the weights, specified in Run-Time System startup parameters (for initial processor system), or to 1 (for other one).
*AddrNumberPtr parameter value can't exceed specified processor system rank. LoadWeightAddr array elements, lacking up to the processor system rank, will be equal to zero. In particular, zero value of *AddrNumberPtr means, that the weights of all coordinates of all the processors will be set equal to 1 or to the weights, specified in Run-Time System startup parameters.
The function returns zero.
4.7Виртуальные многопроцессорные системы (многопроцессорные системы программы пользователя)
Программа пользователя может быть "жёстко" настроена на определённую, оптимальную для неё начальную процессорную систему. Чтобы обеспечить запуск такой программы на другой процессорной конфигурации, система поддержки предоставляет механизм виртуальных процессорных систем.
Механизм виртуальных процессорных систем позволяет использовать в качестве фиксированной для программы начальной процессорной системы эквивалентную ей виртуальную начальную процессорную систему (процессорные системы эквивалентны, если имеют одну и ту же размерность и равные размеры измерений c одинаковыми номерами). Размерности реальной и виртуальной начальных процессорных систем должны быть равны, но размеры их измерений с одинаковыми номерами могут не совпадать. Количества процессоров в этих процессорных системах также могут быть разными.
Виртуальная начальная процессорная система описывается в файлах параметров запуска системы поддержки директивой
UserPS = <список размеров измерений, разделённых запятыми>;
Размерность процессорной системы, заданной этой директивой, равна числу размеров и змерений, содержащихся в списке.
Для запуска программы на виртуальной начальной процессорной системе параметру запуска системы поддержки IsUserPS должно быть присвоено ненулевое значение (1).
В этом случае:
-
все процессорные подсистемы, создаваемые функциями crtps_ и psview_ (см. п.п. 4.2 и 4.3), являются виртуальными, исходной для которых (на верхнем уровне иерархии) является виртуальная начальная процессорная система;
-
при создании виртуальной процессорной подсистемы создаётся соответствующая ей реальная процессорная подсистема (при инициализации системы поддержки виртуальной начальной процессорной системе соответствует реальная начальная процессорная система);
-
вычислительные веса координат процессоров любой процессорной системы полагаются равными единице (вне зависимости от их значений, заданных в параметрах запуска системы поддержки или при обращении к функциям setpsw_, genbli_, genbld_ и genblk_, см. п. 4.5);
-
веса загрузки процессоров, задаваемые при обращении к функции setelw_ (см. п. 4.6), игнорируются и считаются равными единице;
-
функции getsiz_ и locsiz_ (см. п. 17.2) возвращают размеры виртуальных процессорных систем.
Из изложенного выше следует, что при выполнении программы на виртуальных процессорных системах отображение на них представлений абстрактных машин и, следовательно, распределённых массивов и параллельных циклов возможно только равномерными блоками (см. п. 5.7).
Замечание. Если программа имеет "жёсткую" настройку лишь на число процессоров в начальной процессорной системе (а не на размеры её измерений), то виртуальную начальную процессорную систему рекомендуется описывать одномерной.
5Mapping abstract machine
5.1Mapping abstract machine representation onto processor system (resource distribution)
| long distr_ ( | AMViewRef | *AMViewRefPtr, |
| *AMViewRefPtr | | reference to abstract machine representation, which resources will be distributed. |
| *PSRefPtr | | reference to the processor system, which defines the structure of the distributed resources. |
| *ParamCountPtr | | the number of parameters defined in arrays AxisArray and DistrParamArray (see below). |
| AxisArray | | array, which j-th element is a dimension number of the abstract machine representation used in mapping rule for processor system (j+1)–th dimension. |
| DistrParamArray | | array, which j-th element is a mapping rule parameter for processor system (j+1)-th dimension (DistrParamArray[j] 0). |
The processor resource (the resource) of the abstract machine is a set of processors, which forms the processor system the abstract machine is mapped onto.
The function distr_ distributes resources of the ábstract machine among child abstract machines, and the reference *AMViewPtr defines the representation containing these abstract machines. Such distribution is called mapping of abstract machine representation on processor system. The abstract machine representation can be mapped only if it was created in the current subtask (see section 10).
When distr_ function is called the abstract machine (parental) which representation is passed in the function call, must be already mapped. All processors of the system, specified by *PSRefPtr reference, must belong to elementary intersection of the current processor system and the processor system, the parental abstract machine is mapped on. If *PSRefPtr = 0 or PSRefPtr = NULL, the current processor system will be used for resource distribution.
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 size of vectors PSAxisArray and DistrParamArray must be equal to *ParamCountPtr, which is equal to or less than the rank of the processor system. In the latter case missing rules are considered as replicating mapping rules (see the rule 2 below).
The following functional correspondence defines abstract machine resource distribution
{abstract machine representation} {processor system} ,
which is performed as described below. Let F be a multifunction, with the domain of definition in a space of indexes of the abstract machine representation and with the image in a space of indexes of the processor system:
| F((I1, ... ,Ii, ... ,In)) = | F1(I1, ... ,Ii, ... ,In) |
where:
| | | symbol of the Cartesian product; |
| n | | rank of the abstract machine; |
| m | | rank of the processor system; |
| Ii | | index variable of the i-th dimension of the abstract machine representation; |
| Fj | | multifunction with an image in a set of index variable values of the processor system j-th dimension. |
Let the child abstract machine be defined by index vector (I1, … ,In). Then the resource, which will be assigned to this abstract machine, is processor aggregate defined by set F((I1, ... , In)) (the values of these functions are sets consisting of vectors of the index space of the processor system). Mapping the representation of the abstract machine onto processor system is a resource distribution (through specification of function F) among components of this representation.
The F1..., Fm functions are named "coordinate mapping rules". Run-Time System provides the following mapping rules that allow realizing some block distribution of the abstract machine representation onto the processor system.
-
Fj(I1, ... ,In) = {[Ik/BLSIZEk]} , where:
| k = f(j) = AxisArray[j-1] | | the dimension number of the abstract machine representation (1 k n, f(j1) f(j2) when j1 j2); |
| BLSIZEk | | positive integer (the block size of the k-th dimension of the abstract machine representation). |
This mapping rule means that for each element (I1,…, In) of the index space of the abstract machine representation the corresponding image-set contains one element [Ik/BLSIZEk]. This element is within the values range of index variable of the j-th dimension of the processor system.















