Parallel Programming and Algorithms – MPI Collective Operations David Monismith CS599 Feb. 10, 2015 Based upon MPI: A Message-Passing Interface Standard.

Slides:



Advertisements
Similar presentations
1 Introduction to Collective Operations in MPI l Collective operations are called by all processes in a communicator. MPI_BCAST distributes data from one.
Advertisements

Its.unc.edu 1 Collective Communication University of North Carolina - Chapel Hill ITS - Research Computing Instructor: Mark Reed
MPI Collective Communications
1 Collective Operations Dr. Stephen Tse Lesson 12.
MPI_Gatherv CISC372 Fall 2006 Andrew Toy Tom Lynch Bill Meehan.
MPI_REDUCE() Philip Madron Eric Remington. Basic Overview MPI_Reduce() simply applies an MPI operation to select local memory values on each process,
HPDC Spring MPI 11 CSCI-6964: High Performance Parallel & Distributed Computing (HPDC) AE 216, Mon/Thurs. 2 – 3:20 p.m Message Passing Interface.
1 Parallel Computing—Higher-level concepts of 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.
12c.1 Collective Communication in MPI UNC-Wilmington, C. Ferner, 2008 Nov 4, 2008.
SOME BASIC MPI ROUTINES With formal datatypes specified.
MPI Collective Communication CS 524 – High-Performance Computing.
Parallel Programming in C with MPI and OpenMP
EECC756 - Shaaban #1 lec # 7 Spring Message Passing Interface (MPI) MPI, the Message Passing Interface, is a library, and a software standard.
MPI Workshop - II Research Staff Week 2 of 3.
Collective Communications
Collective Communication.  Collective communication is defined as communication that involves a group of processes  More restrictive than point to point.
Message Passing Interface. Message Passing Interface (MPI) Message Passing Interface (MPI) is a specification designed for parallel applications. The.
Parallel Programming – Process- Based Communication Operations David Monismith CS599 Based upon notes from Introduction to Parallel Programming, Second.
Jonathan Carroll-Nellenback CIRC Summer School MESSAGE PASSING INTERFACE (MPI)
Parallel Programming with Java
Collective Communication
Parallel Programming with MPI Matthew Pratola
L15: Putting it together: N-body (Ch. 6) October 30, 2012.
Parallel Processing1 Parallel Processing (CS 676) Lecture 7: Message Passing using MPI * Jeremy R. Johnson *Parts of this lecture was derived from chapters.
2a.1 Message-Passing Computing More MPI routines: Collective routines Synchronous routines Non-blocking routines ITCS 4/5145 Parallel Computing, UNC-Charlotte,
1 Collective Communications. 2 Overview  All processes in a group participate in communication, by calling the same function with matching arguments.
ECE 1747H : Parallel Programming Message Passing (MPI)
1 MPI: Message-Passing Interface Chapter 2. 2 MPI - (Message Passing Interface) Message passing library standard (MPI) is developed by group of academics.
Introduction to Parallel Programming with C and MPI at MCSR Part 2 Broadcast/Reduce.
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.
PP Lab MPI programming VI. Program 1 Break up a long vector into subvectors of equal length. Distribute subvectors to processes. Let them compute the.
Parallel Programming with MPI Prof. Sivarama Dandamudi School of Computer Science Carleton University.
CS 838: Pervasive Parallelism Introduction to MPI Copyright 2005 Mark D. Hill University of Wisconsin-Madison Slides are derived from an online tutorial.
MPI Communications Point to Point Collective Communication Data Packaging.
Message Passing Programming Model AMANO, Hideharu Textbook pp. 140-147.
Parallel Programming with MPI By, Santosh K Jena..
Lecture 6: Message Passing Interface (MPI). Parallel Programming Models Message Passing Model Used on Distributed memory MIMD architectures Multiple processes.
CSCI-455/522 Introduction to High Performance Computing Lecture 4.
Oct. 23, 2002Parallel Processing1 Parallel Processing (CS 730) Lecture 6: Message Passing using MPI * Jeremy R. Johnson *Parts of this lecture was derived.
MPI Jakub Yaghob. Literature and references Books Gropp W., Lusk E., Skjellum A.: Using MPI: Portable Parallel Programming with the Message-Passing Interface,
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Message-passing Model.
ICOM 5995: Performance Instrumentation and Visualization for High Performance Computer Systems Lecture 8 October 23, 2002 Nayda G. Santiago.
2.1 Collective Communication Involves set of processes, defined by an intra-communicator. Message tags not present. Principal collective operations: MPI_BCAST()
-1.1- MPI Lectured by: Nguyễn Đức Thái Prepared by: Thoại Nam.
Message Passing Programming Based on MPI Collective Communication I Bora AKAYDIN
MPI Derived Data Types and Collective Communication
COMP7330/7336 Advanced Parallel and Distributed Computing MPI Programming: 1. Collective Operations 2. Overlapping Communication with Computation Dr. Xiao.
ITCS 4/5145 Parallel Computing, UNC-Charlotte, B
1 MPI: Message Passing Interface Prabhaker Mateti Wright State University.
Distributed Processing with MPI International Summer School 2015 Tomsk Polytechnic University Assistant Professor Dr. Sergey Axyonov.
Computer Science Department
Introduction to MPI Programming Ganesh C.N.
Collectives Reduce Scatter Gather Many more.
CS4402 – Parallel Computing
Introduction to MPI Programming
Computer Science Department
Send and Receive.
Collective Communication with MPI
An Introduction to Parallel Programming with MPI
Collective Communication Operations
Send and Receive.
ITCS 4/5145 Parallel Computing, UNC-Charlotte, B
Lecture 14: Inter-process Communication
High Performance Parallel Programming
MPI: Message Passing Interface
Message-Passing Computing More MPI routines: Collective routines Synchronous routines Non-blocking routines ITCS 4/5145 Parallel Computing, UNC-Charlotte,
ITCS 4/5145 Parallel Computing, UNC-Charlotte, B
Computer Science Department
Presentation transcript:

Parallel Programming and Algorithms – MPI Collective Operations David Monismith CS599 Feb. 10, 2015 Based upon MPI: A Message-Passing Interface Standard 3.0 by the Message Passing Interface Forum, Available at

Last Time Introduced MPI and Batch Scripts Discussed Blocking Send/Receive Discussed Collective Message Patterns in Theory

This Time Time for Worksheet 6 Implementation of Collective Message Patterns.

Collective Message Patterns Collective message patterns include patterns such as broadcast, reduce, scatter, and gather. When using a collective function call in MPI, the call must be made in every process in the communicator. For now, we are using MPI_COMM_WORLD as our communicator. Therefore, we will make collective function calls in every process

Broadcast Broadcast is a one-to-all function. Recall that in a broadcast, the same data is sent to every process. MPI’s Broadcast operation is implemented via the use of the MPI_Bcast function. Broadcast must be called in every process.

MPI_Bcast Function signature: MPI_Bcast(buffer, count, dataType, source, comm) buffer – address of buffer (data to send/recv) count – number of items in the buffer dataType – the MPI type of the data in the buffer source – the rank of the process sending the broadcast comm – the communication (often MPI_COMM_WORLD)

Example See bcast.c from the course website This example sends a message from process rank 0 to all other processes.

Gather Gather allows for one process to receive individualized messages from all other processes. That is, gather is an all-to-one function. MPI’s Gather Operation is implemented via the MPI_Gather function. This function allows one process to collect equally sized individualized messages from all other processes.

MPI_Gather Function signature: MPI_Gather(sendBuffer, sendCount, sendType, recvBuffer, recvCount, recvType, rootProcessId, comm) sendBuffer – the data to be sent to the root process sendCount – the number of data items to be sent sendType – the type of the data items to be sent recvBuffer – the buffer in which the data will be stored in the root process (this may be NULL in non-root processes) recvCount – the number of elements for any single receive (must be non-negative and only significant at root) recvType – the data type of elements that will be received rootProcessId – the rank of the receiving process comm – the communicator (e.g. MPI_COMM_WORLD)

Example See gather.c from the examples page on the course website. This example computes the square of N numbers from 0 to N-1 and prints every 100 th square. Squares are divided among M processes such that each process computes M/N squares.

Scatter The scatter operation sends individualized messages from a source process to all other processes. Note that the source process itself receives one of these messages. Scatter is implemented in MPI using the MPI_Scatter function.

MPI_Scatter The function signature for scatter follows: MPI_Scatter(sendBuffer, sendCount, sendType, recvBuffer, recvCount, recvType, source, comm) sendBuffer – starting address of the data to be sent (the entire array) sendCount – the amount of data to send to each process from the source sendType – the type of the data being sent recvBuffer – starting address of the location where data will be received recvCount – the amount of data to receive recvType – the type of data to receive source – the identifier of the process sending the data comm – the communicator (e.g. MPI_COMM_WORLD)

Example See scatter.c on the course examples webpage. This program provides an example of using the scatter function to send equally sized chunks of an array of random integers to all processes. Each process computes and prints the average of its chunk.

Reduce A reduce operation allows us to take many individual values and combine them using an associative operator. Such operators include +, *, min, max, and various logical operators like && and ||. We have seen such operations before in shared memory programming via OpenMP. MPI implements reduce using the MPI_Reduce function and allows for many scalar reductions to be performed in one function call.

MPI_Reduce The function signature for reduce follows: MPI_Reduce(sendBuffer, recvBuffer, count, dataType, operation, root, comm) sendBuffer – starting address of the data to be sent (the entire array) recvBuffer – starting address of the location where data will be received count – the number of reduce results (i.e. the size of the sendBuffer) dataType – the type of data in the send and receive buffers operation – the reduce operation to perform root – the process id that the reduce results will be sent to comm – the communicator (e.g. MPI_COMM_WORLD)

MPI_Reduce Operations MPI_SUM – sum MPI_MIN – minimum MPI_MAX – maximum MPI_PROD – product MPI_LAND – logical and MPI_LOR – logical or MPI_BAND – bitwise and MPI_BOR – bitwise or MPI_LXOR – logical xor MPI_BXOR – bitwise xor

Example See reduce.c on the examples page of the course website. This example performs a scalar sum reduction on 1,000,000,000 integers across multiple processes. Also see reduce3D.c, which performs a 3D sum reduction across 1,000,000,000 3D points. Notice that the reduce operation includes the root process as one of the processes that perform computations.

Next time MPI_Barrier – barrier operation in MPI Other MPI All-to-all communications