CDVM2 (1158340), страница 5

Файл №1158340 CDVM2 (Раздаточные материалы) 5 страницаCDVM2 (1158340) страница 52019-09-18СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 5)

DVM(OWN) X[J] = A[J][N] / A[J][J]

}

Note, that A[J][N+1] and A[J][J] are localized on the processor, where X[J] is allocated.

6. Access to remote data

Remote data can be used in the distributed loop or in statements of own computations. Distributed loop iteration is executed exclusively on single processor. If in the loop iteration (in statement) the values of array elements, allocated on the other processors, are used, then these values are called remote data. The references to such elements are called remote references. The similar notions are defined for own computation statement. It is necessary to distinguish two kinds of remote references:

  • remote regular references - distributed dimensions are indexed by expressions of the form a*I + b;

  • remote irregular references - distributed dimensions are indexed by elements of matrix ME[I][J].

Note that local (non-distributed) array dimension indexing can be arbitrary.

The access to remote data requires the following operations performing

  • buffer distribution.

  • replacement of references to the array by references to the buffer,

  • organization of data exchange between processors to fill the buffers.

Low level models of message passing (like MPI) requires "manual" programming of all these operations. Data parallel systems (like HPF[2]) assume automatic execution of the operations. DVM supposes compromise model: high level model of specifications of remote data and group exchange operations and a possibility for a user to optimize remote data access.

6.1. Regular remote references

6.1.1. Shadow edges group. SHADOW_RENEW specification.

Remote data access may be organized using shadow edges of the array local section, if the indexes of remote references has the form I d , where d is a constant.

Consider the following example

float A[100], B[100];

for(i=1; i<98, i++)

A[I] = (B[I-1] + B[I+1] + B[I+2] ) / 3.;

In this example it is impossible to align the arrays in such a way, that all elements, used in I-th iteration, were allocated on the same processor. Consider distribution of array B with shadow edges on the three neighbor processors.

P-1

P

P+1

V

V

Fig.6.1. Distribution of array with shadow edges.

Two buffers, that are continuous prolongation of the array local section, are distributed on each processor. The left shadow edge width is equal to 1 element (for B[I-1]), right shadow edge width is equal to 2 elements ( for B[I+1] and B[I+2]). If before loop entering to perform processor exchange according to scheme on fig. 6.1, then the loop can be executed on each processor without replacing references to arrays by references to the buffer.

To specify remote access through shadow edges CDVM provides the following directives.

Description of maximal size of shadow edges.

shadow-directive

::= SHADOW shadow-array-string

shadow-array

::= array-name shadow-edge-string

shadow-edge

::= [ width ]

| [ low-width : high-width ]

width

::= int-expr

low-width

::= int-expr

high-width

::= int-expr



Constraint. Left shadow edge width (low-width) and right shadow edge width (high-width) must be non-negative integer constants.

Specification [width] of shadow edge width is equivalent to the specification [width : width].

The width of the both shadow edges of a distributed array is equal to 1 by default for each array dimension.

If it is needed to update shadow edges prior to a distributed loop execution, then SHADOW_RENEW clause is specified in PARALLEL directive.

shadow-renew-clause

::= SHADOW_RENEW renewee‑string

renewee

::= dist-array-name [ shadow-edge-string ] [ CORNER ]

Constraints:

  • Width of the shadow edges filled by values must not exceed the maximal width specified initially in the SHADOW directive.

  • If shadow edge widths is not specified, then the maximal widths are used.

Example 6.1. Remote access through shadow edges.

DVM(DISTRIBUTE [BLOCK]) float A[100];

DVM(ALIGN [I] WITH A[ I] ; SHADOW B[1:2]) float B[100];

. . .

DVM(PARALLEL [I] ON A[I]; SHADOW_RENEW B )

DO(I,1, 97,1)

A[I] = (B[I-1] + B[I+1] + B[I+2] ) / 3.;

When renewing shadow edges the maximal widths 1:2 specified in SHADOW directive are used.

Shadow edges for multidimensional distributed arrays can be distributed along each dimension. A special case is when remote reference points to "a corner" of shadow edges. In such a case it is needed to specify additional parameter CORNER.

Example 6.2. Remote access through "corners of shadow edges.

DVM(DISTRIBUTE [BLOCK][BLOCK]) float A[100][100];

DVM(ALIGN [i][j] WITH A[i][j]) float B[100][100];

. . .

DVM(PARALLEL [I][J] ON A[I][J]; SHADOW_RENEW B (CORNER))

DO( I, 1, 98, 1)

DO( J, 1, 98, 1)

A[I][J] = (B[I][J+1] + B[I+1][J] + B[I+1][J+1] ) / 3.;

The widths of shadow edges of the array B are equal to 1 element for all dimensions by default. As "corner" reference B[I+1][J+1] exists, the CORNER parameter is specified.

The other way to access through shadow edges is described in section 6.4.1.

6.1.2. Group of regular remote references. REMOTE_ACCESS directive

If the indexes of remote references have the form a*I b, then these references must be specified in REMOTE_ACCESS directive.

remote-access-directive

::= REMOTE_ACCESS

[ remote-group-name : ] regular-reference-string

regular-reference

::= dist-array-name [ regular-subscript-string ]

regular-subscript

::= [ int-expr ]

| [ do-variable-use ]

| []

remote-access-clause

::= remote-access-directive

REMOTE_ACCESS directive can be used as a separate directive prior to own computation statement or as additional specification in PARALLEL directive.

If remote reference is specified as array name without index list, then all references to the array in a distributed loop (and in own computation statement) are regular remote references.

If symbol [] is specified as dimension index regular-subscript then any index along this dimension causes remote access.

A set of references in REMOTE_ACCESS directive without specification of group name (remote-group-name) is called unnamed reference group.

Semantics of the directive performing for unnamed reference group is to read the remote data in the buffer and replace remote references by references to the buffer.

Example 6.3. Using unnamed group of regular remote references.

DVM(DISTRIBUTE [][BLOCK]) float A[100][100], B[100][100];

. . .

DVM(REMOTE_ACCESS A[50][50] ) X = A[50][50];

. . .

DVM( REMOTE_ACCESS B[100][100] )

{DVM(OWN) A[1][1] = B[100][100];}

. . .

DVM(PARALLEL [I][J] ON A[I][J] ; REMOTE_ACCESS B[][N] )

FOR(I, 100)

FOR(J, 100)

A[I][J] = B[I][J] + B[I][N];

Two first REMOTE_ACCESS directives specify remote references for own computation statements. REMOTE_ACCESS directive in distributed loop specifies remote data (matrix column) as the array section for all loop iterations.

The following optimization of remote data access is possible:

  • loading remote data in advance to overlap computations and data exchange,

  • loading remote data for several loops in advance,

A named group of regular remote references is defined for these purposes.

Group name definition.

remote-group-directive

::= REMOTE_GROUP

The identifier, specified in the directive, can be used only in REMOTE_ACCESS, PREFETCH and RESET directives.

prefetch-directive

::= PREFETCH group-name

reset-directive

::= RESET group-name

group-name

::= remote-group-name

| indirect-group-name

Semantics of the directive execution.

An initial value of variable, declared as remote references group, is undefined.

Характеристики

Список файлов учебной работы

Свежие статьи
Популярно сейчас
Зачем заказывать выполнение своего задания, если оно уже было выполнено много много раз? Его можно просто купить или даже скачать бесплатно на СтудИзбе. Найдите нужный учебный материал у нас!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
7021
Авторов
на СтудИзбе
260
Средний доход
с одного платного файла
Обучение Подробнее