rtsIDe (1158448), страница 22

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

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

*StreamPtr

the input file descriptor.

ArrayHeader

the header of the distributed array.

InitIndexArray

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

LastIndexArray

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

StepArray

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

The function reads the sub-array of the distributed array. This sub-array is determined by the following set of the index corteges:

{ I1  M1: I1 = InitIndexArray[0]
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

{ Ik  Mk: Ik = InitIndexArray[k-1]
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
{ In  Mn: In = InitIndexArray[n-1]

+ StepArray[0] *P1 } 
. . . . . . . . . . . . . . . . . .
+ StepArray[k-1]*Pk } 
. . . . . . .. . . . . . . . . . . .
+ StepArray[n-1]*Pn }
,

where:

symbol of Cartesian product;

n

rank of the distributed array;

Ik

index variable of the k-th dimension of the distributed array.

0 Pk (LastIndexArray[k-1] InitIndexArray[k-1] 1) / StepArray[k-1].

The subarray to be read is a block (stretched, if at least one StepArray[i] is not equal to 1).

The reading is executed until the exhaustion of the source elements. The elements are copied in the order, 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 tárget 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 System 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 target array without requesting the size of the object by some dimension (see section 17.2), Run-Time System 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.

The function returns the number of the copied elements.

long dvm_dfread (

long
long
DVMFILE

ArrayHeader[],
Count,
*StreamPtr );

ArrayHeader

the header of the distributed array.

Count

the number of the elements to read.

*StreamPtr

the descriptor of the input file.

The function dvm_dfread reads no more than Count of the first elements of the distributed array (in order of allocation this array in memory). If Count is greater then zero the number of the copied elements is supposed to be minimum of Count and the real number of the elements in the distributed array. If Count is a negative number then the function reads the distributed array entirely.

The function returns the number of the copied elements.

16.3Writing sub-array of distributed array to file

long DisArrWrite(

DVMFILE
long
long
long
long

*StreamPtr,
ArrayHeader[],
InitIndexArray[],
LastIndexArray[],
StepArray[] );

*StreamPtr

the descriptor of the output file.

ArrayHeader

the header of the distributed array.

InitIndexArray

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

LastIndexArray

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

StepArray

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

The functions writes the sub-array of the distributed array. This sub-array is determined by the following set of the index corteges:

{ I1  M1: I1 = InitIndexArray[0]
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
{ Ik  Mk: Ik = InitIndexArray[k-1]
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
{ In  Mn: In = InitIndexArray[n-1]

+ StepArray[0] *P1 } 
. . . . . . . . . . . . . . . . . .
+ StepArray[k-1]*Pk } 
. . . . . . . . . . . . . . . . . .

+ StepArray[n-1]*Pn } ,

where:

x

symbol of Cartesian product;

n

rank of the distributed array;

Ik

index variable of the k-th dimension of the distributed array.

0 Pk (LastIndexArray[k-1] InitIndexArray[k-1] 1) / StepArray[k-1].

The subarray to be coped is a block (stretched, if at least one StepArray[i] is not equal to 1).

The writing is executed until the exhaustion of the source elements. The elements are copied in the order, 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 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 System 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 array without requesting of the size of the object by some dimension (see section 17.2), Run-Time System 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 is equal to 1, and the last index value is equal to the size of the dimension minus 1.

The function returns the number of the copied elements.

long dvm_dfwrite(

long
long
DVMFILE

ArrayHeader[],
Count,
*StreamPtr );

ArrayHeader

the header of the distributed array.

Count

the number of the elements to be copied.

*StreamPtr

the descriptor of the output file.

The function dvm_dfwrite writes no more then Count of the first elements of the distributed array (in order of allocation this array in memory). If Count is greater then zero the number of the copied elements is supposed to be minimum of Count and the real number of the elements in the distributed array. If Count is a negative number then the function writes the distributed array entirely.

The function returns the number of the copied elements.

Note 1. Distributed array, specified in dvm_dfread, DisArrRead, dvm_dfwrite and DisArrWrite function call must be mapped on the processor system, all elements of which must belong to the current processor system.

Note 2. The first Count elements in order of the memory allocation are not a block in common case and can be described in the following way. Let decomposition of the number Count by the dimension weights of the distributed array is


Count =

n
Ki*Wi ,

i=1

where:

n

rank of the distributed array;

Ki

decomposition coefficient of i-th dimension (0 Ki Sizei -1 , Sizei - size of i-th dimension);

Wi

weight of i-th dimension.




W
i =

{

n
Sisej
j=i+1

1


if 1 ≤ i < n ;

if i = n .

Then first Count elements may be represented as the following union of blocks:

n
UBm =
m=1
K
m0

n
U (
m=1
K
m0


{ max(0,K
11) }
. . . . . . . . . . . . . . . . . . . . . . . . . . .
{ max(0,K
m-11) }
{ I
m Mm : 0 ≤ Im ≤ Km }
{ Im+1 Mm+1: 0 ≤ Im+1 ≤ Km+1 }
. . . . . . . . . . . . . . . . . . . . . . . . . . .
{ I
n Mn : 0 ≤ In ≤ Kn } )

Therefore reading (writing) the first Count elements of the distributed array by the function dvm_dfread (dvm_dfwrite) is equivalent to sequential reading (writing) existing blocks B1, ... ,Bn using the function DisArrRead (DisArrWrite) (the block Bm exists, if Km is not equal to zero).

17Miscellaneous functions

17.1Requesting size of object

long getrnk_(ObjectRef *ObjectRefPtr);

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

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

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