hpfLDe (Раздаточные материалы)

2019-09-18СтудИзба

Описание файла

Файл "hpfLDe" внутри архива находится в следующих папках: Раздаточные материалы, stage-fin. Документ из архива "Раздаточные материалы", который расположен в категории "". Всё это находится в предмете "модели параллельных вычислений и dvm технология разработки параллельных программ" из 7 семестр, которые можно найти в файловом архиве МГУ им. Ломоносова. Не смотря на прямую связь этого архива с МГУ им. Ломоносова, его также можно найти и в других разделах. .

Онлайн просмотр документа "hpfLDe"

Текст из документа "hpfLDe"

10


Keldysh Institute of Applied Mathematics

Russian Academy of Sciences

Enhanced Subset of High Performance Fortran

(HPF-DVM)

Language specification

April, 2001

Contents

1 Introduction 3

2 HPF features in subset HPF-DVM 3

3 Syntax of directives 3

4 DISTRIBUTE and REDISTRIBUTE directives 3

5 ALIGN and REALIGN directives 4

6 PROCESSORS directive 4

7 INDEPENDENT directive 4

8 Procedures 5

9 COMMON and EQUIVALENCE statements 5

10 Input/Output statements 5

References 6

Annex. Code examples 7

Example 1. Gauss elimination algorithm 7

Example 2. Jacobi algorithm 8

Example 3. Red-black successive over-relaxation 9

1Introduction

This document specifies the enhanced subset of High Performance Fortran [1] (HPF‑DVM).

Subset HPF-DVM inludes:

  • All Fortran 77 standard [2] conforming features except for storage and sequence association (see sections 8,9).

  • Subset of HPF directives (see section 2).

The HPF features included in HPF-DVM are a subset of the full HPF language chosen for their performance and their broad portability and ease of use.

Fortran 77 was selected as a base language to provide multi-machine portability, since Fortran 90 compilers are not available on all platforms.

HPF-DVM implementation is made using DVM model.

2HPF features in subset HPF-DVM

Subset HPF-DVM is based on Fortran 77 standard and includes the following HPF1 directives.

Directives

Constraints

PROCESSORS

section 6

DISTRIBUTE

section 4

REDISTRIBUTE

section 4

ALIGN

section 5

REALIGN

section 5

INHERIT

no

DYNAMIC

no

TEMPLATE

no

INDEPENDENT

section 7

Other HPF1 directives and language extensions are not included in the subset HPF‑DVM.

3Syntax of directives

A hpf-directive-line follows the rules of fixed form comment lines only.

4DISTRIBUTE and REDISTRIBUTE directives

The following restrictions are imposed on DISTRIBUTE and REDISTRIBUTE directives:

  • An dist-format is BLOCK or *.

  • An dist-target may not be * processors-name or * (see section 8).

5ALIGN and REALIGN directives

The following restrictions are imposed on ALIGN and REALIGN directives:

  • Reversing axes, as

CHPF$ ALIGN A(I) WITH B(100–I)

is not permitted.

  • An align-spec may not be * align-target (see section 8).

  • An align-subscript-use expression must follow the syntax rules:

align-subscript-use

is [ primary-expr * ] align‑dummy
[ add-op primary-expr ]

primary-expr

is int-constant

or int-variable

or ( int-expr )

6PROCESSORS directive

An explicit-shape-spec-list must be always specified in PROCESSORS directive.

Only the intrinsic function NUMBER_OF_PROCESSORS() may be used to inquire about the total number of physical processors.

7INDEPENDENT directive

The INDEPENDENT directives may be applied only to tightly nested loops.

The iteration space of INDEPENDENT loop nest must be rectangular. That is, the lower loop bound, the upper loop bound, and the step expression for each INDEPENDENT loop must be invariant with regard to INDEPENDENT nest.

Left side of each assignment statement in INDEPENDENT nest may be only a variable with DISTRIBUTE, ALIGN, INHERIT, NEW or REDUCTION attribute.

Left sides of assignment statements of one loop iteration must be allocated at the same processor and, therefore, the loop iteration is executed on the processor entirely.

A DO-variable of INDEPENDENT loop may index distributed dimension of array only by expression of the form

a * DO-variable ± b

The integer values a and b must be invariant with regard to the INDEPENDENT loop nest.

Private (not INDEPENDENT) loops may occur inside or outside of the INDEPENDENT loop nest. A DO-variable of inside loop may index only local dimension of an array.

Syntax and semantics of REDUCTION specification correspond to HPF2 [3].

8Procedures

  1. Procedure call inside the INDEPENDENT loop.

A procedure, called inside INDEPENDENT loop, must be free of side-effects and must not cause communication (pure procedure).

  1. Procedure call outside INDEPENDENT loop.

If the actual argument is explicitly mapped array (distributed by DISTRIBUTE or ALIGN directive), it should be passed without reshaping. It means, that actual argument is the reference to the array beginning, and configurations of actual and corresponding formal arguments are the same.

  1. Formal arguments.

If the actual argument is a distributed array, then corresponding formal argument must have inherited distribution.

9COMMON and EQUIVALENCE statements

The arrays, distributed by default, can be used in COMMON blocks and EQUIVALENCE statements without restrictions.

The arrays, distributed by DISTRIBUTE or ALIGN directive, can't be used in EQUIVALENCE statements. Moreover, these arrays can't be associated with other data objects. Explicitly distributed arrays can be the components of COMMON block under the following conditions:

  • COMMON block must be described in main program unit.

  • Every occurrence of the COMMON block must have the same number of components and each corresponding component must have a storage sequences of the same size;

  • If explicitly mapped array is the component of the COMMON block, then the array declarations in different program units must specify the same data type and shape. The DISRIBUTE and ALIGN directives, applied to the array, must have the identical parameters.

10Input/Output statements

HPF-DVM allows only restricted form of input/output statements for distributed arrays:

  • An input/output list may contain only one name of explicitly distributed array and may not contain other input/output items.

  • Only «*» format specifier may be used in formatted I/O statement.

  • A control information list may not contain ERR, END and IOSTAT specifiers.

  • Any variable specified in a control information list must be variable distributed by default.

The statements of distributed array input/output cannot be used in INDEPENDENT loop.

Input/output statements for variables distributed by default have the following restrictions:

  • A control information list may not contain ERR and END specifiers.

  • Only the following simplified form of the implicit loop is allowed

(A(i1,i2,...,I), I = n1,n2)

when inputting assumed-size array distributed by default.

Input statement, INQUIRE statement, and any other input/output statement with parameter IOSTAT may not be used in an INDEPENDENT loop.

References

  1. High Performance Fortran Forum. High Performance Fortran Language Specification. Version 1.0

  2. ANSI X3.9-1978 Programming Language Fortran. New York 1978.

  3. High Performance Fortran Forum. High Performance Fortran Language Specification. Version 2.0.

  1. Annex. Code examples

Three small scientific programs are presented to illustrate HPF-DVM language features. They are intended for solving a system of linear equations:

A x = b

where: A - matrix of coefficients,

b - vector of free members,

x - vector of unknowns.

The following basic methods are used for solving this system.

Direct methods. The well-known Gaussian Elimination method is the most commonly used algorithm of this class. The main idea of this algorithm is to reduce the matrix A to upper triangular form and then to use backward substitution to diagonalize the matrix.

Explicit iteration methods. Jacobi Relaxation is the most known algorithm of this class. The algorithm perform the following computation iteratively

xi,jnew = (xi-1,jold + xi,j-1old + xi+1,jold + xi,j+1old ) / 4

Implicit iteration methods. Successive Over Relaxation (SOR) refers to this class. The algorithm performs the following calculation iteratively

xi,jnew = ( w / 4 ) * (xi-1,jnew + xi,j-1new + xi+1,jold + xi,j+1old ) + (1-w) * xi,jold

By using «red-black» coloring of variables each step of SOR consists of two half Jacobi steps. One processes «red»variables and the other processes «black» variables. The half Jacobi step calculations are data-independent.

Example 1. Gauss elimination algorithm

PROGRAM GAUSS

C Solving linear equation system Ax = b

PARAMETER ( N = 100 )

REAL A( N, N+1 ), X( N )

C A : Coefficient matrix with dimension (N,N+1)

C Right hand side vector of linear equations is stored

C in last (N+1)-th column of matrix A

C X : Vector of unknowns

C N : Number of linear equations

*HPF$ DISTRIBUTE A (BLOCK,*)

*HPF$ ALIGN X(I) WITH A(I,N+1)

C Initialization

*HPF$ INDEPENDENT

DO 100 I = 1, N

DO 100 J = 1, N+1

IF (( I .EQ. J ) THEN

A(I,J) = 2.0

ELSE

IF ( J .EQ. N+1) THEN

A(I,J) = 0.0

ENDIF

ENDIF

100 CONTINUE

C

C Elimination

C

DO 1 I = 1, N

*HPF$ INDEPENDENT

DO 5 J = I+1, N

DO 5 K = I+1, N+1

A(J,K) = A(J,K) - A(J,I) * A(I,K) / A(I,I)

5 CONTINUE

1 CONTINUE

C First calculate X(N)

X(N) = A(N,N+1) / A(N,N)

C

C Solve X(N-1), X(N-2), ...,X(1) by backward substitution

C

DO 6 J = N-1, 1, -1

*HPF$ INDEPENDENT

DO 7 I = 1, J

A(I,N+1) = A(I,N+1) - A(I,J+1) * X(J+1)

7 CONTINUE

X(J) = A(J,N+1) / A(J,J)

6 CONTINUE

PRINT *, X

END

Example 2. Jacobi algorithm

PROGRAM JACOBI

PARAMETER (K=8, ITMAX=20)

REAL A(K,K), B(K,K)

*HPF$ DISTRIBUTE A (BLOCK, BLOCK)

*HPF$ ALIGN B(I,J) WITH A(I,J)

C arrays A and B with block distribution

PRINT *, '******** TEST_JACOBI_HPF ********'

C nest of two independent loops, iteration (i,j) will be executed

C on processor, which is owner of element A(i,j)

*HPF$ INDEPENDENT

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