Escolar Documentos
Profissional Documentos
Cultura Documentos
What Is MPI?
Stand for Message Passing Interface. It is a library of functions that you insert into source code to perform data communication between processes. Each processor runs a process. Processes communicate by exchanging messages.
Goals Of MPI
Message Passing
It is a type of communication between processes. It is a form of communication used in parallel programming. Communications are completed by sending of messages to recipients.
Initializes MPI. Terminates MPI. Determines the number of processes. Determines the label of calling process. Sends a message. Receives a message.
Header File:
All Subprogram that contains calls to MPI subroutine must include the MPI header file.
In C: #include<mpi.h>
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 Communicator: Default Communicator is MPI_COMM_WORLD Communicator Size: C: MPI_Comm_size(MPI_Comm comm, int *size)
Communicator Rank:
MPI_Send
int MPI_Send(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm)
MPI_Recv
int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int source, int tag,MPI_Comm comm, MPI_Status *status)
MPI Finalize
MPI_Finalize();
This function should be called once at the end of the MPI program.
A MPI program(c)
#include mpi.h #include <stdio.h> int main(int argc, char *argv[]) { MPI_Init(&argc, &argv); printf(Hello, world!\n); MPI_Finalize(); Return 0; }
THANK YOU