Date post: | 06-Jan-2017 |
Category: |
Software |
Upload: | mohit-raghuvanshi |
View: | 123 times |
Download: | 4 times |
MPI - MESSAGE PASSING INTERFACEAn approach for parallel algorithms
COMPUTER SCIENCE DEPARTMENT
PROF. AKHTAR RASOOLUNDER THE GUIDANCE OF
TABLE OF CONTENTParallel Merge Sort using MPI
Introduction
Background
MPI
Code implementation
Result
About UsGoal and VisionTarget
Programming language ClusterMPI libraryDataset
What is MPIData type and syntaxCommunication ModeFeatures
Merge sort implementationFlow of code Process flow
Single processorMultiprocessorSummery
About Us
Our Team
Nishaant Sharma131112226
Kartik131112265
Mohit Raghuvanshi131112232
Prabhash Prakash131112241
“Analysis of Running Time complexity of Sorting Algorithm (Merge Sort) on parallel processing
environment (preferably on a cluster with various processors) and single node Using MPI”
Goal
05
Installation Implementation Result
Install mpich2 on Ubantu Implement merge sort algorithm parallel
Change in time when we increse in the number of processor
VISIONWrite your relevant text here
06
Background
Programming languageBase of project
good knowledge of “C” for implementing codeC for implementing the algorithm Python for generating the data setFaker library in python
11
Background
ClusterMaster and Slave Node
Master Node
Slave Node
11
Background
MPI Message passing interface
MPI is a proposed standard message-passing interface. It is a library Specification, not a language. The programs that users can write in Fortran 77 and C are compiled with Ordinary compilers and linked with the MPI library.
11
Dataset
Python Script For generating dataset
We use faker module for generating the dataset of census.Some basic api of faker
fake.name() for generating fake namefake.email() for generating fake email fake.ean(length=13) for unique id of 13 digitfake.job() for creating fake jobMany other api
11
Dataset
Python Script For generating dataset
Dataset attributeId NamePhone Number SalaryEmail
11
Dataset preview
12
What is MPI
MPIMessage Passing Interface
A message-passing library specifications:Extended message-passing modelNot a language or compiler specificationNot a specific implementation or product
For parallel computers, clusters, and heterogeneous networks.Designed to permit the development of parallel software libraries.Designed to provide access to advanced parallel hardware for
End usersLibrary writersTool developers
13
Communication ModesBased on the type of send:
Synchronous: Completes once the acknowledgement is received by the sender.Buffered send: completes immediately, unless if an error occurs.Standard send: completes once the message has been sent, which may or may not imply that the message has arrived at its destination.Ready send: completes immediately, if the receiver is ready for the message it will get it, otherwise the message is dropped silently.
Data TypesThe following data types are supported by MPI:
Predefined data types that are corresponding to data types from the programming language.Arrays.Sub blocks of a matrixUser defined data structure.A set of predefined data types
API of MPI#include “mpi.h” provides basic MPI definitions and types.
MPI_Init starts MPI
MPI_Finalize exits MPI
Note that all non-MPI routines are local; thus “printf” run on each process
Note: MPI functions return error codes or MPI_SUCCESS
MPI_INIT
Initializing MPI
The initialization routine MPI_INIT is the first MPI routine called.
MPI_INIT is called once.
int MPI_INIT( int *argc, char **argv );
MPI_Finalize
After a program has finished using the MPI library, it must call MPI_Finalize in order to clean up all MPI state. Once this routine is called, no MPI routine may be called.
MPI_finalize is genrally last command in the program.
MPI_finalize()
MPI_Comm_rank
It updates the rank of processes in the variable world_rank. Determines the rank of the calling process in the communicator
int MPI_Comm_rank(MPI_COMM_WORLD, &wordld_rank);
MPI_Comm_size
Determines the size of the group associated with a communicator.
int MPI_Comm_size(MPI_COMM comm, int *size);
MPI_Scatter
Sends data from one process to all other processes in a communicator.
. int MPI_Scatter(const void *sendbuf, int sendcount, MPI_Datatype sendtype,void
*recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm);
MPI_Scatter
MPI_Gather
MPI_Gather is opposite of MPI_Scatter, it gather all the data from other processes to single (Master) process.
. int MPI_Gather(const void *sendbuf, intsendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm)
MPI_Gather
MPI_Bcast
Broadcasts a message from the process with rank "root" to all other processes of the communicator.
int MPI_Bcast( void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm )
MPI_Bcast
Parallel Merge Sort Algorithm
Result
No. of Process Time elapsed in reading
input file(ms)Time elapsed to sort
the data(ms)Time in writing output file(ms)
1 3982.326 8528.112 5839.587
2 4050.897 6878.000 5401.234
4 8145.740 12073.895 11083.125
5 10178.689 14361.952 13087.155
Conclusion
In this project we focused on using MPI as a message passing interface
implementation on LINUX platform. The effect of parallel processes number and
also the number of cores on the performance of parallel merge sort
algorithms has been theoretically and experimentally studied.
Thank You