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

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

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

The function returns zero.

14.5. Access to distributed array elements, allocated in remote element buffer.

Let r be the number of the distributed array dimensions, for which the linear sampling rule is not constant (the buffer rank). Then the header of remote element buffer, specified in the function crtrb_ call may be declared, for example, as

long BufferHeader[r+1];

Let the base pointer, corresponding to distributed array element type, be BasePtr. Then the access to allocated in the buffer element, determined by the index vector (V1,... ,Vk, ... ,Vr), is performed by the linear index in the following way:

r-1

BasePtr[ ( BufferHeader[k]*Vk ) + Vr + BufferHeader[r] ] ,

k=1

where Vk is index variable of k-th not-constant sampling rule,

For C language the base pointer value can be equal to NULL in the function crtrb_ call. Then the access to the remote element allocated in the buffer can be performed as follows:

r-1

((Type *)BufferHeader[r])[ ( BufferHeader[k]*Vk ) + Vr] ,

k=1

where Type is the type of distributed array element.

The coefficients BufferHeader[1], ... ,BufferHeader[r-1] and the address constant BufferHeader[r] are calculated by Run-Time Library when executing the function crtrb_ in the following way.

Let:

BufferPtr

- address of remote element buffer;

TypeSize

- size in bytes of distributed array element;

m and k

- m-th and k-th not-constant sampling rules;

Im and Ik

- dimension number of m-th and k-th not-constant sampling rule;

Ir

- dimension number of the last (r-th) not-constant sampling rule

Then:

r

BufferHeader[m] = ( LastIndexArray[Ik-1] - InitIndexArray[Ik-1]+1 ); (1 m r-1)

k=m+1

r-1

BufferHeader[r] = -InitIndexArray[Ir-1] - ( BufferHeader[m] * InitIndexArray[Im-1] );

m=1

BufferHeader[r] =

{

BufferHeader[r] + ((long)BufferPtr - (long)BasePtr) / TypeSize

when BasePtr # NULL;

BufferHeader[r] * TypeSize + (long)BufferPtr

when BasePtr = NULL.

Note. To access to the remote elements, allocated in the buffer, the functions and macros, considered in section 13, can be used. When using them, then

  1. the buffer header is used instead of the distributed array header;

  2. the array rank is supposed to be equal to the number of the array (the elements are located in the buffer) dimensions with non-constant sampling rules

  3. the vector of index variable values of non-constant sampling rules is used as index vector of an element.

14.6. Creating group of remote element buffers.

RegularAccessGroupRef crtbg_ (

long
long

*StaticSignPtr,

*DelBufSignPtr );

*StaticSignPtr

- flag of creating static group of buffers.

*DelBufSignPtr

- flag of deleting all buffers, included in the group, when deleting the group.

The function crtbg_ creates empty buffer group (containing no buffers) and returns pointer to the group.

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

If *DelBufSignPtr is not equal to zero, then all included in the group buffers will be deleted when the group is deleted. If deleting is explicit, all included buffers are deleted explicitly , and if deleting is implicit, they are deleted implicitly.

14.7. Including remote element buffer in the group.

long insrb_ (

RegularAccessGroupRef
long

*RegularAccessGroupRefPtr,
BufferHeader[] );

*RegularAccessGroupRefPtr

- pointer to the buffer group.

BufferHeader

- header of a buffer to be inserted.

The function returns zero.

14.8. Starting loading remote element buffers of specified group.

long loadbg_ (RegularAccessGroupRef *RegularAccessGroupRefPtr);

*RegularAccessGroupRefPtr - pointer to the buffer group.

The function returns zero.

14.9. Waiting for completion of loading remote element buffers of specified group.

long waitbg_ (RegularAccessGroupRef *RegularAccessGroupRefPtr);

*RegularAccessGroupRefPtr - pointer to the buffer group.

The function returns zero.

14.10. Deleting group of remote element buffers.

long delbg_ (RegularAccessGroupRef *RegularAccessGroupRefPtr);

*RegularAccessGroupRefPtr - a pointer to the buffer group to be deleted.

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

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

The function returns zero.

15. Non-regular access to remote data.

A scheme of non-regular access to the remote elements of distributed array is similar to scheme of the regular access, considered in section 14. But its application area is restricted by the arrays, having the only distributed dimension (all other dimensions are replicated). The remote elements, required in the current processor buffer, are specified by a set of the index vectors of the form:

{C1} x ... x {Ck-1} x

U { ME[Vk,J+1] (~M: 0 J < ME[Vk,0] } x

Vk,init Vk Vk,last

{Ck+1} x ... x {Cn} ,

where:

n

- rank of distributed array;

k

- number of its distributed dimension;

Ck, ... ,Ck-1,Ck+1, … ,Cn

- integer non-negative numbers (constant sampling rules for replicated dimensions);

ME

- matrix of global indexes (or index matrix);

Vk,J

- index variables of sampling rule of distributed dimension;

Vk,init,Vk,last

- initial and last values of index variable Vk for the current processor.

The index matrix ME is the distributed array, with the first distributed dimension and the second replicated one (the segment [Vk,init, Vk,last] is the local part of the index matrix by the first dimension for the current processor). The size Size2 of the second dimension of the matrix ME is equal to

MAX(ME[Vk,0]) + 1,

0 Vk < Size1

where Size1 - the size of its first dimension.

ME[Vk,0]

- for each Vk: the number of corresponding to it coordinates of the distributed dimension of the array.

ME[Vk,J]

- for each Vk and J: the value of the coordinate of the distributed dimension of the array (0 J < ME[Vk,0]).

15.1. Creating remote element buffer of non-regular access.

long crtib_ (

long
long
void
long
long
long

ArrayHeader[],

BufferHeader[],

*BasePtr,

*StaticSignPtr,

MEHeader[],

ConstArray[] );

ArrayHeader

- header of the distributed array

BufferHeader

- header of the remote element buffer to be created

BasePtr

- base pointer for an access to remote element buffer

*StaticSignPtr

- flag of static buffer creation

MEHeader

- header of the index matrix

ConstArray

- array, which i-th element is the constant of the remote element sampling for (i+1)-th dimension of the distributed array (Ci+1).

The function crtib_ creates a buffer to allocate the remote elements of the distributed array with the header ArrayHeader, satisfying to remote access conditions.

The header BufferHeader of the created buffer is the array of 3 elements of "long" type. The buffer header allocation in memory (static or dynamic) is performed by a user program, but its initialization is performed by Run-Time Library when executing the function crtib_.

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).

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

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

The index matrix header MEHeader is the array of 3 elements of "long" type. When the function crtib_ is called, the index matrix and the distributed array must be allocated in the memory (mapped).

A value of ConstArray[k-1] is irrelevant (k is a number of the distributed dimension of the array with header ArrayHeader).

The function returns zero.

15.2. Starting loading remote element buffer of non-regular access.

long loadib_ (long BufferHeader[]);

BufferHeader - header of the remote element buffer of non-regular access.

The function loadib_ initializes loading specified buffer by the distributed array elements, for which the buffer was created by the function crtib_.

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

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

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