You are on page 1of 3

Reg No : 19BCE2028

Name :
Pratham Shah
Slot : L47+L48

Exercise 4 (MPI -I)

SCENARIO – I

Construct a MPI program to print a Hello World message in the terminal.

MPI is a message passing interface system which facilitates the processors which have
distributed memory architecture to communicate and send & receive messages.

You are asked to use MPI_init() and MPI_Finalize() methods to implement the program.

ALGORITHM:

1. Initialise using MPI_Init() with null values.


2. Print Hello World
3. End using MPI_Finalize()

SOURCE CODE:
Reg No : 19BCE2028
Name :
Pratham Shah
Slot : L47+L48

OUTPUT SCREEN SHOT:

RESULTS: “Hello World” was printed using the message passing interface.

SCENARIO – II

• Construct a MPI program to print rank of the processor, size of the domain(group)
and name of the processor/domain in the terminal.
• MPI is a message passing interface system which facilitates the processors which
have distributed memory architecture to communicate and send & receive
messages.
• You are asked to use MPI_Comm_rank(), MPI_Comm_size(),
MPI_Get_processor_name() methods

BRIEF ABOUT YOUR APPROACH:

1. Intialise using MPI_Init()


2. Declare rank, size, name length
3. Use MPI_Comm_size to get size, MPI_Comm_rank to get number of processors,
MPI_Get_processor_name to get running process name.

SOURCE CODE:
Reg No : 19BCE2028
Name :
Pratham Shah
Slot : L47+L48

OUTPUT :

RESULTS: Using in built MPI functions, we could see and print rank, size, processor
name.

You might also like