Docsity

Parallel IO using MPI IO-Message Passing Interface Library-Lecture Slides, Slides of Microprocessor and Interfacing

Partial preview of the text

Download Parallel IO using MPI IO-Message Passing Interface Library-Lecture Slides and more Slides Microprocessor and Interfacing in PDF only on Docsity!

Dr. Hanif Durad

Lecture Outline

IntroMPI.ppt

Common Ways of Doing I/O inParallel Programs

Sequential I/O:

All processes send data to rank 0, and 0 writes it tothe file

Dr. Hanif Durad

mpi-io_2.ppt

Example using C (2/2)

if (myrank != 0)

MPI_Send(buf, BUFSIZE, MPI_INT, 0, 99, MPI_COMM_WORLD);

else {

myfile = fopen("testfile1", "w");fwrite(buf, sizeof(int), BUFSIZE, myfile);for (i=1; i<numprocs; i++) {

MPI_Recv(buf, BUFSIZE, MPI_INT, i, 99, MPI_COMM_WORLD,

&status);

fwrite(buf, sizeof(int), BUFSIZE, myfile);

} fclose(myfile);

} MPI_Finalize();return 0;

}

Dr. Hanif Durad

io0.c

Pros and Cons of Sequential I/O

Pros:

parallel machine may support I/O from only one process (e.g.,no common file system)

Some I/O libraries (e.g. HDF-4, NetCDF) not parallel

resulting single file is handy for

ftp

mv

big blocks improve performance

short distance from original, serial code

Cons:

lack of parallelism limits scalability, performance (singlenode bottleneck)

Dr. Hanif Durad

What is Parallel I/O?

Multiple processes of a parallel programaccessing data (reading or writing) from a common

file

FILE

P

P

P

P(n-1)

Dr. Hanif Durad

Why Parallel I/O?

Non-parallel I/O is simple but

Poor performance (single process writes to one file)or

Awkward and not interoperable with other tools (eachprocess writes a separate file)

Parallel I/O

Provides high performance

Can provide a single file that can be used with othertools (such as visualization programs)

Dr. Hanif Durad

MPI-IO Background

Marc Snir et al (IBM Watson) paper exploring MPI ascontext for parallel I/O (1994)

MPI-IO email discussion group led by J.-P. Prost (IBM)and Bill Nitzberg (NASA), 1994

MPI-IO group joins MPI Forum in June 1996

MPI-2 standard released in July 1997

MPI-IO is Chapter 9 of MPI-

Dr. Hanif Durad

Using MPI for Simple I/O

FILE

P

P

P

P(n-1)

Each process needs to read a chunk of data from a common file

Arguments

Dr. Hanif Durad

comm_old

existing communicator

ndims

number of dimensions

periods

logical array indicating whether a dimension is cyclic (If TRUE, cyclic boundary conditions)

reorder

logical (If FALSE, rank preserved)

(If TRUE, possible rank reordering)

comm_cart

new cartesian communicator