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

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

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

FromArrayHeader

- the header of the source distributed array.

FromInitIndexArray

- array, which i-th element is the initial index value of the (i+1)-th dimension of the source array.

FromLastIndexArray

- array, which i-th element is the last index value of the (i+1)-th dimension of the source array.

FromStepArray

- array, which i-th element is the step of the index of the (i+1)-th dimension of the source array.

ToArrayHeader

- the header of the target distributed array.

ToInitIndexArray

- array, which j-th element is the initial index value of the (i+1)-th dimension of the target array.

ToLastIndexArray

- array, which j-th element is the last index value of the (i+1)-th dimension of the target array.

ToStepArray

- array, which j-th element is the step of the index of the (i+1)-th dimension of the target array.

*CopyRegimPtr

- the mode of copying.

The copying is executed until the exhaustion of the source or target elements. The elements are copied according to the C language discipline of allocating of the elements in the memory, that is the right index is changed more faster then the left one. If the initial value of the index by some dimension of the source or target array is greater or equal to its last value, then the index of this dimension is not changed during copy operation. Note, that Run-Time Library considers the last index value of any dimension as a minimum of the defined value in the function call and the real size of this dimension minus 1.

To use a full scope of the source or target array without requesting the size of the object by some dimension (see section 17.2), Run-Time Library supposes that the value of the initial index value can be equal to -1. In that case, the initial index value is supposed to be equal to zero, the step be equal to 1, and the last index value be equal to the size of the dimension minus 1.

One of the arrays (but not the both) can be not distributed but rather a normal one replicated among all the processors (Run-Time Library determines this case if the pointer of the array is not the pointer to the header of the distributed array). The types of the elements of replicated and distributed arrays must be the same. It is assumed that the replicated array is one-dimensional, and that the elements of this array are allocated in the memory consequently and continuously. Run-Time Library ignores the parameters of the indexes of such array.

If the one of the arrays is not a distributed one, then the copy mode is determined by the value of the *CopyRegimPtr flag:

  • if the flag *CopyRegimPtr is positive, then Run-Time Library assumes that the «normal» array is allocated on the I/O processor only.

  • if *CopyRegimPtr is negative (it is allowable only for “normal” array to be read), then the distributed array, specified by the parameter ToArrayHeader, will be filled by an element with address, specified by the parameter FromArrayHeader.

If both arrays are non-distributed ones, then the copying is not executed.

If both arrays are distributed ones, then these arrays can be different in the rank and in the size of each dimension, but the types of the element of the arrays have to be the same.

The function returns the number of the copied elements.

13.3. Asynchronous coping distributed arrays.

long arwelm_ (

long
long
long
AddrType

FromArrayHeader[],
ToArrayHeader[],
IndexArray[],
*CopyFlagPtr );

long arwelf_ (

long
AddrType
long
AddrType

FromArrayHeader[],
*ToArrayHeaderPtr,
IndexArray[],
*CopyFlagPtr );

long acopel_(

long
long
long
long
AddrType

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

long aelmcp_ (

long
long
long
long
long
AddrType

FromArrayHeader[],
FromIndexArray[],
ToArrayHeader[],
ToIndexArray[],
*CopyRegimPtr,
*CopyFlagPtr );

long aarrcp_ (

long
long
long
long
long
long
long
long
long
AddrType

FromArrayHeader[],
FromInitIndexArray[],
FromLastIndexArray[],
FromStepArray[],
ToArrayHeader[],
ToInitIndexArray[],
ToLastIndexArray[],
ToStepArray[],
*CopyRegimPtr,
*CopyFlagPtr );

Described above functions arwelm_ , arwelf_ , acopel_ , aelmcp_ and aarrcp_ starts coping operations, executed by the functions rwelm_, rwelmf_, copelm_, elmcpy_, and arrcpy_. All parameters of considered functions, except of the last one, are similar to the same named parameters of their synchronous analogous. The last parameter *CopyFlagPtr is the pointer to the flag of completion of the started coping operation.

Waiting for completion of coping is performed by the function

long waitcp_ (AddrType *CopyFlagPtr);

*CopyFlagPtr

- flag of coping operation completion, specified when starting the operation

13.4. Access to elements of local part of distributed array.

Let n be the rank of the distributed array. Then the header of this array in the call of the function crtda_ can be declared for example as:

long ArrayHeader[n+1];

Let the base pointer corresponding to the type of the elements of the distributed array be BasePtr. Then the element (I1, ... , In) from the local part of the distributed array can be accessed through linear index in the following manner:


BasePtr[

n-1
(ArrayHeader[k]*Ik) + In + ArrayHeader[n] ]
k=1

For C the value of the base pointer in crtda_ function call may be NULL. In that case the element of the local part of the distributed array may be accessed in the following manner:


((Type *)ArrayHeader[n])[

n-1
(ArrayHeader[k]*Ik) + In] ,
k=1

where: Type is the type of the element of the distributed array.

Run-Time Library calculates the coefficients ArrayHeader[1], ... ,ArrayHeader[n-1] and the address constant ArrayHeader[n] in the functions of the array alignment align_ and realn_ in the following manner.

Let:

Ii,low

- the low index value of the local part of the distributed array on the i-th dimension;

Ii,high

- the high index value of the local part of the distributed array on the i-th dimension;

Lwi

- the width of the low shadow edge of the distributed array on the i-th dimension;

Hwi

- the width of the high shadow edge of the distributed array on the i-th dimension.

ArrayPtr

- pointer to the local part of the array (that is the part allocated in the memory together with the shadow edges).

TypeSize

- the size of the element of the distributed array (in bytes).

Then:


ArrayHeader[m] =

n
(Ik,high - Ik,low + LWk + HWk + 1)
, 1 m n-1;
k=m+1


ArrayHeader[n] = LWn - In,low +

n-1
( ArrayHeader[m]*(LWm - Im,low));
m=1

ArrayHeader[n] = {

ArrayHeader[n]+((long)ArrayPtr-(long)BasePtr)/TypeSize
when BasePtr# NULL,
ArrayHeader[n]*TypeSize+(long)ArrayPtr
when BasePtr= NULL.

Note, that Run-Time Library allocates (during the execution of the functions align_ and realn_) the local part of the distributed array in the memory in so manner that the difference ArrayPtr - BasePtr must be multiple of the TypeSize.

The access to the elements of the local part of the distributed array is performed either directly by its header and the base pointer, or by the functions rlocel_ , wlocel_ and clocel_ (that is less effective) described below.

13.4.1. Requesting if array element is allocated in local part of distributed array.

long tstelm_(

long
long

ArrayHeader[],
IndexArray[]);

ArrayHeader

- header of distributed array.

IndexArray

- IndexArray[i] is the index of the element of the distributed array by (i+1)-th dimension.

The number of specified indexes has to be equal to the rank of the distributed array.

The function returns non-zero value, if specified element is allocated in the local part of the specified distributed array, and zero in other case.

13.4.2. Requesting initial and last index values of local part of distributed array.

long locind_(

long
long
long

ArrayHeader[],
InitIndexArray[],
LastIndexArray[]);

ArrayHeader

- header of distributed array.

InitIndexArray

- array, which i-th element will be assigned by initial value of the index of the local part of distributed array on (i+1)-th dimension.

LastIndexArray

- array, which i-th element will be assigned by last value of the index of the local part of the distributed array on (i+1)-th dimension.

The sizes of the arrays InitIndexArray and LastIndexArray must be equal to the distributed array rank.

The function returns non-zero value, if the specified array has a local part and zero in other case. If the array has no the local part, the arrays InitIndexArray and LastIndexArray are not updated.

13.4.3. Reading element of local part of distributed array.

long rlocel_(

long
long
void

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

ArrayHeader

- a header of the distributed array.

IndexArray

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

BufferPtr

- pointer to the memory area, the element will be written in.

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

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

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

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