Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
ИНСАЙД ИНФА MPI.pdf
Скачиваний:
15
Добавлен:
15.04.2015
Размер:
3.3 Mб
Скачать

Chapter 13

I/O

13.1 Introduction

POSIX provides a model of a widely portable le system, but the portability and optimization needed for parallel I/O cannot be achieved with the POSIX interface.

The signi cant optimizations required for e ciency (e.g., grouping [35], collective bu ering [6, 13, 36, 39, 46], and disk-directed I/O [31]) can only be implemented if the parallel I/O system provides a high-level interface supporting partitioning of le data among processes and a collective interface supporting complete transfers of global data structures between process memories and les. In addition, further e ciencies can be gained via support for asynchronous I/O, strided accesses, and control over physical le layout on storage devices (disks). The I/O environment described in this chapter provides these facilities.

Instead of de ning I/O access modes to express the common patterns for accessing a shared le (broadcast, reduction, scatter, gather), we chose another approach in which data partitioning is expressed using derived datatypes. Compared to a limited set of prede ned access patterns, this approach has the advantage of added exibility and expressiveness.

13.1.1 De nitions

le An MPI le is an ordered collection of typed data items. MPI supports random or sequential access to any integral set of these items. A le is opened collectively by a group of processes. All collective I/O calls on a le are collective over this group.

displacement A le displacement is an absolute byte position relative to the beginning of a le. The displacement de nes the location where a view begins. Note that a \ le displacement" is distinct from a \typemap displacement."

etype An etype (elementary datatype) is the unit of data access and positioning. It can be any MPI prede ned or derived datatype. Derived etypes can be constructed using any of the MPI datatype constructor routines, provided all resulting typemap displacements are non-negative and monotonically nondecreasing. Data access is performed in etype units, reading or writing whole data items of type etype. O sets are expressed as a count of etypes; le pointers point to the beginning of etypes. Depending on context, the term \etype" is used to describe one of three aspects of an elementary datatype: a particular MPI type, a data item of that type, or the extent of that type.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

389

390

CHAPTER 13. I/O

1letype A letype is the basis for partitioning a le among processes and de nes a template

2for accessing the le. A letype is either a single etype or a derived MPI datatype

3constructed from multiple instances of the same etype. In addition, the extent of any

4hole in the letype must be a multiple of the etype's extent. The displacements in the

5typemap of the letype are not required to be distinct, but they must be non-negative

6

7

and monotonically nondecreasing.

8view A view de nes the current set of data visible and accessible from an open le as an

9ordered set of etypes. Each process has its own view of the le, de ned by three

10quantities: a displacement, an etype, and a letype. The pattern described by a

11letype is repeated, beginning at the displacement, to de ne the view. The pattern

12of repetition is de ned to be the same pattern that MPI_TYPE_CONTIGUOUS would

13produce if it were passed the letype and an arbitrarily large count. Figure 13.1 shows

14how the tiling works; note that the letype in this example must have explicit lower

15and upper bounds set in order for the initial and nal holes to be repeated in the

16view. Views can be changed by the user during program execution. The default view

17is a linear byte stream (displacement is zero, etype and letype equal to MPI_BYTE).

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

etype filetype

holes

tiling a file with the filetype:

...

displacement

accessible data

Figure 13.1: Etypes and letypes

A group of processes can use complementary views to achieve a global data distribution such as a scatter/gather pattern (see Figure 13.2).

etype

process 0 filetype 000111 process 1 filetype process 2 filetype

tiling a file with the filetypes:

111000000111111000111000111000 ...

displacement

Figure 13.2: Partitioning a le among parallel processes

43o set An o set is a position in the le relative to the current view, expressed as a count of

44etypes. Holes in the view's letype are skipped when calculating this position. O set 0

45is the location of the rst etype visible in the view (after skipping the displacement and

46any initial holes in the view). For example, an o set of 2 for process 1 in Figure 13.2

47is the position of the 8th etype in the le after the displacement. An \explicit o set"

48is an o set that is used as a formal parameter in explicit data access routines.