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

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

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

The function returns zero.

15.3. Waiting for completion of loading remote element buffer of non-regular access.

long waitib_ (long BufferHeader[]);

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

The function returns zero.

15.4. Deleting remote element buffer of non-regular access.

long delib_ (long BufferHeader[]);

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

Non-static remote element buffer can be deleted by the function delib_ only 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).

The function returns zero.

15.5. Access to remote elements, allocated in the buffer.

At any processor the remote element buffer of non-regular access is similar to a local part of two-dimensional distributed array. Therefore its header may be declared, for example, as

long BufferHeader[3];

The access to allocated in the buffer remote element, is implemented by index variables of sampling rule of the array distributed dimension (by the index variables of the matrix of global indexes):

BasePtr[ BufferHeader[1]*Vk + J + BufferHeader[2] ] ,

where:

BasePtr

- base pointer, corresponding to the element type of the distributed array;

Vk,J

- the index variables of 1-th и 2-th dimensions of global index matrix.

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

((Type *)BufferHeader[2])[ BufferHeader[1]*Vk + J ] ,

where Type is the type of the distributed array elements.

The coefficient BufferHeader[1] and the address constant BufferHeader[2] 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;

Then:

BufferHeader[1] = MAX( ME[Vk,0] );

Vk,нач Vk Vk,last

BufferHeader[2] = -BufferHeader[1]*Vk,init;

BufferHeader[2] =

{

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

when BasePtr # NULL;

BufferHeader[2]*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 they are used

  1. the buffer header is necessary to use instead of the distributed array header;

  2. the array rank is equal to 2.

  1. the vector of the index variables values (Vk and J) of the distributed dimension sampling rule is used as the index vector of the element.

15.6. Creating group of remote element buffers of non-regular access.

IndirectAccessGroupRef crtig_ (

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 an empty buffer group (not containing buffers) and returns a 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 delig_, 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, the ones are deleted implicitly.

15.7. Including remote element buffer of non-regular access in the group.

long insib_ (

IndirectAccessGroupRef
long

*IndirectAccessGroupRefPtr,

BufferHeader[] );

*IndirectAccessGroupRefPtr

- pointer to the buffer group.

BufferHeader

- header of the buffer to be included.

The function returns zero.

15.8. Starting loading remote element buffers of specified group.

long loadig_ (IndirectAccessGroupRef *IndirectAccessGroupRefPtr);

*IndirectAccessGroupRefPtr - pointer to the buffer group.

The function returns zero.

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

long waitig_ (IndirectAccessGroupRef *IndirectAccessGroupRefPtr);

*IndirectAccessGroupRefPtr - pointer to the buffer group.

The function returns zero.

15.10. Deleting group of remote element buffers of non-regular access.

long delig_ (IndirectAccessGroupRef *IndirectAccessGroupRefPtr);

*IndirectAccessGroupRefPtr - pointer to the buffer group to be deleted.

Non-static buffer group can be deleted by the function delig_ only 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.

16. Input/Output.

16.1. Analogies to functions of C language standard library.

All functions discussed below is intended for usage for input/output of the replicated variables (all copies of each variable are equal). The implementation of these functions is based on the execution of the standard C functions on the processor, called «I/O processor». The result (if one exists) of the functions is sent to all the processors. For example, the execution of the function dvm_prinf results in single printing from the I/O processor. The execution of the function printf results in multiple printing from each processor. It is possible to determine if the current processor is I/O processor with the help of the function tstio_ (see section 17.6).

Note, that it is possible to use in the user program the I/O functions of the standard C language library (ANSI), which have no corresponding functions in the list below and have no undesirable effect of multiple execution.

16.1.1. High level input/output functions.

ANSI:

void

dvm_clearerr

(DVMFILE *StreamPtr);

int

dvm_fclose

(DVMFILE *StreamPtr);

int

dvm_feof

(DVMFILE *StreamPtr);

int

dvm_ferror

(DVMFILE *StreamPtr);

int

dvm_fflush

(DVMFILE *StreamPtr);

int

dvm_fgetc

(DVMFILE *StreamPtr);

int

dvm_fgetpos

(DVMFILE *StreamPtr, fpos_t *PosPtr);

char

*dvm_fgets

(char *StringPtr, int n, DVMFILE *StreamPtr);

DVMFILE

*dvm_fopen

(const char *FileNamePtr, const char *TypePtr);

int

dvm_fprintf

(DVMFILE *StreamPtr, const char *FormatPtr [,Argument,...]);

void

dvm_void_fprintf

(DVMFILE *StreamPtr, const char *FormatPtr [,Argument,...]);

int

dvm_fputc

(int c,DVMFILE *StreamPtr);

int

dvm_fputs

(const char *StringPtr, DVMFILE *StreamPtr);

int

dvm_fread

(void *BufferPtr, size_t Size, size_t Count, DVMFILE *StreamPtr);

DVMFILE

*dvm_freopen

(const char *FileNamePtr, const char *TypePtr, DVMFILE *StreamPtr);

int

dvm_fscanf

(DVMFILE *StreamPtr, const char *FormatPtr [,ArgumentPtr,...]);

int

dvm_fseek

(DVMFILE *StreamPtr, long Offset, int Origin);

int

dvm_fsetpos

(DVMFILE *StreamPtr, const fpos_t *PosPtr);

long

dvm_ftell

(DVMFILE *StreamPtr);

int

dvm_fwrite

(const void *BufferPtr, size_t Size, size_t Count, DVMFILE *StreamPtr);

int

dvm_getc

(DVM_FILE *StreamPtr);

int

dvm_getchar

(void);

char

*dvm_gets

(char *BufferPtr);

int

dvm_printf

(const char *FormatPtr, ... );

void

dvm_void_printf

(const char *FormatPtr, ... );

int

dvm_putc

(int c, DVMFILE *StreamPtr);

int

dvm_putchar

(int c);

int

dvm_puts

(char const *StringPtr);

void

dvm_rewind

(DVMFILE *StreamPtr);

int

dvm_scanf

(const char *FormatPtr, [,ArgumentPtr,...]);

void

dvm_setbuf

(DVMFILE *StreamPtr, char *BufferPtr);

int

dvm_setvbuf

(DVMFILE *StreamPtr, char *BufferPtr, int Type, int Size);

DVMFILE

*dvm_tmpfile

(void);

int

dvm_ungetc

(int c,DVMFILE *StreamPtr);

int

dvm_vfprintf

(DVMFILE *StreamPtr, const char *FormatPtr, va_list ArgList);

void

dvm_void_vfprintf

(DVMFILE *StreamPtr, const char *FormatPtr, va_list ArgList);

int

dvm_vprintf

(const char *FormatPtr, va_list ArgList);

void

dvm_void_vprintf

(const char *FormatPtr, va_list ArgList);

TURBO-C & MICROSOFT-C:

int

dvm_fgetchar

(void);

int

dvm_fputchar

(int c);

TURBO-C:

int

dvm_vscanf

(DVMFILE *StreamPtr, const char *FormatPtr,
va_list ArgList);

int

dvm_vscanf

(const char *FormatPtr, va_list ArgList);

In the functions above to specify standard streams the following pointers can be used:

DVMSTDIN

- standard input stream;

DVMSTDOUT

- standard output stream;

DVMSTDERR

- standard error stream;

DVMSTDAUX

- standard com port;

DVMSTDPRN

- standard printer port

Note1. The distinction (in the realization) between the functions dvm_void_printf, dvm_void_fprintf, dvm_void_vprintf, dvm_void_vfprintf are the functions dvm_printf, dvm_fprintf, dvm_vprintf, dvm_vfprintf is that the I/O processor does not send the return values of the functions printf, fprintf, vprintf and vfprintf to another processors, i.e. their is difference in the execution time. The full analogues of the standard functions printf, fprintf, vprintf and vfprintf are the functions dvm_printf, dvm_fprintf, dvm_vprintf and dvm_.

Note2. The functions dvm_fread and dvm_fwrite can be used to read/write the distributed array. In this case, the BufferPtr pointer has to point to the header of the distributed array. The size of the array element is assumed to be equal to *TypeSizePtr (that is value used at the array creation with the function crtda_), not Size. The number of the elements to read/write is assumed to be equal to the minimum of Count*Size/(*TypeSizePtr) and the number of the elements in the distributed array (also see the description of the functions dvm_dfread and dvm_dfwrite in sections 16.2 and 16.3).

16.1.2. Low lewel I/O functions.

TURBO-C & MICROSOFT-C & PORTLAND GROUP-C:

int

dvm_close

(DVMHANDLE *HandlePtr);

int

dvm_fstat

(DVMHANDLE *HandlePtr, struct stat *BufferPtr);

long

dvm_lseek

(DVMHANDLE *HandlePtr, long Offset,int Origin);

DVMHANDLE

*dvm_open

(const char *FileNamePtr, int OFlag, int Pmode);

int

dvm_read

(DVMHANDLE *HandlePtr, char *BufferPtr, unsigned int Count);

int

dvm_write

(DVMHANDLE *HandlePtr, const void *BufferPtr, unsigned int Count);

To access to standard I/O streams in low level I/O functions the following pointers may be used:

DVMSTREAM0

- standard input stream;

DVMSTREAM1

- standard output stream;

DVMSTREAM2

- standard error stream;

DVMSTREAM3

- standard com port;

DVMSTREAM4

- standard printer port

16.1.3. Operations with directories and files.

ANSI:

Int

Dvm_remove

(const char *FileNamePtr);

Int

Dvm_rename

(const char *OldNamePtr, const char *NewNamePtr);

Char

*dvm_tmpnam

(char *FileNamePtr);

TURBO-C & MICROSOFT-C & PORTLAND GROUP-C:

Int

Dvm_access

(const char *FileNamePtr, int Mode);

Int

Dvm_stat

(const char *FileName, struct stat *BufferPtr);

Int

Dvm_unlink

(const char *FileNamePtr);

Note. A user program can use low level I/O functions and the functions dvm_access and dvm_stat only in the case, if C compiler library contains corresponding functions.

16.2. Reading from file to sub-array of distributed array.

long DisArrRead(

DVMFILE
long
long
long
long

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

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

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

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