CDVM2 (1158340)

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

Текст из файла

49


C-DVM

Language description

March 25, 1999

Version 2.0

Keldysh Institute of Applied Mathematics

Russian Academy of Sciences

Contents

1. Introduction 4

2. Language overview 5

2.1. Programming model and model of parallelism 5

2.3. The difference between CDVM versions 1.0 and 2.0 5

2.4. Syntax of DVM-directives 6

3. Virtual processor arrangements. PROCESSORS directive 7

4. Data Mapping 7

4.1. DISTRIBUTE and REDISTRIBUTE directives 7

4.1.1. Format BLOCK 8

4.1.2. Format GEN_BLOCK 9

4.1.3. Format [] 10

4.1.4. Multidimensional distributions. 10

4.2. Multidimensional dynamic arrays 11

4.2.1. Dynamic arrays in C program 11

4.2.2. Using C-style multidimensional arrays. 11

4.2.3. Simulation of multidimensional arrays via one-dimensional ones. 12

4.3. Distributing by aligning 12

4.3.1. ALIGN and REALIGN directives 13

4.3.2. TEMPLATE and CREATE_TEMPLATE directives 14

4.4. Non-distributed data 15

5. Distribution of Computations 16

5.1. Model of computation distribution 16

5.2. Distribution of loop iterations with regular computations 16

5.2.1. Definition of distributed loop with regular computations 16

5.2.2. Distribution of loop iterations. PARALLEL directive 16

5.2.3. Private variables. 17

5.2.4. Reduction operations and variables. REDUCTION specification 18

5.2.5 Distribution of the loop with regular data dependence. ACROSS specification 18

5.3. Distribution of the loop iterations with irregular computations. 19

5.3.1. Model of irregular computations 19

5.3.2. Distributed loop with irregular computations 20

5.4. Non-distributed (replicated) computations 21

6. Access to remote data 22

6.1. Regular remote references 22

6.1.1. Shadow edges group. SHADOW_RENEW specification. 22

6.1.2. Group of regular remote references. REMOTE_ACCESS directive 24

6.2. Group of irregular remote references. INDIRECT_ACCESS directive 27

6.3. Overlapping computations with data exchange between processors. 28

6.3.1. Asynchronous updating of shadow edges 28

6.3.2. Asynchronous group reduction 30

7. Task parallelism 31

7.1. Description of task group 31

7.2. Mapping tasks on processors. MAP directive 32

7.3. Array distribution on tasks 32

7.4. Distribution of computations. TASK_REGION directive. 32

7.5. Data localization in tasks 33

7.6. Fragment of static multi-block problem 33

7.7. Fragment of dynamic multi-block problem 34

8. Procedures 35

9. Input/output 36

References 36

Appendix 1. Examples of C-DVM programs. 36

Example 1. The Gauss elimination algorithm. 37

Example 2. Jacobi Algorithm 38

Example 3. Jacobi Algorithm (asynchronous version) 39

Example 4. Irregular Calculations Based on Jacobi Algorithm 41

Example 5. Red-Black Successive Over-Relaxation 43

Example 6. Multigrid method program. 44

Example 7. Task Parallelism for Multiblock Code 46

Appendix 2. Syntax summary 48

  1. Introduction

C-DVM language was designed to support the development of portable and efficient parallel computational applications. The language is an extension of C language according to DVM (Distributed Virtual Machine, Distributed Virtual Memory) model developed in Keldysh Institute of Applied Mathematics [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.

Traditionally applications for serial computers were created using Fortran and C languages. At present such applications are created for multiprocessor computers with distributed memory and networks using as a rule Fortran 77 and C extended by message transfer libraries (PVM, MPI). Development of such parallel applications requires from a programmer far more efforts than development of sequential ones, as the programmer has to distribute data and computations between different processors and also provide interaction of processors via message passing. The parallel application is a system of interacting programs, each program running at its own processor. The programs running at different processors may be either quite different, or may differ a little, or may be the same program whose behavior depends on the processor number. However, even in the last case the programmer is forced to develop and maintain two versions of the program - the sequential and parallel ones.

Using C-DVM language the programmer deals with the only version of the program both for sequential and parallel execution. Besides algorithm description by means of usual C features the program contains rules for parallel execution of the algorithm. These rules are syntactically organized in such a manner that they are transparent for standard C compilers at serial computers. Therefore it is possible to execute and to debug the C-DVM program at workstations as a usual sequential one.

Thus the C-DVM language is a standard C language extended by features to describe the rules of parallel execution of programs (DVM-directives).

The C-DVM language provides the following main features of parallel program execution specification:

distribution of array elements over the processors;

distribution of loop iterations over the processors;

organization of efficient access to remote data (the data located at other processors);

organization of efficient execution of reduction operations, that is global operation on data located at different processors (such as summing values of distributed array elements, or finding maximal and minimal values of them).

2. Language overview

2.1. Programming model and model of parallelism

C-DVM language is an extension of ANSI-C language with annotations named DVM-directives. The directives are implemented as parameters of a macro DVM(<directive>) which in sequential program is expanded to empty string. DVM-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)

DVM model of parallelism is based on specific form of data parallelism called SPMD (Single Program, Multiple Data). In this model all the processors concerned execute the same program, but each processor performs its own subset of statements in accordance with the data distribution.

First, in DVM model a user defines multidimensional arrangement of virtual processors, on which sections data and computations will be mapped. 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 are mapped by one copy per each processor (replicated data). A value of replicated variable must be the same on all processors concerned. (For two exceptions of this rule see section 5.2.3 and 5.2.4).

Data mapping defines a set of local or 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.

DVM model defines two levels of parallelism:

  • data parallelism on a 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) (see 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 both own and other ("remote") variables. All remote variables must be specified in remote data access directives (section 6).

2.3. The difference between CDVM versions 1.0 and 2.0

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

  • Explicit definition of processor arrangements (section 3).

  • 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).

2.4. Syntax of DVM-directives

The syntax of DVM-directives is described using a Backus-Nour grammar and the following notations:

::= is by definition,

| an alternative construct,

[ ] optional construct

[ ]… repetition of the construct from 0 to several times,

x-string x [ x ]…

x-list x [ ; x ]

Syntax of the directive.

directive

::= DVM ( DVM-directive )

DVM-directive

::= specification-directive

| executable-directive

specification-directive

::= processors-directive

| align-directive

| distribute-directive

| template-directive

| shadow-directive

| inherit-directive

| shadow-group-directive

| reduction-group-directive

| remote-group-directive

| indirect-group-directive

| task-directive

executable-directive

::= realign-directive

| redistribute-directive

| create-template-directive

| parallel-directive

| remote-access-directive

| indirect-access-directive

| create-shadow-group-directive

| shadow-start-directive

| shadow-wait-directive

| create-reduction-group-directive

| reduction-start-directive

| reduction-wait-directive

| own-directive

| prefetch-directive

| reset-directive

| map-directive

| task-region-directive

| on-directive

Constraints:

  • Specification-directives must be followed by C declaration (of data arrays or DVM-objects).

  • Executable-directives must be followed by C operator (or semicolon).

3. Virtual processor arrangements. PROCESSORS directive

The PROCESSORS directive declares one or more rectangular virtual processor arrangements.

Syntax.

processors-directive

::= PROCESSORS

Function NUMBER_OF_PROCESSORS () can be used to determine a number of real processors, provided to a program.

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

Тип файла документ

Документы такого типа открываются такими программами, как Microsoft Office Word на компьютерах Windows, Apple Pages на компьютерах Mac, Open Office - бесплатная альтернатива на различных платформах, в том числе Linux. Наиболее простым и современным решением будут Google документы, так как открываются онлайн без скачивания прямо в браузере на любой платформе. Существуют российские качественные аналоги, например от Яндекса.

Будьте внимательны на мобильных устройствах, так как там используются упрощённый функционал даже в официальном приложении от Microsoft, поэтому для просмотра скачивайте PDF-версию. А если нужно редактировать файл, то используйте оригинальный файл.

Файлы такого типа обычно разбиты на страницы, а текст может быть форматированным (жирный, курсив, выбор шрифта, таблицы и т.п.), а также в него можно добавлять изображения. Формат идеально подходит для рефератов, докладов и РПЗ курсовых проектов, которые необходимо распечатать. Кстати перед печатью также сохраняйте файл в PDF, так как принтер может начудить со шрифтами.

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

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