Collective Communications-Message Passing Interface Library-Lecture Slides, Slides of Microprocessor and Interfacing

This lecture is related to Message Passing Interface Library concepts. its helpful for Parallel Computing students. It was delivered by Dr. Hanif Durad at Pakistan Institute of Engineering and Applied Sciences, Islamabad (PIEAS). It includes: Collective, Communications, Master, Slave, Paradigm, Parallelism, MPI, Synchronization, Data, Movement, Limitations

Typology: Slides

2011/2012

Uploaded on 07/19/2012

zahraa
zahraa 🇵🇰

6 documents

1 / 99

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Dr. Hanif Durad 2
Lecture Outline
Collective Communication
First Program using Collective communication
The Master- Slave Paradigm
Multiplying a matrix with a vector
IntroMPI.ppt
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63

Partial preview of the text

Download Collective Communications-Message Passing Interface Library-Lecture Slides and more Slides Microprocessor and Interfacing in PDF only on Docsity!

Dr. Hanif Durad^

2

Lecture Outline  Collective Communication  First Program using Collective communication  The Master- Slave Paradigm  Multiplying a matrix with a vector

IntroMPI.ppt

Another Approach to Parallelism  Collective routines provide a higher-level way toorganize a parallel program  Each process executes the same communicationoperations  MPI provides a rich set of collectiveoperations…

Dr. Hanif Durad^

IntroMPI.ppt^3

Collective Communication (1/2)  MPI_BCAST  MPI_SCATTER  MPI_SCATTERV  MPI_GATHER  MPI_GATHERV  MPI_ALLGATHER  MPI_ALLGATHERV  MPI_ALLTOALL

pp2003\lecture4.ppt

Dr. Hanif Durad

Collective Communication (2/2)  MPI_ALLTOALLV  MPI_REDUCE  MPI_ALLREDUCE  MPI_SCAN  MPI_REDUCE_SCATTER  MPI_OP_CREAT  MPI_BARRIER

pp2003\lecture4.ppt

Dr. Hanif Durad

Example of MPI_BCAST#include “mpi.h”int main( int argc, char* argv[] ){ int rank;int ibuf;MPI_Init( &argc, &argv );MPI_Comm_rank( MPI_COMM_WORLD, &rank );if(rank == 0) ibuf = 12345;else ibuf = 0;MPI_Bcast(&ibuf, 1, MPI_INTEGER, 0, MPI_COMM_WORLD);printf(“ibuf = %d\n”, ibuf);MPI_Finalize();}

bcast.c Dr. Hanif Durad

broadcast(data,…);^ source^ data

  • group members

Comm.ppt

Dr. Hanif Durad

Example of MPI_SCATTER ( 1/2)#include “mpi.h”int main( int argc, char* argv[] ){ int i;int rank, nproc;int isend[3], irecv;MPI_Init( &argc, &argv );MPI_Comm_size( MPI_COMM_WORLD, &nproc );MPI_Comm_rank( MPI_COMM_WORLD, &rank );if(rank == 0) {for(i=0; i<nproc; i++)isend(i) = i+1;}^

scatter.c Dr. Hanif Durad

Example of MPI_SCATTER ( 2/2)MPI_Scatter( isend, 1, MPI_INTEGER, irecv, 1, MPI_INTEGER, 0,MPI_COMM_WORLD);printf(“irecv = %d\n”, irecv);MPI_Finalize();}

Dr. Hanif Durad

MPI_SCATTERV^ ^ Usage^ ^ int MPI_Scatterv( void* sendbuf,

/* in /int sendcounts,^ /* in /int displs, /* in /MPI_Datatype sendtype,^ / in /void recvbuf,^ /* in /int recvcount, / in /MPI_Datatype recvtype,^ / in /int root, / in /MPI_Comm comm);^ / in */

^ Description^ ^ Distributes individual messages from root to each process incommunicator^ ^ Messages can have different sizes and displacements

Example ofMPI_SCATTERV(1/2)#include “mpi.h”int main( int argc, char* argv[] ){ int i;int rank, nproc;int iscnt[3] = {1,2,3}, irdisp[3] = {0,1,3};int isend[6] = {1,2,2,3,3,3}, irecv[3];MPI_Init( &argc, &argv );MPI_Comm_size( MPI_COMM_WORLD, &nproc );MPI_Comm_rank( MPI_COMM_WORLD, &rank );ircnt = rank + 1;

scatterv.c Dr. Hanif Durad

Dr. Hanif Durad

MPI_GATHER^ ^ Usage^ ^ int MPI_Gather( void* sendbuf,

/* in */ int sendcount,^

/* in */ MPI_Datatype sendtype,

/* in / void recvbuf,^

/* out */ int recvcount,^

/* in */ MPI_Datatype recvtype,

/* in */ int root,^

/* in */ MPI_Comm comm );

/* in */

^ Description^ ^ Collects individual messages from each process in communicatorto the root process and store them in rank order

Dr. Hanif Durad

Example of MPI_GATHER (2/2)if(rank == 0) {for(i=0; i<3; i++)printf(“irecv = %d\n”, irecv[i]);MPI_Finalize();}

Dr. Hanif Durad

gather(…)^ dest concatenationdual of scatter

Comm.ppt

  • group members