rtsIDe (1158448), страница 13
Текст из файла (страница 13)
*RedGroupRefPtr reference to the reduction group.
The function saverg_ stores values of all variables of the reduction group. The reduction group, specified by *RedGroupRefPtr reference, must be created in the current subtask and can't be empty or started by strtrd_ function (see sections 11.6).
The function returns zero.
11.6Starting reduction group
long strtrd_ (RedGroupRef *RedGroupRefPtr);
*RedGroupRefPtr reference to the reduction group.
The function strtrd_ starts all reduction operations over all reduction variables of the group. It is not allowed to use these reduction variables until the completion of all reduction operations.
The started reduction group must be created in the current subtask and can't be already started by strtrd_ function. Restarting reduction group is allowed only after completion of the previous start by waitrd_ function (see sections 11.7). Empty reduction group can't be started.
Used for reduction operation execution values of the variables, included in the started group, are defined by Run-Time System in the following way. At central processor reduction variable value is always equal to its current value. At other processors the current value of reduction variable is corrected in the following way:
-
Addition operation (rf_SUM).
The reduction variable value, saved at moment of including the variable in the group or renewed by saverv_ or saverg_ function is subtracted from its current value.
-
Multiplication operation (rf_MULT).
Current value of reduction variable is divided by its value saved at moment of including the variable in the group or renewed by saverv_ or saverg_ function (zero divisor is replaced by one).
-
Operation of bitwise addition by module 2 and bitwise addition by module 2 followed by bitwise inversion (rf_XOR and rf_EQU).
Current value of reduction variable is bitwise summed up by module 2 (or bitwise summed up by module 2 followed by bitwise inversion) with its value saved when the variable was included in the group or renewed by saverv_ or saverg_ function.
The function returns zero.
11.7Waiting for completion of reduction group
long waitrd_ (RedGroupRef *RedGroupRefPtr);
*RedGroupRefPtr reference to the reduction group.
The function waitrd_ awaits the completion of the all reduction operations of the group. It is allowed to use all reduction variables ærom this group after completion of this function.
The reduction group, specified by *RedGroupRefPtr reference, must be created in the current subtask. Waiting for completion of reduction group operations, not started by strtrd_, is not allowed.
After the completion of reduction operations the group will become opened for including new reduction variables and updating variables, already included in the group. The group, which reduction operations were completed, can be restarted by strtrd_ function.
The function returns zero.
11.8Deleting reduction group
long delrg_ (RedGroupRef *RedGroupRefPtr);
*RedGroupRefPtr reference to the reduction group.
The function delrg_ deletes the reduction group created by the function crtrg_. After deleting the group the reference to the group can be used by user program for any goals.
The reduction group can be deleted by delrg_ 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 group, which reduction operations were not completed by waitrd_ function, can't be deleted.
If the reduction group was created by crtrg_ function with zero value of *DelRedSignPtr parameter, then when deleting the group all reduction variables, included in the group, will be deleted also.
To delete reduction group the function delobj_ can also be used (see section 17.5).
The function returns zero.
11.9Deleting reduction
long delred_ (RedRef *RedRefPtr);
*RedRefPtr reference to the reduction variable.
The function delred_ deletes reduction variable (the reduction descriptor) created by the function crtred_. After deleting the reference to the descriptor can be used by user program for any goals.
The reduction variable can be deleted by delred_ 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 variable, belonging to reduction group, which operations are not completed by waitrd_ function, can't be deleted.
If deleted reduction variable belongs to some reduction group, it is excluded from the group.
To delete reduction variable the function delobj_ can also be used (see section 17.5).
The function returns zero.
11.10Поддержка асинхронной редукции при выполнении параллельного цикла
Выполнение всех редукционных операций редукционной группы осуществляется центральным процессором процессорной системы группы при вызове им функции waitrd_: центральный процессор дожидается поступления исходных значений редукционных переменных от всех других процессоров процессорной системы группы и, выполнив требуемые операции, отсылает им результирующие значения редукционных переменных.
Исходные значения редукционных переменных могут поступить на центральный процессор значительно раньше вызова им функции waitrd_. Поэтому в целях более полного совмещения обмена сообщениями с вычислениями система поддержки осуществляет попытки выполнения редукционных операций при обращении центрального процессора к функции dopl_ (до вызова им функции waitrd_).
Выполнение редукционных операций, опережающее обращение центрального процессора к функции waitrd_, организовано следующим образом.
Внутренние витки параллельного цикла разбиваются на порции (внутренние витки это витки, соответствующие внутренним элементам локальной части распределённого массива, по которому отображён цикл, см. п. 9.3). Число порций определяется значением параметра запуска системы поддержки InPLQNumber (целое число, большее единицы). Разбиение внутренних витков на порции достигается делением на min(InPLQNumber, PLAxisSize) частей измерения цикла с наименьшим номером, число координат витков в котором больше единицы (PLAxisSize число координат витков в таком измерении).
При выполнении центральным процессором функции dopl_, осуществляющей переход от одной порции витков к другой, система поддержки проверяет завершение приёма сообщений с исходными значениями редукционных переменных от всех остальных процессоров процессорной системы редукционной группы. Если все сообщения поступили, то выполняются все операции редукционной группы, а результирующие значения редукционных переменных записываются в память центрального процессора и рассылаются всем нецентральным.
Опережающее выполнение редукционных операций управляется параметром запуска системы поддержки dopl_WaitRD, которому могут быть присвоены значения:
| 0 | | не производить опережающего выполнения редукционных операций; |
| 1 | | осуществлять попытки опережающего выполнения редукционных операций при переходе от одной порции внутренних витков цикла к другой; |
| 2 | | осуществлять дополнительные попытки опережающего выполнения редукционных операций при переходе от вычисления экспортируемых элементов к первой порции внутренних витков или при переходе от последней порции внутренних витков к вычислению экспортируемых элементов (см. п. 9.3). |
Опережающее выполнение редукционных операций осуществляется для всех запущенных функцией strtrd_ редукционных групп.
Замечание. Разбиение внутренних витков параллельного цикла на порции осуществляется также с целью опроса завершения всех приёмов и передач сообщений при работе с системой передачи сообщений MPI: при ненулевом значении параметра запуска системы поддержки dopl_MPI_Test каждый вызов функции dopl_ сопровождается обращением к функции MPI_Test для каждого незавершённого обмена сообщением. Обращение к функции MPI_Test применяется для "подталкивания" асинхронной передачи сообщений, т. е. с целью лучшего совмещения обменов сообщениями с вычислениями (специфика MPI).
Если оба параметра dopl_WaitRD и dopl_MPI_Test равны нулю, то внутренние витки параллельных циклов на порции не разбиваются.
12Renewing shadow edges of distributed array
Let the local part of the distributed array be represented as an aggregate of its elements defined as a set of the index tuples:
{I1 M1: I1,init ≤ I1 ≤ I1,last } . . . {Im Mm: Im,init ≤ Im ≤ Im,last} . . .
{In Mn: In,init ≤ In ≤ In,last} ,
where:
| | | symbol of Cartesian product; |
| n | | rank of the array; |
| Im | | index variable of the m-th dimension (1 m n); |
| Im,init | | the initial value of the index variable of the m-th dimension; |
| Im,last | | the last value of the index variable of the m-th dimension; |
| Mm | | the range of values of the index variable of the m-th dimension. |
Suppose that the local part is entirely inside the array (for simplicity). Then low shadow edge of the local part of distributed array of k-th dimension is a set of its elements, defined by a set of the index corteges:
LSBk =
| { I1 { Ik-1 | M1 | : I1,init | FS*LW1 | ≤ I1 | ≤ I1,last ≤ In,last | + FS*HW1 | } |
| Here: | LWi | | width of the low part of the shadow edge of i-th dimension; |
| HWi | | width of the high part of the shadow edge of i-th dimension (parameters LowShdWidthArray and HiShdWidthArray of the functions crtda_ , section 6, and inssh_ , section12.2); | |
| FS | | flag of full edge (parameter *FullShdSignPtr of the function inssh_, section 12.2). |
Similarly high shadow edge of the local part of the distributed array of k-th dimension is defined by the set of index corteges:
HSBk =
| { I1 { Ik-1 | M1 | : I1,init | FS*LW1 | ≤ I1 | ≤ I1,last ≤ In,last | + FS*HW1 | } |
The low (high) shadow edge of k-th dimension is called full, if FS=1, and is called low (high) shadow bound, if FS=0. The union of full shadow edges of all dimensions is called full shadow edge of the local part of the distributed array:
|
| n | |
| n | ||||||||
| U ( | { I1 | M1 | : I1,init | LW1 | ≤ I1 | ≤ I1,last | HW1 | } |
| k = 1 | …. | .....….. | ........ | .......….. | .......... | ........……. | ..........… | |
| { Ik-1 | Mk-1 | : Ik-,init | LWk-1 | ≤ Ik-1 | ≤ Ik-1,last | HWk-1 | } | |
| { Ik | Mk | : Ik,init | LWk | ≤ Ik | ≤ Ik,init | 1 ; | ||
| Ik,last | 1 | ≤ Ik | ≤ Ik,last | HWk | } | |||
| { Ik+1 | Mk+1 | : Ik+1,init | LWk+1 | ≤ Ik+1 | ≤ Ik+1,last | HWk+1 | } | |
| .... | .....…... | ........ | .......…… | .......... | ....……..... | .........…. | ||
| { In | Mn | : In,init | LWn | ≤ In | ≤ In,last | HWn | } | |
| ) |
Elements of the shadow edge of the local part of the distributed array are called shadow edge elements (or imported). These elements are allocated in the memory together with the local part. In the another side, each edge element belongs to some local part of the distributed array, and so it is allocated in the memory of the processor, this local part is mapped on. For this processor the element is called element-original (or exported element).















