LIBDVM2 (1158351), страница 13

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

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

The size of distributed array element in bytes (a number of read bytes) is returned.

13.4.4. Assigning value to element of local part of distributed array.

long wlocel_(

void
long
long

*BufferPtr,
ArrayHeader[],
IndexArray[]);

ArrayHeader

- a header of the distributed array.

IndexArray

- array, which i-th element is index value of modified element of the distributed array on (i+1)-th dimension.

BufferPtr

- pointer to the memory area, where the value is located.

The function can be executed successfully only by the processor, in whose memory the specified element is located.

The size of distributed array element in bytes is returned.

13.4.5. Coping element of local part of distributed array to element of local part of other distributed array.

long clocel_(

long
long
long
long

FromArrayHeader[],
FromIndexArray[],
ToArrayHeader[],
ToIndexArray[]);

FromArrayHeader

- header of read distributed array.

FromIndexArray

- ditributed array, which i-th element is index value of read element of the distributed array on (i+1)-th dimension.

ToArrayHeader

- header of the other distributed array, the element will be assigned by the read value.

ToIndexArray

- array, which j-th element is index value of updated element of the distributed array on (i+1)-th dimension.

The function can be executed successfully only by the processor, in whose memory the read and written elements are allocated. The types of read and written elements must be the same.

The number of copied bytes is returned.

13.4.6. Requesting address of element of local part of distributed array.

char *GetLocElmAddr(

long
long

ArrayHeader[],
IndexArray[]);

ArrayHeader

- header of the distributed array.

IndexArray

- array, which i-th element is index value of element of distributed array on (i+1)-th dimension.

The function can be executed successfully only by the processor, in whose memory the specified element is allocated.

The pointer to the first byte of the element is returned.

13.5. Macros to access elements of local part of distributed array of rank from1 to 7.

The following macros to access the elements from the local part of the distributed array with rank from 1 to 7 can be used in C programs:

<DAElmType> DAElm<Rank> (

long

long
....
long

ArrayHeader[],
<DAElmType>,
Index1,
...
Index<Rank>);

ArrayHeader

- header of the distributed array.

Rank

- the rank of the distributed array.

DAElmType

- the type of the element of the distributed array.

Indexi

- index value of the requested element on the i-th dimension of the distributed array.

Each of these macros is L-value in the C language.

The access to local part of distributed array by means of macros is more effective, then the access by the functions, described in section 13.3.

It is assumed that the array with the header ArrayHeader was created with the base pointer equal to NULL.

14. Regular access to remote data.

The access to the distributed array elements, allocated on the other processor (remote elements) is implemented by means of creation of a special buffer (a remote element buffer) on the current processor and coping it required remote data. The required remote elements are determined by specified for each dimension of the distributed array linear rules of sampling (regular access) of the form

Ai*Vi + Bi ,

where:

I

- a number of the distributed array dimension;

Vi

- index variable of sampling rule of i-th dimension of the array;

Ai, Bi

- integer constants.

On the current processor a range of values is specified for each index variable Vi. As a result required remote elements are represented as a stretched block, allocated in the buffer in compact (not stretched) form.

Dealing with remote element buffer is similar to dealing with local part of distributed array (see section 13).

For the purpose of optimization the remote element buffers can be combined the groups and filling all buffers of the group is executed by one operation.

14.1 Creating remote element buffer of distributed array.

long crtrb (

long
long
void
long
long
long
long
long
long

ArrayHeader[],
BufferHeader[],
*BasePtr,
*StaticSignPtr,
CoeffArray[],
ConstArray[],
InitIndexArray[],
LastIndexArray[],
StepArray[] );

ArrayHeader

- header of the distributed array

BufferHeader

- header of a remote element buffer to be created

BasePtr

- base pointer for access to the remote element buffer

*StaticSignPtr

- flag of static buffer creation

CoeffArray

- array, which i-th element is coefficient of index variable of the linear sampling rule for (i+1)-th dimension of the array (Ai).

ConstArray

- array, which i-th element is constant of index variable of the linear sampling rule for (i+1)-th dimension of the array (Bi).

InitIndexArray

- array, which i-th element is initial value of index variable of the linear sampling rule for (i+1)-th dimension of the array.

LastIndexArray

- array, which i-th element is last value of index variable of the linear sampling rule for (i+1)-th dimension of the array.

StepArray

- array, which i-th element is step of index variable of linear sampling rule for (i+1)-th dimension of the array.

The function crtrb_ creates a buffer to allocate remote elements of the distributed array with header ArrayHeader.

The created buffer header BufferHeader is the array of r+1 elements of type "long", where r is the number of the distributed array dimensions, for which CoeffArray[i] # 0 or ConstArray[i] <0, i.e. a number of the array dimensions, for which linear sampling rule is not constant (see below). The buffer header allocation in memory (static or dynamic) is perfumed by a user program, and the buffer initialization is performed by Run-Time Library when executing the function crtrb_.

The base pointer BasePtr must refer to any variable of the same type as the type of the distributed array elements. The variable value is irrelevant, because the base pointer is used only for access to remote elements of the distributed array, allocated in the created buffer.

Dealing with the header of remote elements buffer and base pointer is considered in detail in section 14.5.

If the flag *StaticSignPtr of static buffer is not equal to zero, then the created buffer will be not deleted automatically, when the control exits the program block (see section 8). Such buffer can be deleted only explicitly using the function delrb_ considered below.

The buffer, created by the function crtb_, is intended to allocate remote elements, determined by the index vectors of the form

( CoeffArray[0]*V1 + ConstArray[0] ,

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

CoeffArray[i-1]*Vi + ConstArray[i-1] ,

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

CoeffArray[n-1]*Vn + ConstArray[n-1] ) ,

where:

n

- the distributed array rank;

CoeffArray[i-1]*Vi + ConstArray[i-1]

- linear coordinate sampling rule for i-th dimension of the array;

Vi

- index variable of sampling rule for i-th dimension of the array

InitIndexArray[i-1] Vi LastIndexArray[i-1]

when StepArray[i-1] > 0

or

LastIndexArray[i-1] Vi InitIndexArray[i-1]

when StepArray[i-1] < 0

Correct sampling rules must satisfy to the following conditions:

0 CoeffArray[i-1]*InitIndexArray[i-1]+ConstArray[i-1] < Sizei,

0 CoeffArray[i-1]*LastIndexArray[i-1]+ConstArray[i-1] < Sizei,

where Sizei - size of i-th dimension of the distributed array (1 i n).

The buffer will not be created (more exactly, the buffer for zero number of the elements will be created, even if for one i

InitIndexArray[i-1] > LastIndexArray[i-1] when StepArray[i-1] > 0

or

LastIndexArray[i-1] > InitIndexArray[i-1] when StepArray[i-1] < 0

For full coverage by the sampling rule of i-th dimension of the distributed array CoeffArray[i-1] must be equal to zero, and ConstArray[i-1] must be equal to -1. The such specification is equivalent to sampling rule 1*Vi + 0 , where 0 Vi < Sizei.

The function returns zero.

14.2. Initializing loading remote element buffer of distributed array.

long loadrb_ (long BufferHeader[]);

BufferHeader - header of the remote element buffer.

The function loadrb_ initializes loading of specified buffer by the distributed array elements, for which the buffer was created by the function crtrb_.

The function returns zero.

14.3. Waiting for completion of loading remote element buffer of distributed array.

long waitrb_ (long BufferHeader[]);

BufferHeader - header of the remote element buffer.

The function returns zero.

14.4. Deleting remote element buffer of distributed array.

long delrb_ (long BufferHeader[]);

BufferHeader - header of the remote element buffer to be deleted.

Non-static remote element buffer can be deleted by the function delrb_ only in the case if it was created in the current program block.

To delete remote element buffer the function delobj_ can also be used (see section 17.5).

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

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

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