fdvmLDe (1158336), страница 11

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

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

Declaration in main program.

PROGRAM MAIN

CDVM$ DISTRIBUTE B (*,BLOCK)

COMMON /COM1/ X, Y(12), B(12,30)

Declaration in subroutine. The error is another number of components.

SUBROUTINE SUB1

CDVM$ DISTRIBUTE B1 (*,BLOCK)

COMMON /COM1/ X, Y(12), Z, B1(12,30)

Declaration in subroutine. The error is another distribution of the array.

SUBROUTINE SUB2

CDVM$ DISTRIBUTE B2 (BLOCK,BLOCK)

COMMON /COM1/ X, Y(12), B2(12,30)

Declaration in subroutine. The error is another configuration of the array.

SUBROUTINE SUB3

CDVM$ DISTRIBUTE B3 (*,BLOCK)

COMMON /COM1/ X, Y(12), B(30,12)

Declaration in subroutine. There is no error.

SUBROUTINE SUB4

CDVM$ DISTRIBUTE B4 (*,BLOCK)

COMMON /COM1/ X, Y(12), B(12,30)

9Procedures

  1. Procedure call inside parallel loop.

A procedure, called inside parallel loop, must not have side effects and contains processor exchanges (purest procedure). As a consequence, the purest procedure doesn't contain:

  • input/output statements;

  • FDVM directives;

  • assignment of values of COMMON block variables.

  1. Procedure call outside parallel loop.

If the actual argument is explicitly mapped array (distributed by DISTRIBUTE or ALIGN), it should be passed without shape changing. 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 explicit or inherited distribution.

Explicit distribution is described by DISTRIBUTE and ALIGN directives with the following restriction: a formal argument can be aligned only with other formal argument. The explicit distribution of formal argument means, that before the procedure call a user must provide actual argument distribution in exact correspondence with formal argument distribution.

Inherited distribution is described by the directive

inherit-directive

is INHERIT dummy-array-name-list

Inherited distribution means that formal argument inherits a distribution of actual argument for each procedure call. Inherited distribution doesn't require from a user to distribute actual argument in correspondence with the formal argument.

REDISTRIBUTE and REALIGN directives can be applied to formal arguments, if actual and formal arguments have DYNAMIC attribute.

  1. Local arrays.

In the procedure local arrays can be distributed by DISTRIBUTE and ALIGN directives. A local array can be aligned with formal argument. The DISTRIBUTE directive distributes the local array on the processor subsystem, on which the procedure was called (current subsystem). If a processor arrangement section is specified in DISTRIBUTE directive, then the number of the processors must be equal to the number of processors of the current subsystem. The number of current subsystem processors is defined by intrinsic function ACTIVE_NUM_PROCS( ).

The special case is distributed local array with SAVE attribute. The following conditions must be satisfied for the array:

  • DISTRIBUTE and ALIGN directives have the identical parameters in each procedure call.

  • The array cannot be used in REDISTRIBUTE and REALIGN directives.

Example 9.1. Distribution of the local arrays and formal arguments.

SUBROUTINE DIST( A, B, C, N )

CDVM$ PROCESSORS PA(ACTIVE_NUM_PROCS( ))

DIMENSION A(N,N), B(N,N), C(N,N), X(N,N), Y(N,N)

C explicit distribution of formal argument

CDVM$ DISTRIBUTE A (*,BLOCK)

C aligned formal argument

CDVM$ ALIGN B(I,J) WITH A(I,J)

C inherited distribution of the formal argument

CDVM$ INHERIT C

C aligning local array with formal argument

CDVM$ ALIGN X(I,J) WITH C(I,J)

C distribution of the local array

CDVM$ DISTRIBUTE Y (*,BLOCK) ONTO PA

. . .

END

10Input/Output

The statements of standard Fortran77 are used for data input/output in FDVM.

FDVM allows only restricted form of input/output statements for distributed arrays:

  • An input/output list may contain only one name of 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 replicated variable.

The statements of distributed array input/output cannot be used in parallel loop and in task region.

Input/output statements for replicated variables 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 replicated assumed-size array.

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

Usage of input/output statements in tasks. If each task (on-block) uses its own files, for input/output the restrictions above is in active. If several tasks use the same file additional differences from Fortran 77 standard occur. When dealing with sequential access file all tasks input data from the file beginning but output records from different tasks are placed to the file in arbitrary order.

Note that FDVM program performing unformatted I/O of distributed arrays is not compatible with serial Fortran 77 program in common case. Data written by one program may not be read by the other one because of difference in record length.

11Compatibility with HPF

FDVM data mapping directives are based on the following HPF2 directives: DISTRIBUTE, REDISTRIBUTE, ALIGN, REALIGN, PROCESSORS, TEMPLATE, DYNAMIC, SHADOW and INHERIT. The following restrictions exist for a syntax and semantics of the directives.

  • DISTRIBUTE and REDISTRIBUTE directives have the formats BLOCK, GEN_BLOCK and “*” only.

  • There is no aligning by triplet in ALIGN and REALIGN directives.

  • There are permitted only two forms of formal argument specification : explicit distribution and inherited distribution.

  • EQUIVALENCE statement can't be applied to distributed arrays.

The directives of computation distribution are semantically a subset of the corresponding HPF2 directives. In particular, the PARALLEL directive is a subset of INDEPENDENT directive in HPF2.

The directives of remote data specifications have no analogues in HPF2, as it is assumed, that HPF2 compiler defines access to remote data automatically.

Thus the set of FDVM directives can be transformed to the set of HPF2 directives automatically.

12The difference between FDVM1.0 and FDVM2.0 versions

The FDVM 1.0 version is a subset of the FDVM 2.0 version. The following new possibilities are provided:

  • A model of dynamic arrays. This model can be automatically transformed for execution in Fortran 77, FDVM and HPF2 languages (section 4.2).

  • Task parallelism (section 7).

  • GEN_BLOCK and WGT_BLOCK format for array distribution (section 4.1.2, 4.1.3).

  • Distribution of a loop with regular data dependence (section 6.2.4).

  • Extended REMOTE_ACCESS specification(section 6.3).

  • Overlapping computations and data exchange (section 6.2.5, 6.3.3, 6.4.2)

References

  1. Message-Passing Interface Forum, Document for a Standard Message-Passing Interface, 1993. Version 1.0.

  2. OpenMP Consortium: OpenMP Fortran Application Program Interface, Version 1.0, October 1997.

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

  4. High Performance Fortran Forum. High Performance Fortran Language Specification. Version 2.0, January 31, 1997.

  5. ANSI X3.9-1978 Programming Language Fotran. New York 1978.

Annex 1. Syntax rules

2.2. Syntax of FDVM directives

directive-line

is CDVM$ dvm-directive

or *DVM$ dvm-directive

dvm-directive

is specification-directive

or executable-directive

specification-directive

is processors-directive

or align-directive

or distribute-directive

or template-directive

or pointer-directive

or shadow-directive

or dynamic-directive

or inherit-directive

or remote-group-directive

or reduction-group-directive

or task-directive

or heap-directive

or asyncid-directive

executable-directive

is realign-directive

or redistribute-directive

or parallel-directive

or remote-access-directive

or shadow-group-directive

or shadow-start-directive

or shadow-wait-directive

or reduction-start-directive

or reduction-wait-directive

or new-value-directive

or prefetch-directive

or reset-directive

or parallel-task-loop-directive

or map-directive

or task-region-directive

or end-task-region-directive

or on-directive

or end-on-directive

or f90-directive

or asynchronous-directive

or end-asynchronous-directive

or asyncwait-directive

Constraints:

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

  • A specification-directive may appear only where a specification statement may appear.

  • An executable-directive may appear only where executable statement may appear.

  • Any expression, included in specification directive, must be the specification expression.

Definition. A specification expression is an expression where each primary is:

  1. A constant,

  2. A variable that is a dummy argument,

  3. A variable that is in a common block,

  4. An intrinsic function reference where each argument is a specification expression,

  5. A specification expression enclosed in parentheses.

3. Virtual processor arrangements. PROCESSORS directive

processors-directive

is PROCESSORS processors-decl-list

processors-decl

is processors-name ( explicit-shape-spec-list )

explicit-shape-spec

is [ lower-bound : ] upper-bound

lower-bound

is int-expr

upper-bound

is int-expr

4.1. DISTRIBUTE and REDISTRIBUTE directives

distribute-directive

is dist-action distributee dist-directive-stuff

or dist-action [ dist-directive-stuff ] :: distributee-list

dist-action

is DISTRIBUTE

or REDISTRIBUTE

dist-directive-stuff

is dist-format-list [ dist-onto-clause ]

distributee

is array-name

or pointer-name

or template-name

dist-format

is BLOCK

or GEN_BLOCK ( block-size-array )

or WGT_BLOCK ( block-weight-array , nblock )

or *

dist-onto-clause

is ONTO dist-target

dist-target

is processors-name [(processors-section-subscript-list )]

or task-name ( task-index )

processors-section-subscript

is [ subscript ] : [ subscript ]

subscript

is int-expr

nblock

is int-expr

block-size-array

is array-name

block-weight-array

is array-name

Constraints:

  • A length of dist-format-list must be equal to the rank of each distributee to which it applies. That is, distribution format must be specified for every array dimension.

  • The number of distributed dimensions of the array (format is not specified as *) has to be equal to the number of dimensions of dist-target.

  • The array mentioned as a block-array-name in GEN_BLOCK specification must be one-dimensional integer array, with size equal to the size of corresponding dimension of processor arrangement, and a sum of its element values is equal to the size of distributed dimension.

  • The array mentioned as a block-weight-array in WGT_BLOCK specification must be one-dimensional array of type DOUBLE PRECISION.

  • Either GEN_BLOCK format or WGT_BLOCK format may appear in dist-format-list but not both of them.

  • REDISTRIBUTE directive can be applied to arrays with DYNAMIC attribute only.

  • dist-directive-stuff can be omitted in DISTRIBUTE directive only. In that case distributed array can be used after REDISTRIBUTE directive execution only.

4.2.2. Dynamic arrays in FDVM model. POINTER directive

pointer-directive

is type , POINTER ( dimension-list ) :: pointer-name-list

dimension

is :

pointer-name

is scalar-int-variable-name

or int-array-name

heap-directive

is HEAP array-name-list

4.3.1. ALIGN and REALIGN directives

align-directive

is align-action alignee align-directive-stuff

or align-action [ align-directive-stuff ] :: alignee‑list

align-action

is ALIGN

or REALIGN

align-directive-stuff

is ( align-source-list ) align-with-clause

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

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

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