MPI Programming for newbie

Post on 19-Jun-2015

293 views 6 download

description

Message Passing Interface (MPI) is a standardized and portable message-passing system designed by a group of researchers from academia and industry to function on a wide variety of parallel computers. The standard defines the syntax and semantics of a core of library routines useful to a wide range of users writing portable message-passing programs in Fortran or the C programming language. There are several well-tested and efficient implementations of MPI, including some that are free or in the public domain. These fostered the development of a parallel software industry, and there encouraged development of portable and scalable large-scale parallel applications.

Transcript of MPI Programming for newbie

MPI Programming for newbie

- Wei Mu

Wednesday, April 18, 12

Agenda

• What’s MPI

• Why Choose it

• MPI Basic Subroutine

• Sample 01: Send & Receive

• Sample 02: π Calculation

Wednesday, April 18, 12

What's MPI?

• A LIBRARY , NOT a programming language

• Standard

• Message Passing Interface

• Work with FORTRAN & C

Wednesday, April 18, 12

Why Choose it ?

Wednesday, April 18, 12

MPI Basic Subroutine# include “mpi.h”int main(int argc, char *argv[]){......

MPI_Init();......

MPI_Comm_rank(MPI_COMM, int *rank);MPI_Comm_size(MPI_COMM, int *size);

.....MPI_Finalize();

}

Wednesday, April 18, 12

Sample 01: Send & Receive

Wednesday, April 18, 12

Sample 02: π Calculation

Wednesday, April 18, 12

Wednesday, April 18, 12

Reference: SubroutinesMPI_Send(buf, count, datatype, dest, tag, comm, ierror)

MPI_Recv(buf, count, datatype, source, tag, comm, status, ierror)

MPI_BCAST(buffer,count,datatype,root,comm)

MPI_BARRIER(comm)

MPI_REDUCE(sendbuf,recvbuf,count,datatype,op,root,comm)

...... ......

Wednesday, April 18, 12

Q & A , Feedback

• What’s your next steps of MPI Programming

• Which gives you more interest on MPI Programming

Wednesday, April 18, 12