debugDDe (1158408), страница 5

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

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

Note: Iterations of a parallel loop can depend from each other due to usage of reduction variables inside loop. But in this case such dependence doesn’t prevent parallel loop execution and should be declared by programmer when specifying the parallel loop. If a program hasn’t such declaration the variable will be considered as a private variable and private variable usage error will be detected.

When the program accesses to a distributed array inside a parallel construction the local part of the array is calculated.

If the local part of the array doesn’t contain the accessed element an error of access to non-local part is reported. If a shadow edge contains the accessed element the shadow edge renewal checking is performed.

The following three states are assigned to shadow edges of a distributed array: the renewal isn’t performed, renewal being started and renewal has been finished. The program can access to the shadow edges only for reading and only after the renewal has been completed.

The state “renewal isn’t performed” is set when exported elements are modified. It provides a detection of incorrect access to shadow elements before the next edge renewal will be performed. The error is reported when exported elements are modified before renewal of edges has been completed.

5.3Checking private and read-only variables

The type of a variable is determined when the first use of the variable inside a parallel construction is detected. If the variable is not reduction variable or distributed array then its type is determined by the following way. If the variable is used for writing it will be registered as private. Otherwise it will be registered as read-only.

Each private variable has its initialization flag. The flag is set if the variable is initialized inside given loop iteration or task and otherwise flag is cleared. When variable is modified the flag is set. When the variable is read the flag setting is checked. The private variable flags are cleared after parallel loop exit.

Access type checking is performed for read-only variables. If the program attempts to write to read-only variable the error will be detected.

5.4Checking reduction variables

Reduction variables are registered when included into a reduction group. The reduction variable has a flag that can assume the following states:

  • The variable is used inside a parallel loop. This is initial state of the reduction variable.

  • The parallel construction has been finished, but asynchronous reduction for the variable is not started yet.

  • The asynchronous reduction for the variable being started.

  • The asynchronous reduction for the variable has been completed. This is final state of reduction variable. The reduction variable will be deleted from the table of variables and can be used as a variable of other class.

The state of the reduction variable is checked when the variable is accessed. If reduction variable is used after a parallel construction leaving but before asynchronous reduction completion the error will be reported.

Note: Incorrect specification of a reduction function (for example, specifying MIN instead of MAX) is not detected by this method. Use the trace comparison method to detect such errors.

5.5Checking usage of remote access buffer

The remote data buffer is used for pre-loading of non-local elements required for the each processor. The same verifications are performed for a remote data buffer and for a distributed array. But there are little exclusions:

  • Verifying the data dependencies in a parallel construction takes into account that the remote data buffer is used instead of distributed array.

  • Verifying the array initialization is performed both for remote data buffer elements and elements of related distributed array. The initialization of remote data buffer is copying of distributed array elements to remote data buffer.

  • Only read operations are allowed for elements of the remote data buffer.

5.6Dynamic control of DVM directive implementation

Dynamic control subsystem includes the following components:

  • Table of variables – provides methods to accumulate the information about variables of various types and quick find this information by address.

  • Module of dynamic control – performs DVM directive checking. Functions of this module are called form some functions of Lib-DVM and for each variable or array accessing. The table of variable is used as auxiliary module, which accumulates and provides information about variables during dynamic control.

5.6.1Use the table of variables by dynamic control module

The dynamic control subsystem uses such concept as execution level.

The root level is a level of the initial sequential branch of the program . This level has zero number. When entering a parallel construction the number of current level is incremented by one unit. When leaving parallel construction the number of current level is decrement by on unit. Thus, the number of current level defines a depth of parallel constructions.

The number of the current level is important for work with variables, since the ideology of using variables depends on current level. This level is taken into account with registering a new variable in the dynamic control and is kept together with a basic information about a variable.

There are three variants when dynamic control finds a variable in table of variables:

  1. There is no variable information in the table. In this case a new record for the variable is created. The type of usage this variable is detected dependently on context of variable accessing. The current executed level is set as level for this variable. The formed record is returned as result of searching.

  2. There is variable information in the table but its level does not correspond to current. In this case also a new record will be created. The reference to a variable information on the previous level is stored in the formed record. The context of variable accessing and class of using of variable on previous level defines a new class of variable usage. The formed record is returned as result of searching. After removing variable information from the table the necessary information will be updated for a variable on the previous level.

  3. There is variable information in the table and its level corresponds to current. In this case the found record is returned as result of searching.

Also some functions of Lib-DVM create records in the table of variables. For example the definition of a distributed DVM array or including variable into reduction groups automatically creates a records in table of variables with respective class of usage.

After completion of each parallel structure, all record, which level is equal to level of completed structure, are removed from that table of variables. Thus the lifetime of executed parallel structure defines the lifetime of record in the table of variables.

5.6.2Base functions of dynamic control module

The following functions performs dynamic control:

void dyn_Init(void)

The function initializes all required structures and variables for dynamic control subsystem.

void dyn_Done(void)

The function un-initializes all dynamic control structures and prints all detected errors.

void dyn_LevelDone(void)

The function is called when a parallel structure is completed. It removes all registered variables for the current execution level.

void dyn_RemoveAll(void)

The function removes all data that is used by dynamic control module.

VarInfo* dyn_GetVarInfo( void* pAddr )

pAddr

variable address

The function finds variable information by its address. The function returns NULL if variable is not registered.

VarInfo *dyn_CheckVar( char *Operand, void *addr, SysHandle *Handle, byte isWrt )

Operand

variable name

addr

variable address

Handle

distributed array handle. It is equal to NULL for scalar variables

isWrt

variable accessing flag. It is equal to 0 if variable is accessed for reading and equal to 1 in the other case.

This is general function of dynamic control module. The function checks all variable accessing for read and write.

VarInfo *dyn_CheckValidVar( VarInfo *Current, void *addr, SysHandle *Handle, byte isWrt )

Current

pointer to variable information

addr

variable address

Handle

distributed array handle. It is equal to NULL for scalar variables

isWrt

variable accessing flag. It is equal to 0 if variable is accessed for reading and equal to 1 in the other case.

The function validates the variable information for current executed level. If the Current is not valid for current level then it creates a new variable information structure, which is returned as result of the function. Otherwise, the Current pointer is returned.

void dyn_CheckReadOnlyVar(char* szOperand, VarInfo *pVar, byte bIsWrt, long lLineIndex)

szOperand

variable name

pVar

pointer to variable information

bIsWrt

variable accessing flag. It is equal to 0 if variable is accessed for reading and equal to 1 in the other case.

lLineIndex

absolute index of array element. It is equal to -1 for scalar variables.

The function checks access to read-only variables.

void dyn_CheckPrivateVar(char* szOperand, VarInfo* pVar, byte bIsWrt, long lLineIndex)

szOperand

variable name

pVar

pointer to variable information

bIsWrt

variable accessing flag. It is equal to 0 if variable is accessed for reading and equal to 1 in the other case.

lLineIndex

absolute index of array element. It is equal to -1 for scalar variables.

The function checks access to private variables.

void dyn_CheckReductVar(char* szOperand, VarInfo *pVar, byte bIsWrt, long lLineIndex)

szOperand

variable name

pVar

pointer to variable information

bIsWrt

variable accessing flag. It is equal to 0 if variable is accessed for reading and equal to 1 in the other case.

lLineIndex

absolute index of array element. It is equal to -1 for scalar variables.

The function checks access to reduction variables.

void dyn_CheckDisArrayVar(char* szOperand, VarInfo *pVar, byte bIsWrt, long lLineIndex)

szOperand

variable name

pVar

pointer to variable information

bIsWrt

variable accessing flag. It is equal to 0 if variable is accessed for reading and equal to 1 in the other case.

lLineIndex

absolute index of array element. It is equal to -1 for scalar variables.

The function checks access to distributed DVM-arrays.

VarInfo *dyn_DefineVar( byte type, byte Stat, void *addr, SysHandle *Handle, void *Info, PFN_VARTABLE_ELEMDESTRUCTOR pfnDestructor)

type

type of the variable usage.

Stat

flag of static variable. It is equal to 1 for a static variable (not deleted when leaving a parallel construction ).

addr

variable address.

Handle

distributed array handle. It is equal to NULL for the scalar variable.

Info

pointer to an additional variable information

pfnDestructor

variable information destructor. It is called when variable information is deleted from a table of variables

This is general function of variable registration.

VarInfo *dyn_DefineReduct( byte Stat, void *addr )

Stat

flag of static variable. It is equal to 1 for a static variable (not deleted when leaving a parallel construction )

addr

variable address.

The function registers a reduction variable.

VarInfo *dyn_DefineDisArray( SysHandle *Handle, byte Stat, DISARR_INFO *Info )

Handle

distributed array handle.

Stat

flag of static variable. It is equal to 1 for a static variable (not deleted when a parallel construction has been done).

Info

additional distributed array information.

The function registers a distributed DVM array.

VarInfo *dyn_DefinePrivate( void *addr, byte Stat )

addr

variable address.

Stat

flag of static variable. It is equal to 1 for a static variable (not deleted when leaving a parallel construction ).

The function registers a variable with private type of access.

VarInfo *dyn_DefineReadOnly( void *addr, void *Info )

addr

variable address.

Info

additional variable information.

The function registers a variable with read-only type of access.

VarInfo *dyn_DefineRemoteBufferArray( SysHandle *SrcHandle, SysHandle *DstHandle, long *Index )

SrcHandle

the source distributed array.

DstHandle

created buffer of remote access.

Index

array of elements indexes for which the buffer is created.

The function registers the remote access buffer for several elements of the source distributed array. The remote access buffer is created as a distributed array.

VarInfo *dyn_DefineRemoteBufferScalar( SysHandle *SrcHandle, void *RmtBuff, long *Index )

SrcHandle

the source distributed array.

RmtBuff

variable address used as remote access buffer.

Index

array of elements indexes for which the buffer is created.

The function registers the remote access buffer for a single element of the source distributed array. The remote access buffer is created as a scalar variable.

void dyn_DestructReduct( VarInfo *Var )

Var

pointer to variable information structure.

Destructor of a reduction variable. The function of reduction variable registration assigns this destructor for variable information structure.

void dyn_DestructPrivate( VarInfo *Var )

Var

pointer to variable information structure.

Destructor of a private variable. The function of private variable registration assigns this destructor for variable information structure.

void dyn_DestructReadOnly( VarInfo *Var )

Var

pointer to variable information structure.

Destructor of a read-only variable. The function of read-only variable registration assigns this destructor for variable information structure.

void dyn_DestructDisArray( VarInfo *Var )

Var

pointer to variable information structure.

Destructor of a distributed DVM array. The function of distributed DVM array registration assigns this destructor for variable information structure.

void dyn_RemoveVar( void *addr )

addr

variable address.

The function removes variable information for the current execution level.

void dyn_InitializeSet( VarInfo *Var, size_t LI )

Var

pointer to variable information.

LI

absolute index of an array element. It is equal to -1 for scalar variables.

The function sets initialization flag for the variable or element of distributed array.

void dyn_InitializeClear( VarInfo *Var )

Var

pointer to variable information.

The function clears initialization flag for the variable or all elements of distributed array.

int dyn_InitializeCheck( VarInfo *Var, size_t LI )

Var

pointer to variable information.

LI

absolute index of an array element. It is equal to -1 for scalar variables.

The function checks initialization of variable or element of distributed array . It returns 1 if variable or element has been initialized.

void dyn_DisArrAcross(s_DISARRAY *Arr)

Arr

pointer to description of distributed DVM array

The function sets the flag of using the specified array in the parallel loop with ACROSS type of data dependency. The dynamic control will not check data dependency for this array within the limits of executed loop.

void dyn_DisArrCheckBounds( char *Operand, VarInfo *Var, size_t LI, byte isWrt, long Iter )

Operand

the variable name.

Var

pointer to a variable information structure.

LI

absolute index of an array element.

isWrt

it is equal to 1 if element is used for writing.

Iter

absolute index of the current parallel loop iteration.

The function calculates the current local part of the distributed array allocated on the current abstract machine and checks whether the element belongs to this local part or its edges or not. In addition, the correctness of edge usage is checked.

void dyn_DisArrCheckSequential(char* szOperand, VarInfo* pVar, byte bIsWrt, long lLineIndex)

szOperand

the variable name.

pVar

pointer to a variable information structure.

bIsWrt

it is equal to 1 if element is used for writing.

lLineIndex

absolute index of an array element.

The function validates the access to an element of distributed DVM array in the sequential part of a program.

void dyn_DisArrCheckDataDepends( char *Operand, VarInfo *Var, size_t LI, byte isWrt, long Iter )

Operand

the variable name.

Var

pointer to a variable information structure.

LI

absolute index of an array element.

isWrt

1 if element is used for writing.

Iter

absolute index of the current parallel loop iteration.

The function checks the undeclared loop data dependence when the specified distributed array element is used.

byte dyn_DisArrCheckLimits( char *Operand, long LI, DISARR_INFO *Info )

Operand

the variable name.

LI

absolute index of an array element.

Info

the additional distributed array information.

The function checks out-of-range access for the specified distributed array. It returns 1 if the element with the index LI belongs to the local array part.

byte dyn_GetLocalBlock(s_BLOCK *DABlock, s_DISARRAY *DA, s_PARLOOP *PL)

DABlock

pointer to a result block structure.

DA

pointer to the internal distributed array structure of the DVM system.

PL

pointer to the internal parallel loop structure of the DVM system.

The function calculates the block of a distributed array, elements of which can be accessed inside the current iteration of a parallel loop. It returns 0 in case of a successful evaluation of the block.

void dyn_DisArrDefineShadow(s_DISARRAY* pArr, s_BOUNDGROUP* pBndGroup, s_SHDWIDTH* pRtsShadow)

pArr

pointer to the internal distributed array structure of the DVM system.

pBndGroup

pointer to the internal bound exchange structure of the DVM system.

pRtsShadow

pointer to the description of edges of the distributed array.

The function registers the shadow definition of the distributed array in the dynamic control module and links they to the specified bound exchange structure.

void dyn_DisArrCompleteShadows(s_DISARRAY* pArr, s_BOUNDGROUP* pBndGroup)

pArr

pointer to the internal distributed array structure of the DVM system.

pBndGroup

pointer to the internal bound exchange structure of the DVM system.

The function sets the flag of completion of bound exchange for edges that are included into the specified bound group.

void dyn_DisArrClearShadows(DISARR_INFO* pInfo)

pInfo

the description of distributed array in dynamic control module.

The function removes all shadow definitions for the specified distributed array. It is called after modification of an exportable element of the array.

int dyn_FindShadowIndex(s_BLOCK* pBlock, long* sI, DISARR_INFO* pInfo)

pBlock

the description of local block of distributed array

sI

indexes of element in the distributed DVM array

pInfo

the description of distributed array in dynamic control module.

The function finds index of a shadow description that contains the specified array’s element.

5.6.3The parameters of dynamic control

There is the special set of parameters that manages the dynamic control module. By using these parameters user can turn on/off some validations, tune the effectiveness of algorithms, manage diagnostic output, and so on.

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

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

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