A Message Passing Standard for MPP and Workstations. Communications of the ACM, July 1996 J.J. Dongarra, S.W. Otto, M. Snir, and D.W.

Similar documents
A Message Passing Standard for MPP and Workstations

Intermediate MPI features

High Performance Computing

MPI Message Passing Interface

Basic MPI Communications. Basic MPI Communications (cont d)

Introduction to the Message Passing Interface (MPI)

Message-Passing Computing

Distributed Memory Parallel Programming

Cluster Computing MPI. Industrial Standard Message Passing

CS4961 Parallel Programming. Lecture 18: Introduction to Message Passing 11/3/10. Final Project Purpose: Mary Hall November 2, 2010.

Review of MPI Part 2

MPI. (message passing, MIMD)

High-Performance Computing: MPI (ctd)

Message Passing Interface

An Introduction to MPI

CS 470 Spring Mike Lam, Professor. Distributed Programming & MPI

The Message Passing Interface (MPI) TMA4280 Introduction to Supercomputing

Practical Scientific Computing: Performanceoptimized

Outline. Communication modes MPI Message Passing Interface Standard

CS 470 Spring Mike Lam, Professor. Distributed Programming & MPI

Reusing this material

CSE 160 Lecture 15. Message Passing

The Message Passing Interface (MPI): Parallelism on Multiple (Possibly Heterogeneous) CPUs

A message contains a number of elements of some particular datatype. MPI datatypes:

CS 6230: High-Performance Computing and Parallelization Introduction to MPI

Programming with MPI Collectives

CS 179: GPU Programming. Lecture 14: Inter-process Communication

Parallel Computing and the MPI environment

Outline. Communication modes MPI Message Passing Interface Standard. Khoa Coâng Ngheä Thoâng Tin Ñaïi Hoïc Baùch Khoa Tp.HCM

CINES MPI. Johanne Charpentier & Gabriel Hautreux

CSE 613: Parallel Programming. Lecture 21 ( The Message Passing Interface )

Slides prepared by : Farzana Rahman 1

CSE. Parallel Algorithms on a cluster of PCs. Ian Bush. Daresbury Laboratory (With thanks to Lorna Smith and Mark Bull at EPCC)

MPI point-to-point communication

MPI: Message Passing Interface An Introduction. S. Lakshmivarahan School of Computer Science

Standard MPI - Message Passing Interface

Parallel programming MPI

MPI MESSAGE PASSING INTERFACE

Recap of Parallelism & MPI

COSC 6374 Parallel Computation

Basic Communication Operations (Chapter 4)

Message Passing Interface

Data parallelism. [ any app performing the *same* operation across a data stream ]

Computer Architecture

Message-Passing and MPI Programming

The Message Passing Interface (MPI): Parallelism on Multiple (Possibly Heterogeneous) CPUs

Introduction to MPI: Part II

Claudio Chiaruttini Dipartimento di Matematica e Informatica Centro Interdipartimentale per le Scienze Computazionali (CISC) Università di Trieste

Introduction to MPI. May 20, Daniel J. Bodony Department of Aerospace Engineering University of Illinois at Urbana-Champaign

MPI MESSAGE PASSING INTERFACE

Chip Multiprocessors COMP Lecture 9 - OpenMP & MPI

MPI (Message Passing Interface)

CEE 618 Scientific Parallel Computing (Lecture 5): Message-Passing Interface (MPI) advanced

Collective Communication in MPI and Advanced Features

PCAP Assignment I. 1. A. Why is there a large performance gap between many-core GPUs and generalpurpose multicore CPUs. Discuss in detail.

Topics. Lecture 7. Review. Other MPI collective functions. Collective Communication (cont d) MPI Programming (III)

Collective Communications

MA471. Lecture 5. Collective MPI Communication

IPM Workshop on High Performance Computing (HPC08) IPM School of Physics Workshop on High Perfomance Computing/HPC08

Week 3: MPI. Day 02 :: Message passing, point-to-point and collective communications

CS4961 Parallel Programming. Lecture 19: Message Passing, cont. 11/5/10. Programming Assignment #3: Simple CUDA Due Thursday, November 18, 11:59 PM

Distributed Systems + Middleware Advanced Message Passing with MPI

AMath 483/583 Lecture 21

東京大学情報基盤中心准教授片桐孝洋 Takahiro Katagiri, Associate Professor, Information Technology Center, The University of Tokyo

Tutorial 2: MPI. CS486 - Principles of Distributed Computing Papageorgiou Spyros

Parallel Computing Paradigms

MPI Workshop - III. Research Staff Cartesian Topologies in MPI and Passing Structures in MPI Week 3 of 3

Buffering in MPI communications

Department of Informatics V. HPC-Lab. Session 4: MPI, CG M. Bader, A. Breuer. Alex Breuer

MPI 5. CSCI 4850/5850 High-Performance Computing Spring 2018

Cornell Theory Center. Discussion: MPI Collective Communication I. Table of Contents. 1. Introduction

Part - II. Message Passing Interface. Dheeraj Bhardwaj

Experiencing Cluster Computing Message Passing Interface

High Performance Computing Course Notes Message Passing Programming I

Message Passing Programming. Modes, Tags and Communicators

Peter Pacheco. Chapter 3. Distributed Memory Programming with MPI. Copyright 2010, Elsevier Inc. All rights Reserved

Distributed Memory Programming with MPI. Copyright 2010, Elsevier Inc. All rights Reserved

Distributed Memory Programming with MPI

Topics. Lecture 6. Point-to-point Communication. Point-to-point Communication. Broadcast. Basic Point-to-point communication. MPI Programming (III)

MPI and OpenMP (Lecture 25, cs262a) Ion Stoica, UC Berkeley November 19, 2016

Message Passing Interface. most of the slides taken from Hanjun Kim

Chapter 3. Distributed Memory Programming with MPI

Message Passing Interface

Introduction to MPI. Ricardo Fonseca.

HPC Parallel Programing Multi-node Computation with MPI - I

Scientific Computing

Intermediate MPI. M. D. Jones, Ph.D. Center for Computational Research University at Buffalo State University of New York

Message Passing with MPI

Acknowledgments. Programming with MPI Basic send and receive. A Minimal MPI Program (C) Contents. Type to enter text

Practical Introduction to Message-Passing Interface (MPI)

Programming with MPI Basic send and receive

MPI Collective communication

Message Passing Programming. Modes, Tags and Communicators

Introduction to parallel computing concepts and technics

Message passing. Week 3: MPI. Day 02 :: Message passing, point-to-point and collective communications. What is MPI?

Paul Burton April 2015 An Introduction to MPI Programming

Parallel Programming with MPI MARCH 14, 2018

Programming SoHPC Course June-July 2015 Vladimir Subotic MPI - Message Passing Interface

Parallel Short Course. Distributed memory machines

CS4961 Parallel Programming. Lecture 16: Introduction to Message Passing 11/3/11. Administrative. Mary Hall November 3, 2011.

Transcription:

1 A Message Passing Standard for MPP and Workstations Communications of the ACM, July 1996 J.J. Dongarra, S.W. Otto, M. Snir, and D.W. Walker

2 Message Passing Interface (MPI) Message passing library Can be added to sequential languages (C, Fortran) Designed by consortium from industry, academics, government Goal is a message passing standard

3 MPI Programming Model Multiple Program Multiple Data (MPMD) Processors may eecute different programs (unlike SPMD) Number of processes is fied (one per processor) No support for multi-threading Point-to-point and collective communication

4 MPI Basics MPI INIT MPI FINALIZE MPI COMM SIZE MPI COMM RANK MPI SEND MPI RECV initialize MPI terminate computation number of processes my process identifier send a message receive a message

5 Language Bindings Describes for a given base language concrete synta error-handling conventions parameter modes Popular base languages: C Fortran

6 Point-to-point message passing Messages sent from one processor to another are FIFO ordered Messages sent by different processors arrive nondeterministically Receiver may specify source source = sender s identity symmetric naming source = MPI ANY SOURCE asymmetric naming eample: specify sender of net pivot row in ASP Receiver may also specify tag Distinguishes different kinds of messages Similar to operation name in SR or entry name in Ada

7 int, status; float buf[10]; Eamples MPI_SEND(buf, 10, MPI_FLOAT, 3, 0, MPI_COMM_WORLD); /* send 10 floats to process 3; MPI_COMM_WORLD = all processes */ MPI_RECV(&, 1, MPI_INT, 15, 0, MPI_COMM_WORLD, &status); /* receive 1 integer from process 15 */ MPI_RECV(&, 1, MPI_INT, MPI_ANY_SOURCE, 0, MPI_COMM_WORLD, &status); /* receive 1 integer from any process */

8 int, status; #define NEW_MINIMUM 1 Eamples (Cnt d) MPI_SEND(&, 1, MPI_INT, 3, NEW_MINIMUM, MPI_COMM_WORLD); /* send message with tag NEW_MINIMUM */. MPI_RECV(&, 1, MPI_INT, 15, NEW_MINIMUM, MPI_COMM_WORLD, &status); /* receive 1 integer with tag NEW_MINIMUM */ MPI_RECV(&, 1, MPI_INT, MPI_ANY_SOURCE, NEW_MINIMUM, MPI_COMM_WORLD, &status); /* receive tagged message from any source */

9 Forms of message passing (1) Communication modes Standard: system decides whether message is buffered Buffered: user eplicitly controls buffering Synchronous: send waits for matching receive Ready: send may be started only if matching receive has already been posted

10 Forms of message passing (2) Nonblocking communication When blocking send returns, memory buffer can be reused Blocking receive waits for message Nonblocking send returns immediately (dangerous) Nonblocking receive through IPROBE

11 Nonblocking receive MPI IPROBE MPI PROBE MPI GET COUNT check for pending message wait for pending message number of data elements in message MPI PROBE(source, tag, comm, &status) status MPI GET COUNT(status, datatype, &count) message size status.mpi SOURCE identity of sender status.mpi TAG tag of message

12 Eample: Check for Pending Message int buf[1], flag, source, minimum; while (...) { MPI_IPROBE(MPI_ANY_SOURCE, NEW_MINIMUM, comm, &flag, &status); if (flag) { /* handle new minimum */ source = status.mpi_source; MPI_RECV(buf, 1, MPI_INT, source, NEW_MINIMUM, comm, &status); minimum = buf[0]; }... /* compute */ }

13 Eample: Receiving Message with Unknown Size int count, *buf, source; MPI_PROBE(MPI_ANY_SOURCE, 0, comm, &status); source = status.mpi_source; MPI_GET_COUNT(status, MPI_INT, &count); buf = malloc(count * sizeof(int)); MPI_RECV(buf, count, MPI_INT, source, 0, comm, &status);

14 Global Operations Collective Communication Coordinated communication involving all processes Functions: MPI BARRIER MPI BCAST MPI GATHER MPI SCATTER MPI REDUCE MPI REDUCE ALL synchronize all processes send data to all processes gather data from all processes scatter data to all processes reduction operation reduction, all processes get result

15 Barrier MPI BARRIER(comm) Synchronizes group of processes All processes block until all have reached the barrier Often invoked at end of loop in iterative algorithms

16 Figure 8.3 from Foster s book data processes A 0 A 0 one-to-all broadcast A 0 MPI_BCAST A 0 A 0 A 0 A 1 A 2 A 3 one-to-all gather MPI_GATHER A 0 A 1 A 2 A 3 A 0 A 1 A 2 A 3 A 0 one-to-all scatter A 1 MPI_SCATTER A 2 A 3

17 Reduction Combine values provided by different processes Result sent to one processor (MPI REDUCE) or all processors (MPI REDUCE ALL) Used with commutative and associative operators: MAX, MIN, +,, AND, OR

18 Eample 1 Global minimum operation MPI_REDUCE(inbuf, outbuf, 2, MPI_INT, MPI_MIN, 0, MPI_COMM_WORLD) outbuf[0] = minimum over inbuf[0] s outbuf[1] = minimum over inbuf[1] s

19 Figure 8.4 from Foster s book Processes... 0 1 2 3 Initial Data : 2 4 5 7 0 3 6 2 MPI_REDUCE with MPI_MIN, root = 0 : 0 2 - - - - - - MPI_ALLREDUCE with MPI_MIN: 0 2 0 2 0 2 0 2 MPI_REDUCE with MPI_SUM, root = 1 : - - 1316 - - - -

20 Eample 2: SOR in MPI.... local........ remote................

21 SOR communication scheme CPU 1 CPU 2 CPU 3 owned row copy of neighbor s row Each CPU communicates with left & right neighbor (if eisting) Also need to determine convergence criterium

22 Epressing SOR in MPI Use a ring topology Each processor echanges rows with left/right neighbor Use REDUCE ALL to determine if grid has changed less than epsilon during last iteration

23 Figure 8.5 from Foster s book (1) MPI_BCAST Processes 0 1 2 (2) MPI_SCATTER (3) MPI_SEND/RECV (4) MPI_REDUCEALL (5) MPI_GATHER

24 Modularity MPI programs use libraries Library routines may send messages These messages should not interfere with application messages Tags do not solve this problem

25 Communicators Communicator denotes group of processes (contet) MPI SEND and MPI RECV specify a communicator MPI RECV can only receive messages sent to same communicator Library routines should use separate communicators, passed as parameter

26 Discussion Library-based: No language modifications No compiler Synta is awkward Message receipt based on identity of sender and operation tag, but not on contents of message Needs separate mechanism for organizing name space No type checking of messages

27 SR: Synta MPI: call slave.coordinates(2.4, 5.67); in coordinates(, y); #define COORDINATES_TAG 1 #define SLAVE_ID 15 float buf[2]; buf[0] = 2.4; buf[1] = 5.67; MPI_SEND(buf, 2, MPI_FLOAT, SLAVE_ID, COORDINATES_TAG, MPI_COMM_WORLD); MPI_RECV(buf, 2, MPI_FLOAT, MPI_ANY_SOURCE, COORDINATES_TAG, MPI_COMM_WORLD, &status);