rtsIDe (1158448), страница 12
Текст из файла (страница 12)
Following reduction function numbers are supported (C language named constants are specified in brackets):
-
sum (rf_SUM);
-
multiplication (rf_MULT);
-
maximum (rf_MAX);
-
minimum (rf_MIN);
-
binary logical "and" (rf_AND);
-
binary logical "or" (rf_OR);
-
binary logical excluding "or" (rf_XOR);
-
binary equivalence (binary addition by module 2 with the following inversion of all its, rf_EQU);
-
inequality (rf_NE);
-
equality (rf_EQ).
The operations with 5, 6, 7 and 8 numbers can be applied to reduction variables of int and long type only (see below).
The result of the operation with number 9 (rf_NE) is non-zero ("TRUE"), if at the moment of the operation start the values of reduction variable are differ at least on two processors and zero ("FALSE") otherwise.
The result of the operation with number 10 (rf_EQ) is non-zero ("TRUE"), if at the moment of the operation start the values of reduction variable are same on all the processors and zero ("FALSE") otherwise.
Additional information (also called localization information), associated with the reduction function, depends on the user task algorithm and is formed by the user program. The additional information can be used only in the functions rf_MAX and rf_MIN and turns them into positional reduction functions MAXLOC and MINLOC. Admittedly the additional information in this case is the specified positions of the maximum or minimum. Run-Time System only sends this information from the processor, where the maximum or minimum was evaluated, to all another processors. If LocArrayPtr = NULL, or if *LocElmLengthPtr = 0 than localizaôion information is omitted.
Following types of reduction array-variable are supported (the name constants of the C language are in brackets):
-
int (rt_INT);
-
long (rt_LONG);
-
float (rt_FLOAT);
-
double (rt_DOUBLE).
If the flag *StaticSignPtr of the static reduction declaration is not equal to zero, then the created (or declared) reduction is not deleted automatically when the control exits from the current program block (see section 8). Such reduction has to be deleted explicitly using the function delred_.
Note. To avoid warnings from Fortran-compiler when the function crtred_ is called with different types of the reduction variables, Run-Time System ðrovides the function
| RedRef crtrdf_ ( | long | *RedFuncNumbPtr, |
differing from the function crtred_ in the second parameter:
| *RedArrayAddrPtr | | pointer to the reduction variable-array, cast to AddrType type by one of the functions, considered in section 17.7. |
Other parameters of the function crtrdf_ are similar to corresponding ones of the function crtred_.
11.2Задание типа индексных переменных, значения которых определяют координаты локального максимума или минимума редукционной переменной
| long lindtp_ ( | RedRef | *RedRefPtr, |
| *RedRefPtr | | reference to the reduction variable. |
| *LocIndTypePtr | | код типа индексных переменных. |
Функция сообщает системе поддержки тип индексных переменных, значения которых определяют координаты локальных максимумов или минимумов редукционных переменных, составляющих массив, заданный при обращении к функции crtred_ (crtrdf_) параметром RedArrayPtr (RedArrayAddrPtr) (см. п. 11.1). Значения этих индексных переменных содержатся в каждом элементе массива с информацией локализации, задаваемого при обращении к функциям crtred_ и crtrdf_ указателем LocArrayPtr.
Параметр *LocIndTypePtr может принимать значения:
0 – индексные переменные типа long,
1 – int,
2 – short,
3 – char.
Редукционная переменная, заданная ссылкой *RedRefPtr, должна быть создана в текущей подзадаче и не может быть уже включена в какую-либо редукционную группу.
The function returns zero.
Сразу после создания редукционной переменной функцией crtred_ (crtrdf_) тип индексных переменных, значения которых задают координаты локального максимума или минимума, считается равным integer (значение типа по умолчанию).
11.3Creating reduction group
| RedGroupRef crtrg_ ( | long | *StaticSignPtr, |
| *StaticSignPtr | | the flag of the static reduction group creation. |
| *DelRedSignPtr | | the flag of deleting of the all reduction descriptors while deleting the reduction group. |
The function crtrg_ creates empty reduction group (that is group that does not contain any reduction). The function returns reference to the created group.
If the flag *StaticSignPtr of the static reduction group creation is not equal to zero, then the created group does not deleted automatically when the control exits from the current program block (see section 8). Such reduction group has to be deleted explicitly using the function delrg_.
If the flag *DelRedSignPtr is not equal to zero then all reduction variables of the reduction group (at the moment of deleting) will be also deleted while deleting the group. When the group is deleted explicitly, all its variables will be also deleted explicitly, and when the group is deleted implicitly all its variables will be also deleted implicitly.
11.4Including reduction in reduction group
| long insred_ ( | RedGroupRef | *RedGroupRefPtr, |
| *RedGroupRefPtr | | reference to the reduction group. |
| *RedRefPtr | | reference to the reduction variable. |
| *PSSpaceRefPtr | | reference to specifier of processor system and reduction variable processor space. |
| *RenewSignPtr | | flag to update saved value of reduction variable when it is reincluded in the group. |
Including the reduction variable to the group means its registration as a member of the group reduction operation and its value keeping for the reduction execution.
As specified in the function call reduction group, as the reduction variable included in the group must be created in the current subtask. Moreover, the reduction group must not be started by strtrd_ function (see section 11.6), and the reduction variable must not be already included in other reduction group.
The parameter, specified by *PSSpaceRefPtr reference, defines processor space of reduction variable, that is a processor set, where reduction operation, binded with the variable, is executed. The parameter also binds with the reduction variable a processor system, which will become processor system of reduction group when first reduction variable is included in the group. Processor space of the reduction variable is not strict subset of the set of its processor system elements. Processor systems of all included in reduction group variables must be equivalent, i.e. the must have the same rank and all dimension sizes and consist of the same processors.
The following objects can be used as processor space specifiers:
-
Processor system
The processor system, specified by PSSpaceRefPtr parameter, becomes the processor system and the processor space of the reduction variable. All its elements must belong to the current processor system.
-
Distributed array.
A distributed array, defined by *PSSpaceRefPtr reference, must be mapped on processor system, considered by Run-Time System as the processor system and the processor space of the reduction variable. Each element of the processor system must belong to the current processor system.
-
Parallel loop.
A parallel loop, specified by PSSpaceRefPtr reference, must be the current one and mapped (i.e. parallel loop can be used for specification of the reduction variable specification only after its mapping by mappl_ function, see section 9.2). Processor system, the parallel loop is mapped on, is considered as the processor system of the reduction variable. The processor space of the reduction variable is a subset of its processor system elements, which doesn't contain processors, duplicating the execution of replicated loop iterations.
-
Abstract machine representation.
If abstract machine representation is mapped by distr_ (redis_, mdistr_, mredis_) function, the processor system, the mapping is done on, is considered as the processor system and the processor space of the reduction variable. In this case if the representation is not mapped by distr_ (redis_, mdistr_, mredis_) function, but at least one its abstract machine is mapped by mappl_ function, the current processor system is considered as the processor system of reduction variable, and the processor space is a set of central processors of subtasks, created while mapping representation elements (the reduction on parallel subtask group, which competed its execution; see section 10).
Abstract machine representation or its elements can be mapped on the current processor system or its direct or indirect subsystems.
If *PSSpaceRefPtr is zero or PSSpaceRefPtr is NULL, the current processor system is considered as processor system and processor space of the reduction variable.
The reduction variable can be reincluded in the reduction group. Specification of the variable processor space may differ, but its processor system must be equivalent to the processor system of the reduction group. When the reduction variable is reincluded in the group, its saved value is updated, if *RenewSignPtr parameter has non-zero value, and is not changed, if *RenewSignPtr is zero or RenewSignPtr is NULL.
The function returns zero.
11.5Storing values of reduction variables
The functions, considered below, allow to update values of reduction variables, saved while including the variables in the reduction group without indicating (and, hence, without changing) specifications of processor spaces.
long saverv_ (RedRef *RedRefPtr);
*RedRefPtr reference to reduction variable.
The function saverv_ updates saved value of given reduction variable for following its usage for group reduction operation execution.
The reduction variable, specified by *RedRefPtr reference, must be created in the current subtask and its reduction group must not be started by strtrd_ function (see sections 11.6).
The function returns zero.
long saverg_ (RedGroupRef *RedGroupRefPtr);















