Govind 4
Govind 4
Practical-04
Aim: Demonstrate MPI function through a simple program.
What is MPI ?
MPI (Message Passing Interface) is a standardized and portable message-passing system designed
to enable parallel computing across multiple processors or nodes in a distributed computing
environment. It is widely used in high-performance computing (HPC) to allow programs to run
efficiently on supercomputers and clusters.
MPI enables communication between processes in a parallel system, whether they are running on
the same machine or across a network of computers.
MPI_Comm_size – Retrieves the total number of processes participating in the MPI program.
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD,
&size_Of_Cluster);
MPI_Comm_rank(MPI_COMM_WORLD,
&process_Rank);
printf("Hello World from process %d of %d\n", process_Rank,
size_Of_Cluster);
MPI_Finalize();
return 0;
}
Out put:
Conclusion:
MPI (Message Passing Interface) provides an efficient way to implement parallel programming in
Linux-based systems. By using MPI functions, multiple processes can communicate and work
together to solve complex computational problems.