1 Parallel Computing—Introduction to Message Passing Interface (MPI)

Slides:



Advertisements
Similar presentations
1 Tuning for MPI Protocols l Aggressive Eager l Rendezvous with sender push l Rendezvous with receiver pull l Rendezvous blocking (push or pull)
Advertisements

1 What is message passing? l Data transfer plus synchronization l Requires cooperation of sender and receiver l Cooperation not always apparent in code.
MPI Message Passing Interface Portable Parallel Programs.
MPI Message Passing Interface
Parallel Processing1 Parallel Processing (CS 667) Lecture 9: Advanced Point to Point Communication Jeremy R. Johnson *Parts of this lecture was derived.
CS 140: Models of parallel programming: Distributed memory and MPI.
1 Buffers l When you send data, where does it go? One possibility is: Process 0Process 1 User data Local buffer the network User data Local buffer.
Programming Parallel Hardware using MPJ Express
Reference: Getting Started with MPI.
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.
CS 240A: Models of parallel programming: Distributed memory and MPI.
Message-Passing Programming and MPI CS 524 – High-Performance Computing.
1 Message protocols l Message consists of “envelope” and data »Envelope contains tag, communicator, length, source information, plus impl. private data.
S an D IEGO S UPERCOMPUTER C ENTER N ATIONAL P ARTNERSHIP FOR A DVANCED C OMPUTATIONAL I NFRASTRUCTURE Message Passing Interface (MPI) Part I NPACI Parallel.
High Performance Communication using MPJ Express 1 Presented by Jawad Manzoor National University of Sciences and Technology, Pakistan 29 June 2015.
Jonathan Carroll-Nellenback CIRC Summer School MESSAGE PASSING INTERFACE (MPI)
Message Passing Interface In Java for AgentTeamwork (MPJ) By Zhiji Huang Advisor: Professor Munehiro Fukuda 2005.
1 Tuesday, October 10, 2006 To err is human, and to blame it on a computer is even more so. -Robert Orben.
Basics of Message-passing Mechanics of message-passing –A means of creating separate processes on different computers –A way to send and receive messages.
1 What is message passing? l Data transfer plus synchronization l Requires cooperation of sender and receiver l Cooperation not always apparent in code.
Parallel Programming with Java
Parallel Programming Using Basic MPI Presented by Timothy H. Kaiser, Ph.D. San Diego Supercomputer Center Presented by Timothy H. Kaiser, Ph.D. San Diego.
Parallel Programming with Java YILDIRAY YILMAZ Maltepe Üniversitesi.
High Performance Computation --- A Practical Introduction Chunlin Tian NAOC Beijing 2011.
Lecture 4: Parallel Programming Models. Parallel Programming Models Parallel Programming Models: Data parallelism / Task parallelism Explicit parallelism.
1 Developing Native Device for MPJ Express Advisor: Dr. Aamir Shafi Co-advisor: Ms Samin Khaliq.
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.
ICOM 5995: Performance Instrumentation and Visualization for High Performance Computer Systems Lecture 7 October 16, 2002 Nayda G. Santiago.
1 Copyright © 2010, Elsevier Inc. All rights Reserved Chapter 3 Distributed Memory Programming with MPI An Introduction to Parallel Programming Peter Pacheco.
1 Choosing MPI Alternatives l MPI offers may ways to accomplish the same task l Which is best? »Just like everything else, it depends on the vendor, system.
2.1 Message-Passing Computing ITCS 4/5145 Parallel Computing, UNC-Charlotte, B. Wilkinson, Jan 17, 2012.
Parallel Programming Dr Andy Evans. Parallel programming Various options, but a popular one is the Message Passing Interface (MPI). This is a standard.
HPCA2001HPCA Message Passing Interface (MPI) and Parallel Algorithm Design.
Part I MPI from scratch. Part I By: Camilo A. SilvaBIOinformatics Summer 2008 PIRE :: REU :: Cyberbridges.
CS 240A Models of parallel programming: Distributed memory and MPI.
Introduction to Parallel Programming with C and MPI at MCSR Part 1 The University of Southern Mississippi April 8, 2010.
Parallel Computing A task is broken down into tasks, performed by separate workers or processes Processes interact by exchanging information What do we.
Jonathan Carroll-Nellenback CIRC Summer School MESSAGE PASSING INTERFACE (MPI)
Message Passing Programming with MPI Introduction to MPI Basic MPI functions Most of the MPI materials are obtained from William Gropp and Rusty Lusk’s.
Message Passing Programming Model AMANO, Hideharu Textbook pp. 140-147.
Message Passing Interface (MPI) 1 Amit Majumdar Scientific Computing Applications Group San Diego Supercomputer Center Tim Kaiser (now at Colorado School.
MPJ Express Alon Vice Ayal Ofaim. Contributors 2 Aamir Shafi Jawad Manzoor Kamran Hamid Mohsan Jameel Rizwan Hanif Amjad Aziz Bryan Carpenter Mark Baker.
Distributed-Memory (Message-Passing) Paradigm FDI 2004 Track M Day 2 – Morning Session #1 C. J. Ribbens.
MPI (continue) An example for designing explicit message passing programs Advanced MPI concepts.
Parallel Programming with MPI By, Santosh K Jena..
1 Message Passing Models CEG 4131 Computer Architecture III Miodrag Bolic.
Chapter 4 Message-Passing Programming. The Message-Passing Model.
Message Passing and MPI Laxmikant Kale CS Message Passing Program consists of independent processes, –Each running in its own address space –Processors.
Message-Passing Computing Chapter 2. Programming Multicomputer Design special parallel programming language –Occam Extend existing language to handle.
Introduction to MPI Nischint Rajmohan 5 November 2007.
1 Lecture 4: Part 2: MPI Point-to-Point Communication.
Programming distributed memory systems: Message Passing Interface (MPI) Distributed memory systems: multiple processing units working on one task (e.g.
NORA/Clusters AMANO, Hideharu Textbook pp. 140-147.
Message Passing Interface (MPI) 2 Amit Majumdar Scientific Computing Applications Group San Diego Supercomputer Center Tim Kaiser (now at Colorado School.
3/12/2013Computer Engg, IIT(BHU)1 PARALLEL COMPUTERS- 2.
1 Advanced MPI William D. Gropp Rusty Lusk and Rajeev Thakur Mathematics and Computer Science Division Argonne National Laboratory.
MPI-Message Passing Interface. What is MPI?  MPI is a specification for the developers and users of message passing libraries. By itself, it is NOT a.
Programming Parallel Hardware using MPJ Express By A. Shafi.
MPI Message Passing Interface
Pluggable Architecture for Java HPC Messaging
More on MPI Nonblocking point-to-point routines Deadlock
MPI-Message Passing Interface
Message Passing Models
MPJ (Message Passing in Java): The past, present, and future
A Message Passing Standard for MPP and Workstations
Introduction to parallelism and the Message Passing Interface
MPJ: A Java-based Parallel Computing System
Parallel Processing - MPI
MPI Message Passing Interface
Programming Parallel Computers
Presentation transcript:

1 Parallel Computing—Introduction to Message Passing Interface (MPI)

2 Two Important Concepts Two fundamental concepts of parallel programming are: Domain decomposition Functional decomposition

3 Domain Decomposition

4 Functional Decomposition

5 Message Passing Interface (MPI) MPI is a standard (an interface or an API): It defines a set of methods that are used by application developers to write their applications MPI library implement these methods MPI itself is not a library—it is a specification document that is followed! MPI-1.2 is the most popular specification version Reasons for popularity: Software and hardware vendors were involved Significant contribution from academia MPICH served as an early reference implementation MPI compilers are simply wrappers to widely used C and Fortran compilers History: The first draft specification was produced in 1993 MPI-2.0, introduced in 1999, adds many new features to MPI Bindings available to C, C++, and Fortran MPI is a success story: It is the mostly adopted programming paradigm of IBM Blue Gene systems At least two production-quality MPI libraries: MPICH2 ( OpenMPI ( There’s even a Java library: MPJ Express (

6 Message Passing Model Message passing model allows processors to communicate by passing messages: Processors do not share memory Data transfer between processors required cooperative operations to be performed by each processor: One processor sends the message while other receives the message

7 Proc 6 Proc 0 Proc 1 Proc 3 Proc 2 Proc 4 Proc 5 Proc 7 message CPU Memory LAN Ethernet Myrinet Infiniband etc Distributed Memory Cluster

8 Writing “Hello World” MPI Program MPI is very simple: Initialize MPI environment: MPI_Init(&argc,&argv); // C Code MPI.Init(args); // Java Code Send or receive message: MPI_Send(..); // C Code MPI.COMM_WORLD.Send(); // Java Code Finalize MPI environment MPI_Finalize(); // C Code MPI.Finalize(); // Java Code

9 Hello World in C #include #include “mpi.h”.. // Initialize MPI MPI_Init(&argsc,&&argsv); // Find out the `id’ or `rank’ of current process MPI_Comm_Rank(MPI_COMM_WORLD,&my_rank); //get the rank // Get total number of processes MPI_Comm_Size(MPI_COMM_WORLD,&p); //get total processor // Print the rank of the process printf(“Hello World from process no %d”,my_rank); MPI_Finalize();..

10 Hello World in Java import java.util.*; import mpi.*;.. // Initialize MPI MPI.Init(args); // start up MPI // Get total number of processes and rank size = MPI.COMM_WORLD.Size(); rank = MPI.COMM_WORLD.Rank(); System.out.println(“Hello World ”); MPI_Finalize();..

11 After Initialization import java.util.*; import mpi.*;.. // Initialize MPI MPI.Init(args); // start up MPI // Get total number of processes and rank size = MPI.COMM_WORLD.Size(); rank = MPI.COMM_WORLD.Rank();..

12 What is size? Total number of processes in a communicator: The size of MPI.COMM_WORLD is 6 import java.util.*; import mpi.*;.. // Get total number of processes size = MPI.COMM_WORLD.Size();..

13 What is rank? The “unique” identify (id) of a process in a communicator: Each of the six processes in MPI.COMM_WORLD has a distinct rank or id import java.util.*; import mpi.*;.. // Get total number of processes rank = MPI.COMM_WORLD.Rank();..

14 Running “HelloWorld” in C Write parallel code Start MPICH2 daemon Write machines file Start the parallel job

15

16

17 Running “Hello World” in Java The code is executed on a cluster called “Starbug”: One head-node “holly” and eight compute-nodes Steps: Write machines files Bootstrap MPJ Express (or any MPI library) runtime Write parallel application Compile and execute

18

19 Write machines files

20 Bootstrap MPJ Express runtime

21 Write Parallel Program

22 Compile and Execute

23 Single Program Multiple Data (SPMD) Model import java.util.*; import mpi.*; public class HelloWorld { MPI.Init(args); // start up MPI size = MPI.COMM_WORLD.Size(); rank = MPI.COMM_WORLD.Rank(); if (rank == 0) { System.out.println(“I am Process 0”); } else if (rank == 1) { System.out.println(“I am Process 1”); } MPI.Finalize(); }

24 Single Program Multiple Data (SPMD) Model import java.util.*; import mpi.*; public class HelloWorld { MPI.Init(args); // start up MPI size = MPI.COMM_WORLD.Size(); rank = MPI.COMM_WORLD.Rank(); if (rank%2 == 0) { System.out.println(“I am an even process”); } else if (rank%2 == 1) { System.out.println(“I am an odd process”); } MPI.Finalize(); }

25 Point to Point Communication The most fundamental facility provided by MPI Basically “exchange messages between two processes”: One process (source) sends message The other process (destination) receives message

26 Point to Point Communication It is possible to send message for each basic datatype: Floats, Integers, Doubles … Each message contains a “tag”—an identifier Tag1 Tag2

27 Process 6 Process 0 Process 1 Process 3 Process 2 Process 4 Process 5 Process 7 message Integers Process 4 Tag COMM_WORLD Point to Point Communication

28 Blocking and Non-blocking There are blocking and non-blocking version of send and receive methods Blocking versions: A process calls send() or recv(), these methods return when the message has been physically sent or received Non-blocking versions: A process calls isend() or irecv(), these methods return immediately The user can check the status of message by calling test() or wait() Note the “ i ” in isend() and irecv() Non-blocking versions provide overlapping of computation and communication: It also depends on the “quality” of the implementation

29 CPU waits “Blocking” send() recv() Sender Receiver time CPU waits “Non Blocking” isend() irecv() Sender Receiver time CPU perform task iwait() CPU waits iwait() CPU waits CPU perform task

30 Modes of Send The MPI standard defines four modes of send: Standard Synchronous Buffered Ready

31 Standard Mode (Eager send protocol used for small messages)

32 Synchronous Mode (Rendezvous Protocol used for large messages)

33 Performance Evaluation of Point to Point Communication Normally ping pong benchmarks are used to calculate: Latency: How long it takes to send N bytes from sender to receiver? Throughput: How much bandwidth is achieved? Latency is a useful measure for studying the performance of “small” messages Throughput is a useful measure for studying the performance of “large” messages

34 Latency on Fast Ethernet

35 Throughput on Fast Ethernet

36 Latency on Gigabit Ethernet

37 Throughput on GigE

38 Latency on Myrinet

39 Throughput on Myrinet