fdvmDDe (1158418), страница 6

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

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

}

DO label In+2 = 0, Nn+2-1

. . . n+2  k

DO label Ik = 0, Nk-1

}

DO label In+1 = 0, Nn+1-1, sn

if (In+1 .LE. Nn+1) then

m = sn n+1  k

else

m = Nn+1 - In+1

endif

input:

IF(tstio( ) .eq. 0 ) READ (...) (BUF(j), j = 1, N1 * ...*Nn * m)

n  1

copying-arrray-section (BUF(1 : N1 * ...*Nn* m),

n  1

A(1: N1,...,1:Nn , In+1 +1: In+1 +m , In+2 +1, ..., Ik +1) )

n  1

n+1  k

n+2  k

output:

copying-arrray-section (BUF(1 : N1 * ...*Nl* m),

n  1

A(1: N1,...,1:Nn , In+1 +1: In+1 +m , In+2 +1, ..., Ik +1) )

n  1

n+1  k

n+2  k

IF(tstio( ) .eq. 0 ) WRITE (...) (BUF(j), j = 1, N1 * ...*Nn * m)

n  1

label CONTINUE

(An operation of copying-arrray-section is implemented by Lib-DVM function arrcpy( ).)

5.3Restructuring parse tree (module stmt.cpp)

The functions for restucturing parse tree compose the module stmt.cpp.

void InsertNewStatementAfter(

SgStatement
SgStatement
SgStatement

*stat,
*current
*cp );

stat

- pointer to the inserted statement

current

- pointer to the statement after which stat is inserted

cp

- pointer to the control parent for stat

The statement stat is inserted in the parse tree (program) after statement current and its control parent is cp.

void InsertNewStatementBefore(

SgStatement
SgStatement

*stat,
*current );

stat

- pointer to the inserted statement

current

- pointer to the statement before which stat is inserted

The statement stat is inserted in the parse tree (program) before statement current.

void doAssignStmt ( SgExpression *re )

re

- pointer to the expression that is the right part of the assignment statement

Creates the assign statement with right part re :

dvm000(i) = re

and inserts it before the statement pointed by global variable where.

SgExpression *LeftPart_AssignStmt ( SgExpression *re )

re

- pointer to the expression that is the right part of the assignment statement

Creates the assign statement with right part re :

dvm000(i) = re

and inserts it before the statement where (global variable). The function returns left part of this statement.

void doAssignTo (

SgExpression
SgExpression

*le,
*re );

le

- pointer to the expression that is the left part of the assignment statement

re

- pointer to the expression that is the right part of the assignment statement

Creates the assign statement:

le = re

and inserts it before the statement where (global variable).

void doAssignTo_After (

SgExpression
SgExpression

*le,
*re );

le

- pointer to the expression that is the left part of the assignment statement

re

- pointer to the expression that is the right part of the assignment statement

Creates the assign statement:

le = re

and inserts it after current statement cur_st (global variable).

void doAssignStmtAfter(

SgExpression

*re );

re

- pointer to the expression that is the right part of the assignment statement

Creates the assign statement with right part re :

dvm000(i) = re

and inserts it after the current statement cur_st (global variable).

void doAssignStmtBefore(

SgExpression
SgStatement

*re,
*current );

re

- pointer to the expression that is the right part of the assignment statement

current

- pointer to the statement

Creates the assign statement with right part re :

dvm000(i) = re

and inserts it before the statement current.

void Extract_Stmt ( SgStatement *st )

st

- pointer to the statement

Removes the statement st from the parse tree.

void ReplaceByIfStmt ( SgStatement *st )

st

- pointer to the statement

Replaces the statement st by IF statement:

IF (tstio( ) .NE. 0) st

void ReplaceDoNestLabel(

SgStatement
SgLabel

*last_st,
*new_lab );

last_st

- pointer to the statement ending DO statement nest

new_lab

- pointer to the new label

Replaces the label of DO statement nest, which is ended with last_st, by new_lab and inserts CONTINUE statement.

DO 1 I1 = 1,N1 DO new_lab I1 = 1,N1

DO 1 I2 = 1,N2 DO new_lab I2 = 1,N2

. . .  . . .

DO 1 Ik = 1,Nk DO new_lab Ik = 1,Nk

. . . . . .

1 last-statement 1 last-statement

new_lab CONTINUE

void ReplaceDoNestLabel_Above (

SgStatement
SgStatement
SgLabel

*last_st,
*from_st,
*new_lab );

last_st

- pointer to the statement ending DO statement nest

from_st

- pointer to the statement

new_lab

- pointer to the new label

Replaces the label of DO statements, located above statement from_st and ended with statement last_st, by new_lab and inserts CONTINUE statement.

DO 1 I1 = 1,N1 DO new_lab I1 = 1,N1

. . . . . .

DO 1 Ik = 1,Nk DO new_lab Ik = 1,Nk

CDVM$ PARALLEL (J1,...,Jm) ON ...CDVM$ PARALLEL (J1,...,Jm) ON ...

DO 1 J1 = 1,N1 DO 1 J1 = 1,N1

. . . . . .

DO 1 Jm = 1,Nm DO 1 Jm = 1,Nm

. . . . . .

1 last_statement 1 last_statement

new_lab CONTINUE

void ReplaceDoLabel (

SgStatement
SgLabel

*last_st,
*new_lab );

last_st

- pointer to the last statement of DO construct

new_lab

- pointer to the new label

Replaces the label of DO statement by new_lab and inserts CONTINUE statement.

DO 1 I = 1,N DO new_lab I = 1,N

. . .  . . .

1 last-statement 1 last-statement

new_lab CONTINUE

void ReplaceContext ( SgStatement *stmt )

stmt

- pointer to the statement

If the statement stmt or logical IF statement including it is last statement of DO-loop body, the function replaces the label of DO statements nest and inserts CONTINUE statement (ReplaceDoNestLabel(stmt)). If the control parent of statement stmt is logical IF statement, this function replaces it with IF_THEN construct.

void LogIf_to_IfThen ( SgStatement *stmt )

stmt

- pointer to the statement

Replaces logical IF statement:

IF ( condition ) stmt

by construct:

IF ( condition ) THEN

stmt

ENDIF

SgStatement *doIfThenConstr ( SgSymbol *ar )

ar

- pointer to the symbol of array

Creates construct:

IF ( ar(1) .EQ. 0) THEN

ENDIF

and returns the pointer to IF statement.

int isDoEndStmt ( SgStatement *stmt )

stmt

- pointer to the statement

If the statement stmt is the last statement of DO loop body, the function returns 1 else it returns 0.

SgStatement *lastStmtOfDo ( SgStatement *stdo )

stdo

- pointer to the DO statement

Returns the pointer to the last statement of DO loop body.

int isParallelLoopEndStmt ( SgStatement *stmt )

stmt

- pointer to the statement

If the statement stmt is the last statement of parallel loop, the function returns 1 else it returns 0.

5.4Translating HPF-DVM constructs (module hpf.cpp)

The module hpf.cpp is intended for translating constructs of HPF-DVM language.

5.4.1Processing distributed array references in HPF-DVM

int SearchDistArrayRef (

SgExpression
SgStatement

*e,
*stmt );

e

- pointer to the expression

stmt

- pointer to the statement which contains the expression e

This function looks the expression e for distributed array references, adds the attribute REMOTE_VARIABLE to the reference, generates statements for loading the value of each distributed array element into buffer, and inserted them before statement stmt (calls BufferDistArrayRef( )).

If there are distributed array references in expression e,.it returns 1, else – 0.

The function is called from TransFunc( ) when an executable statement outside the range of INDEPENDENT loop is processing.

void BufferDistArrayRef (

SgExpression
SgStatement

*e,
*stmt );

e

- pointer to the distributed array element reference

stmt

- pointer to the statement which contains the expression e

Generates statements for loading the value of distributed array element to buffer and inserting them before statement stmt , adds the attribute REMOTE_VARIABLE to distributed array reference e.

SgExpression *IND_ModifiedDistArrayRef(

SgExpression
SgStatement

*e,
*st );

e

- pointer to the distributed array element reference

st

- pointer to the assignment statement which contains the expression e

The function analyzes the distributed array element reference in left part of assignment statement whether that may be used as target for mapping index space of INDEPENDENT loop nest. It returns the target or NULL.

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

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

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