Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given the following body of code describing the Divide process in MPI = = = = = CODE BEGINS = = = = = #include

Given the following body of code describing the Divide process in MPI
===== CODE BEGINS =====
#include
#include
#include
#include "mpi.h"
int main(int argc, char * argv[]){
int rank, size;
int i; /* counter */
int distance; /* distance between sender and receiver */
MPI_Init(&argc,&argv);
MPI_Comm_rank(MPI_COMM_WORLD,&rank);
MPI_Comm_size(MPI_COMM_WORLD,&size);
distance =1;
i =1;
while (distance <= size /2){
if (rank < distance){
printf ("At time step %d, sender %d sends to %d
", i, rank, rank + distance);
}
if ((rank >= distance) && (rank < distance *2)){
printf ("At time step %d, receiver %d receives from %d
", i, rank, rank - distance);
}
distance = distance *2;
i +=1;
}
MPI_Finalize();
return 0;
}
===== CODE ENDS =====
The program compiled correctly and is run with 16 processes.
When distance =4, in process 9's output to screen from printf showing that it receives data from which process?
5
0
13
nothing

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database System

Authors: Elmasri Ramez And Navathe Shamkant

7th Edition

978-9332582705

More Books

Students also viewed these Databases questions

Question

What is the purpose of a costbenefit analysis?

Answered: 1 week ago