Docsity

MPI and OpenMPI - Computational Sciences - Lecture Slides, Slides of Computational Techniques

Partial preview of the text

Download MPI and OpenMPI - Computational Sciences - Lecture Slides and more Slides Computational Techniques in PDF only on Docsity!

MPI

OpenMPI

Outline

A

brief Background on Parallel Computers

A

Brief History of

MPI

MPI

A

Brief History of OpenMPI

OpenMPI

More

on

Parallel

Computers

At the heart of all parallel machines is a collection of processors, often in the hundreds or thousands

Each processor has its own cache and local memory - Parallel computers all have some communication facility โ€“ powerful switches are normally used to interconnect processors, while busses are used to connect processors in local clusters

Models

of

Parallel

Machines

There are three most important classes of parallel machines

Shared

Disk

Shared

Nothing

MPI

The concept of message transferring so that processes communicate with other processes by sending and receiving messages, is the core of the Message Passing Interface

(MPI)

What

is

MPI?

MPI

is a message

passing library specification proposed as a standard by a committee of vendors, implementers, and users. It is designed to permit the development of parallel software libraries

WHAT

ITS

NOT!

โ€ A compiler โ€ A specific Product

Birth

of

MPI

April 1992, during one โ€ day workshop on Standards for Message Passing in Distributed โ€ Memory Environment, they all realized that they were continuously reinventing the wheel duplicating each other's efforts - They got together (Supercomputing '92) and decided to thrash out a common standard in the same hotel in Dallas, where HPF Forum met - The first standard (MPI โ€ 1.0) was completed in May 1994 - The Beta version of the second, enhanced standard (MPI โ€ 2.0) was released in July of 1997 - Industrial participants included Convex, Cray, IBM, Intel, Meiko, nCUBE, NEC, Thinking Machines docsity.com

Where

to

use

MPI

MPI

is primarily for

SPMD

and

MIMD

types of parallel computing environments SPMD

Same Program, Different Data MIND - Different Programs, Different Data

The Six Basic Functions of

MPI

MPI_INIT ( Int *arg, char ***argv) Initiate an MPI computation.argc, argv are required only in C language binding,where they are are main programโ€™s argument. MPI


FINALIZE () Shutdown a computation. MPI_COMM_SIZE (comm, size) Determine the number of processes in a computation.comm communicator (handle) size number of processes in the group of comms (Integer)

Basic functions continued

MPI_COMM_RANK (comm, pid) Determine the identifier of the current process.comm communicator (handle) pid process id in the group of comm (Integer)

Basic functions continued

MPI_RECV (buf, count, datatype, source, tag, comm, status) Receive a message.buf Address of receive buffer (choice) count size of receive buffer, in elements (Integer >=0) datatype datatype of receive buffer elements (handle) source process id of source process, or MPI_ANY_SOURCE (Integer) tag message tag, or MPI_ANY_TAG (Integer) comm communicator (handle) status status object (status)

Sample

C

Program

#include <stdio.h>#include <mpi.h>main(int argc, char* argv) { int size, rank;MPI_Init(argc, &argv);MPI_Comm_size(MPI_COMM_WORLD, &size);MPI_Comm_rank(MPI_COMM_WORLD, &rank);printf("Hello world! I'm %d of %d\n", rank+1, size);MPI_Finalize(); }