FDVM2 (1158347)
Текст из файла
56
Fortran-DVM
Language description
March 25, 1999
Version 2.0
Keldysh Institute of Applied Mathematics
Russia Academy of Sciences
Contents
1. Introduction 4
2. Language Overview 5
2.1. Programming Model and Model of Parallelism 5
2.2. Compatibility with HPF2 5
2.3. The Difference between FDVM1.0 and FDVM2.0 Versions 6
2.4. Syntax of FDVM Directives 6
3. Virtual Processor Arrangements. PROCESSORS Directive 7
4. Data Mapping 8
4.1. DISTRIBUTE and REDISTRIBUTE Directives 8
4.1.1. BLOCK Format 9
4.1.2. GEN_BLOCK Format 10
4.1.3. Format of * 10
4.1.4. Multidimensional Distributions 10
4.2. Distribution of Dynamic Arrays 11
4.2.1. Dynamic Arrays in Fortran 77 Program 11
4.2.2. Dynamic Arrays in FDVM Model. POINTER Directive 11
4.2.3. DISTRIBUTE and REDISTRIBUTE Directives for Dynamic Arrays 12
4.3. Distributing by Aligning 14
4.3.1. ALIGN and REALIGN Directives 14
4.3.2. TEMPLATE Directive 16
4.3.3. Aligning Dynamic Arrays 16
4.4. Distribution by Default 17
5. Distribution of Computations 17
5.1. Model of Computation Distribution 17
5.2. Distribution of Loop Iterations with Regular Computations 18
5.2.1. Definition of Distributed Loop with Regular Computations 18
5.2.2. Distribution of Loop Iterations. PARALLEL Directive 18
5.2.3. Private Variables. NEW Clause 19
5.2.4. Reduction Operations and Variables. REDUCTION Clause 19
5.2.5 Distribution of the Loop with Regular Data Dependence. ACROSS Clause 21
5.3. Distribution of Loop Iterations with Irregular Computations 22
5.3.1. Model of Irregular Computations 22
5.3.2. Distributed Loop with Irregular Computations 23
5.4. Non-Distributed (Replicated) Computations 23
6. Access to Remote Data 25
6.1. Regular Remote References 25
6.1.1. Shadow Edges Group. SHADOW_RENEW Clause 25
6.1.2. Group of Regular Remote References. REMOTE_ACCESS Directive 27
6.2. Group of Irregular Remote References. INDIRECT_ACCESS Directive 30
6.3. Overlapping Computations with Data Exchange between Processors 31
6.3.1. Asynchronous Updating of Shadow Edges 31
6.3.2. Asynchronous Group Reduction 33
7. Task Parallelism 34
7.1. Declaration of Task Array 34
7.2. Mapping Tasks on Processors. MAP Directive 35
7.3. Array Distribution on Tasks 35
7.4. Distribution of Computations. TASK_REGION Directive 35
7.5. Data Localization in Tasks 36
7.6. Fragment of Static Multiblock Problem 36
7.7. Fragment of Dynamic Multiblock Problem 37
8. COMMON and EQUIVALENCE 38
9. Procedures 39
10. Input/Output 40
References 41
Annex 1. Syntax 42
Annex2. Code Examples 51
1.Introduction
The Fortran-DVM language (FDVM) was developed via enhancing the Fortran 77 language in correspondence with a new model of parallel program execution (DVM-model) proposed in 1994 [1].
The DVM name originates from two main notions - Distributed Virtual Memory and Distributed Virtual Machine. The former reflects the global address space, and the latter reflects the use of an intermediate abstract machine for the two-step mapping of the parallel program onto a real parallel computer. This distributed virtual machine consists of one or several multidimensional arrays of virtual processors, and defines the parallelism of the program. The programmer creates a suitable virtual machine for his program, then specifies the mapping of the program and data onto his virtual machine and describes the rules of mapping this virtual machine onto the real parallel computer. This mapping is performed during run-time and does not require recompilation of the source code.
The main principle of language development is: the programmer must have a possibility of specifying parallel execution of his program, but the intelligent compiler does not require that user should do it. In fact, this principle determines directions of the language progress: from complicated languages to simpler ones, from simple compilers to more complex ones. The direction of HPF development is different: from automatic parallelization to HPF1, then - to HPF2. The main effect of the difference in approaches is that at the cost of certain additional efforts the user of FDVM is always able to make his program as efficient as it could be when conventional means for parallelization and message passing were used. Yet this does not decrease a portability.
The parallel program is a code in the standard Fortran 77 language, in which DVM directives (annotations) specifying parallel execution of the program are inserted. The directives are transparent for standard Fortran 77 compilers, therefore DVM programs can be executed on workstations as usual sequential programs.
The FDVM compiler translates the parallel FDVM code into a sequential Fortran 77 code including Lib-DVM library calls. The run-time system Lib-DVM is written in the C language and use the features of MPI for providing inter-processor communications.
A choice of language Fortran 77 as base language (instead of language Fortran 90, HPF is based on) is caused by the following reasons:
-
The Fortran 90 language is not used by many applied programmers. If we chose it as a base language, we would have serious difficulties in introduction of FDVM language
-
Lack of Fortran 90 compilers on some parallel computers does not allow to use the natural scheme of compilation (Fortran DVM = > Fortran 90 + Lib-DVM calls)
-
The development of the FDVM compiler becomes simpler
The FDVM language developers aim to simplify transformation of the FDVM program to a program in HPF1 or HPF2 language as much as possible. For example, FDVM includes DVM-HPF-directives (directives of HPF1 and HPF2) and additional DVM-directives, used to improve program performance.
2.Language Overview
2.1. Programming Model and Model of Parallelism
Fortran-DVM language is the extension of Fortran 77 language [2]. The extension is implemented via special comments, named directives. FDVM directives may be conditionally divided on three subsets:
-
Data distribution (sections 2, 3, 4, 8, 9)
-
Computation distribution (sections 5, 7)
-
Remote data specification (section 6)
FDVM model of parallelism is based on specific form of data parallelism called SPMD (Single Program, Multiple Data). In this model the same program is executed by all the processors concerned, but each processor performs its own subset of statements in accordance with the data distribution.
First, in FDVM model a user defines multidimensional arrangement of virtual processors, which sections data and computations will be mapped on. The section can be varied from the whole processor arrangement up to a single processor.
Then the arrays to be distributed over processors (distributed data) are determined. These arrays are specified by data mapping directives (section 4). The other variables (distributed by defaults) are mapped by one copy per each processor (replicated data). A value of replicated variable must be the same value on all the processors concerned. Single exception is the variables in a distributed loop (section 5.2.3 and 5.2.4).
Data mapping defines a set of own variables for each processor. A set of own variables determines the rule of own computations: the processor performs only those assignment statements that calculate values of its own variables.
FDVM model defines two parallelism levels:
-
data parallelism on processor arrangement section;
-
task parallelism: independent computations on disjoined sections of processor arrangement
Data parallelism is implemented by distribution of tightly enclosed loops over the processors (distributed computations) (section 5). The loop iteration is executed on one processor entirely. Therefore the rule of own computations must be carried out for all the statements of single iteration. The statements located outside of the distributed loop are implemented by the identical computations on all the processors of the section (replicated distributions). The exception is own computation statements (section 5.4).
Task parallelism is implemented by distribution of data and independent computations over disjoined sections of processor arrangement (section 7).
When calculating the value of own variable, the processor may need in values of as own as other (remote) variables. All remote variables must be specified in remote data access directives (section 6).
2.2. Compatibility with HPF2
FDVM data mapping directives are based on the following HPF2 [3] 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.
2.3. The 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).
-
Format GEN_BLOCK for array distribution (section 4.1.2).
-
Distribution of a loop with regular dependence on data (section 5.2).
-
Distribution of a loop with irregular computations (section 5.3).
-
Remote data specification without data replication (section 6.1.2, 6.2).
-
Overlapping computations and data exchange (section 6.3)
2.4. Syntax of FDVM Directives
The syntax of FDVM directives is described using a Backus-Naur form and the following notations:
is is by definition
or an alternative construct
[ ] encloses optional construct
[ ]… encloses an optionally repeated construct which may occur zero or more times
x-list x [ , x ]…
Syntax of the directive.
| directive-line | is CHPF$ hpf-directive |
| or *HPF$ hpf-directive | |
| or 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 indirect-group-directive | |
| or task-directive |
| executable-directive | is realign-directive |
| or redistribute-directive | |
| or parallel-directive | |
| or remote-access-directive | |
| or indirect-access-directive | |
| or shadow-group-directive | |
| or shadow-start-directive | |
| or shadow-wait-directive | |
| or reduction-group-directive | |
| or reduction-start-directive | |
| or reduction-wait-directive | |
| or own-directive | |
| or prefetch-directive | |
| or reset-directive | |
| or map-directive | |
| or task-region-directive | |
| or end-task-region-directive | |
| or on-directive | |
| or end-on-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.
No statements may be interspersed within a continued directive. A directive line must not appear within a continued statement. An example of a directive continuation follows. Note that column 6 must be blank, except when signifying continuation.
CHPF$ ALIGN SPACE1( I, J, K )
CHPF$* WITH SPACE(J , K, I )
3.Virtual Processor Arrangements. PROCESSORS Directive
The PROCESSORS directive declares one or more rectangular virtual processor arrangements.
Характеристики
Тип файла документ
Документы такого типа открываются такими программами, как Microsoft Office Word на компьютерах Windows, Apple Pages на компьютерах Mac, Open Office - бесплатная альтернатива на различных платформах, в том числе Linux. Наиболее простым и современным решением будут Google документы, так как открываются онлайн без скачивания прямо в браузере на любой платформе. Существуют российские качественные аналоги, например от Яндекса.
Будьте внимательны на мобильных устройствах, так как там используются упрощённый функционал даже в официальном приложении от Microsoft, поэтому для просмотра скачивайте PDF-версию. А если нужно редактировать файл, то используйте оригинальный файл.
Файлы такого типа обычно разбиты на страницы, а текст может быть форматированным (жирный, курсив, выбор шрифта, таблицы и т.п.), а также в него можно добавлять изображения. Формат идеально подходит для рефератов, докладов и РПЗ курсовых проектов, которые необходимо распечатать. Кстати перед печатью также сохраняйте файл в PDF, так как принтер может начудить со шрифтами.















