More on MPI Nonblocking point-to-point routines Deadlock

Slides:



Advertisements
Similar presentations
1 What is message passing? l Data transfer plus synchronization l Requires cooperation of sender and receiver l Cooperation not always apparent in code.
Advertisements

MPI Message Passing Interface Portable Parallel Programs.
MPI Message Passing Interface
1 Non-Blocking Communications. 2 #include int main(int argc, char **argv) { int my_rank, ncpus; int left_neighbor, right_neighbor; int data_received=-1;
1 Introduction to Collective Operations in MPI l Collective operations are called by all processes in a communicator. MPI_BCAST distributes data from one.
Asynchronous I/O with MPI Anthony Danalis. Basic Non-Blocking API  MPI_Isend()  MPI_Irecv()  MPI_Wait()  MPI_Waitall()  MPI_Waitany()  MPI_Test()
Parallel Processing1 Parallel Processing (CS 667) Lecture 9: Advanced Point to Point Communication Jeremy R. Johnson *Parts of this lecture was derived.
MPI Collective Communications
1 Implementing Master/Slave Algorithms l Many algorithms have one or more master processes that send tasks and receive results from slave processes l Because.
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.
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.
2/9/2007CS267 Lecure 81 CS 267: Distributed Memory Programming (MPI) and Tree-Based Algorithms Kathy Yelick
Distributed Memory Programming with MPI. What is MPI? Message Passing Interface (MPI) is an industry standard message passing system designed to be both.
1 Parallel Computing—Introduction to Message Passing Interface (MPI)
Ace104 Lecture 8 Tightly Coupled Components MPI (Message Passing Interface)
02/13/2007CS267 Lecture 71 CS 267: Distributed Memory Machines and Programming Jonathan Carter
Distributed Systems CS Programming Models- Part II Lecture 17, Nov 2, 2011 Majd F. Sakr, Mohammad Hammoud andVinay Kolar 1.
MPI. Message Passing Programming  Model m Set of processes that each have local data and are able to communicate with each other by sending and receiving.
Parallel Programming with Java
Collective Communication
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.
Parallel Computing A task is broken down into tasks, performed by separate workers or processes Processes interact by exchanging information What do we.
Parallel Programming with MPI Prof. Sivarama Dandamudi School of Computer Science Carleton University.
Jonathan Carroll-Nellenback CIRC Summer School MESSAGE PASSING INTERFACE (MPI)
MPI Communications Point to Point Collective Communication Data Packaging.
An Introduction to Parallel Programming with MPI March 22, 24, 29, David Adams
1 Overview on Send And Receive routines in MPI Kamyar Miremadi November 2004.
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.
MPI – Message Passing Interface Source:
Message-Passing Computing Chapter 2. Programming Multicomputer Design special parallel programming language –Occam Extend existing language to handle.
MPI Point to Point Communication CDP 1. Message Passing Definitions Application buffer Holds the data for send or receive Handled by the user System buffer.
1 BİL 542 Parallel Computing. 2 Message Passing Chapter 2.
FIT5174 Parallel & Distributed Systems Dr. Ronald Pose Lecture FIT5174 Distributed & Parallel Systems Lecture 5 Message Passing and MPI.
Message Passing Interface (MPI) 2 Amit Majumdar Scientific Computing Applications Group San Diego Supercomputer Center Tim Kaiser (now at Colorado School.
Message Passing Programming Based on MPI Collective Communication I Bora AKAYDIN
MPI Derived Data Types and Collective Communication
Message Passing Interface Using resources from
Distributed Systems CS Programming Models- Part II Lecture 14, Oct 28, 2013 Mohammad Hammoud 1.
An Introduction to Parallel Programming with MPI February 17, 19, 24, David Adams
3/12/2013Computer Engg, IIT(BHU)1 MPI-2. POINT-TO-POINT COMMUNICATION Communication between 2 and only 2 processes. One sending and one receiving. Types:
Computer Science Department
Introduction to parallel computing concepts and technics
MPI Point to Point Communication
MPI Message Passing Interface
Computer Science Department
Auburn University COMP7330/7336 Advanced Parallel and Distributed Computing Principles of Message-Passing Programming.
Parallel Programming with MPI and OpenMP
An Introduction to Parallel Programming with MPI
Distributed Systems CS
MPI-Message Passing Interface
Distributed Systems CS
Collective Communication in MPI and Advanced Features
Lecture 14: Inter-process Communication
A Message Passing Standard for MPP and Workstations
CSCE569 Parallel Computing
Quiz Questions ITCS 4145/5145 Parallel Programming MPI
Introduction to parallelism and the Message Passing Interface
More on MPI Nonblocking point-to-point routines Deadlock
Barriers implementations
More Quiz Questions Parallel Programming MPI Collective routines
Message-Passing Computing Message Passing Interface (MPI)
Synchronizing Computations
Hello, world in MPI #include <stdio.h> #include "mpi.h"
Computer Science Department
5- Message-Passing Programming
Hello, world in MPI #include <stdio.h> #include "mpi.h"
MPI Message Passing Interface
Programming Parallel Computers
Presentation transcript:

More on MPI Nonblocking point-to-point routines Deadlock Collective communication

Non-blocking send/recv Most hardware has a communication co-processor: communication can happen at the same time with computation. Proc 0 proc 1 … MPI_Send_start MPI_Recv_start Comp … Comp …. MPI_Send_wait MPI_Recv_wait No comm/comp overlaps Proc 0 proc 1 … MPI_Send MPI_Recv Comp … Comp …. No comm/comp overlaps

Non-blocking send/recv routines Non-blocking primitives provide the basic mechanisms for overlapping communication with computation. Non-blocking operations return (immediately) “request handles” that can be tested and waited on. MPI_Isend(start, count, datatype, dest, tag, comm, request) MPI_Irecv(start, count, datatype, dest, tag, comm, request) MPI_Wait(&request, &status)

One can also test without waiting: MPI_Test(&request, &flag, status) MPI allows multiple outstanding non-blocking operations. MPI_Waitall(count, array_of_requests, array_of_statuses) MPI_Waitany(count, array_of_requests, &index, &status)

Deadlocks Send a large message from process 0 to process 1 If there is insufficient storage at the destination, the send must wait for memory space What happens with this code? Process 0 Send(1) Recv(1) Process 1 Send(0) Recv(0) This is called “unsafe” because it depends on the availability of system buffers

Some Solutions to the “unsafe” Problem Order the operations more carefully: Process 0 Send(1) Recv(1) Process 1 Recv(0) Send(0) Supply receive buffer at same time as send: Process 0 Sendrecv(1) Process 1 Sendrecv(0)

More Solutions to the “unsafe” Problem Supply own space as buffer for send (buffer mode send) Process 0 Bsend(1) Recv(1) Process 1 Bsend(0) Recv(0) Use non-blocking operations: Process 0 Isend(1) Irecv(1) Waitall Process 1 Isend(0) Irecv(0)

MPI Collective Communication Send/recv routines are also called point-to-point routines (two parties). Some operations require more than two parties, e.g broadcast, reduce. Such operations are called collective operations, or collective communication operations. Non-blocking collective operations in MPI-3 only Three classes of collective operations: Synchronization data movement collective computation

Synchronization MPI_Barrier( comm ) Blocks until all processes in the group of the communicator comm call it.

Collective Data Movement P0 P1 P2 P3 A Broadcast Scatter B C D A B D C Gather

Collective Computation B D C ABCD AB ABC Reduce Scan

MPI Collective Routines Many Routines: Allgather, Allgatherv, Allreduce, Alltoall, Alltoallv, Bcast, Gather, Gatherv, Reduce, Reduce_scatter, Scan, Scatter, Scatterv All versions deliver results to all participating processes. V versions allow the hunks to have different sizes. Allreduce, Reduce, Reduce_scatter, and Scan take both built-in and user-defined combiner functions.

MPI discussion Ease of use MPI is hard to use!! Programmer takes care of the ‘logical’ distribution of the global data structure Programmer takes care of synchronizations and explicit communications None of these are easy. MPI is hard to use!!

MPI discussion Expressiveness Data parallelism Task parallelism There is always a way to do it if one does not care about how hard it is to write the program.

MPI discussion Exposing architecture features Force one to consider locality, this often leads to more efficient program. MPI standard does have some items to expose the architecture feature (e.g. topology). Performance is a strength in MPI programming. Would be nice to have both world of OpenMP and MPI.