Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Parallel Matrix-Vector Multiplication using MPI: Communication and Computation Steps, Slides of Parallel Computing and Programming

An in-depth analysis of parallel matrix-vector multiplication using mpi (message passing interface). It covers the main communication and computation steps, time complexity, and advanced mpi routines such as send and receive messages, collective communication operations, and predefined reduction operations. It is useful for university students studying parallel computing, distributed systems, or advanced programming courses.

Typology: Slides

2011/2012

Uploaded on 07/23/2012

paramita
paramita 🇮🇳

4.6

(15)

126 documents

1 / 13

Toggle sidebar

Related documents


Partial preview of the text

Download Parallel Matrix-Vector Multiplication using MPI: Communication and Computation Steps and more Slides Parallel Computing and Programming in PDF only on Docsity! Quiz # 05 Total Marks 10 Time 10 minutes On a MPI machine, using 1-D row-wise partitioning , Multiply a m x n matrix with n x 1 vector using p processors where m> p and m mod p= 0 a) List the main communication and computation steps in correct order along with time complexity of each step. b) Hence give the total time complexity of all above steps. docsity.com Parallel Matrix_Vector Multiplication: Data Decomposition/Partitoning Approaches • Parallel Matrix-Vector Multiplication – 1_D partitioning • p = n • p < n – 2_D partitioning • p = n • p < n docsity.com Advanced MPI-Routines • Send and Receive Operations • Collective Communication operations • Topologies and Embedding • Groups & Communication domain split docsity.com Revisit MPI Sending and Receiving Messages • The basic functions for sending and receiving messages in MPI are the MPI_Send & MPI_Recv, respectively. • The calling sequences of these routines are as follows: int MPI_Send(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int source, int tag,MPI_Comm comm, MPI_Status *status) • MPI provides equivalent datatypes for all C datatypes. This is done for portability reasons. • The datatype MPI_BYTE corresponds to a byte (8 bits) and MPI_PACKED corresponds to a collection of data items that has been created by packing non-contiguous data. • The message-tag can take values ranging from zero up to the MPI defined constant MPI_TAG_UB. docsity.com Sending and Receiving Messages Simultaneously To exchange messages, MPI provides the following function: int MPI_Sendrecv(void *sendbuf, int sendcount,MPI_Datatype senddatatype,int dest, int sendtag,void *recvbuf, int recvcount, MPI_Datatype recvdatatype, int source, int recvtag, MPI_Comm comm, MPI_Status *status) The arguments include arguments to the send and receive functions. If we wish to use the same buffer for both send and receive, we can use: int MPI_Sendrecv_replace(void *buf,int count, MPI_Datatype datatype, int dest, int sendtag, int source, int recvtag, MPI_Comm comm, MPI_Status *status) docsity.com Predefined Reduction Operations Operation Meaning Datatypes MPI_MAX Maximum C integers and floating point MPI_MIN Minimum C integers and floating point MPI_SUM Sum C integers and floating point MPI_PROD Product C integers and floating point MPI_LAND Logical AND C integers MPI_BAND Bit-wise AND C integers and byte MPI_LOR Logical OR C integers MPI_BOR Bit-wise OR C integers and byte MPI_LXOR Logical XOR C integers MPI_BXOR Bit-wise XOR C integers and byte MPI_MAXLOC max-min value-location Data-pairs MPI_MINLOC min-min value-location Data-pairs docsity.com Collective Communication Operations • If the result of the reduction operation is needed by all processes, MPI provides: int MPI_Allreduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) • To compute prefix-sums, MPI provides: int MPI_Scan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm) docsity.com Collective Communication Operations • The gather operation is performed in MPI using: int MPI_Gather(void *sendbuf, int sendcount, MPI_Datatype senddatatype, void *recvbuf, int recvcount, MPI_Datatype recvdatatype, int target, MPI_Comm comm) • MPI also provides the MPI_Allgather function in which the data are gathered at all the processes. int MPI_Allgather(void *sendbuf,intsendcount, MPI_Datatype senddatatype, void *recvbuf, int recvcount, MPI_Datatype recvdatatype, MPI_Comm comm) • The corresponding scatter operation is: int MPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype senddatatype, void *recvbuf, int recvcount, MPI_Datatype recvdatatype, int source, MPI_Comm comm) docsity.com
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved