Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello I am new to chegg Can you help me start this problem I know I am asking a

ID: 3857433 • Letter: H

Question

Hello I am new to chegg Can you help me start this problem I know I am asking a lot If it's possible step by step so I can learn it and perform it on my own It's for computer science Parallel computing Lab 1: Exercising the use of basic MPI communication functions Attached Files: greetings.c (1.642 KB) Complete the following activities for this lab: Activity 1: Write a MPI program to send an integer x from process 0 to 1. (See Slide 33 of Chapter 2 for the core of the code.) Activity 2: Add to the program so that process 1 broadcast the value it has received from process 0 to all other processes. And then process 2 prints out the received value. Activity 3: Further add to your program, using MPI Reduce function, let process 0 find the sum of the ranks of all the processes. Test your program on different number of processes, e.g., 4 and 8. Submit the source code and a screen snapshot showing the result of running your program at Blackboard Assignment drop box by the due date (Check the schedule). Note: The syntax of MPI send, receive, broadcast, and reduce functions: int MPl_Send(void" buffer in "I int count in /, MPI. Datatype datatype/"in */, int destination /in*/, int tag /"in*/, MPIComm communicatorin */) -

Explanation / Answer

As per your problem mpi program to send integer x from process 0 to 1

We are creating two prototype functions for send and receive function-

MPI_Send(
   void* info,
   int counter,
   MPI_Datatype dtype,
   int destinationpro,
   int atag,
   MPI_Comm comm)

MPI_Recv(
   void* info,
   int counter,
   MPI_Datatype dtype,
   int sourcepro,
   int atag,
   MPI_Comm comm,
   MPI_Status* stat)


int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
int size;
MPI_Comm_size(MPI_COMM_WORLD, &size);

int num;
if (rank == 0) {
   numb = -1;
   MPI_Send(&num, 1, MPI_INT, 1, 0, MPI_COMM_WORLD);
} else if (rank == 1) {
   MPI_Recv(&num, 1, MPI_INT, 0, 0, MPI_COMM_WORLD,
            MPI_STATUS_IGNORE);
   printf("Process 1 provides with number %d from process 0 ",number);
}

Note-For other questions to be answered please provide as separate question.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote