HPC Exp1

You might also like

You are on page 1of 3

Experiment No 1

60004190123
Vidhan Shah
CS-B/B3

Aim: Execution of simple Hello world program on MPI platform using Python.
Theory:
Message passing Interface:
The message passing interface (MPI) is a standardized means of exchanging messages
between multiple computers running a parallel program across distributed memory.
In parallel computing, multiple computers – or even multiple processor cores within the same
computer – are called nodes. Each node in the parallel arrangement typically works on a
portion of the overall computing problem. The challenge then is to synchronize the actions of
each parallel node, exchange data between nodes, and provide command and control over the
entire parallel cluster. The message passing interface defines a standard suite of functions for
these tasks. The term message passing itself typically refers to the sending of a message to an
object, parallel process, subroutine, function or thread, which is then used to start another
process.

MPI Platform:
 MPI for Python provides Python bindings for the Message Passing Interface (MPI) standard,
allowing Python applications to exploit multiple processors on workstations, clusters and
supercomputers. This package builds on the MPI specification and provides an object
oriented interface resembling the MPI-2 C++ bindings. It supports point-to-point (sends,
receives) and collective (broadcasts, scatters, gathers) communication of
any picklable Python object, as well as efficient communication of Python objects exposing
the Python buffer interface (e.g. NumPy arrays and builtin bytes/array/memoryview objects).

Code & Output:


!pip install mpi4py

from mpi4py import MPI
import sys
size = MPI.COMM_WORLD.Get_size()
rank = MPI.COMM_WORLD.Get_rank()
name = MPI.Get_processor_name()
sys.stdout.write(
    "Hello, World! I am process %d of %d on %s.\n"
    % (rank, size, name))
Conclusion: Thus, by this experiment we understood the basic working of MPI platform
and implemented Hello World program using Python.

You might also like