Question 12 Let us assume that there are only two processes and all data are set up for the communication and that the initialize() function is well defined to initialize the content of array a and b....


Question 12<br>Let us assume that there are only two processes and all data are set up for the communication and<br>that the initialize() function is well defined to initialize the content of array a and b.<br>Read the following communication part of a MPI program :<br>int a[10], b[5], my_rank;<br>MPI_Status status;<br>initialize(a, b, 10); // initialize the array a and b<br>MPI Comm_rank(MPI_COMM_WORLD, &my_rank);<br>if (my_rank == 0){<br>MPI_Send(a, 10, MPI_INT, 1, 1, MPI_COMM_WORLD);<br>MPI_Send(b, 5, MPI_INT, 1, 2, MPI_COMM_WORLD);<br>else if (my rank == 1) {<br>MPI_Recv(b, 5, MPI_INT, 0, 1, MPI COMM_WORLD, MPI_STATUS_IGNORE);<br>MPI Recv(a, 10, MPI_INT, 0, 2, MPI_ COMM_WORLD, MPI_STATUS_IGNORE):<br>Which statement is correct?<br>O The code can't be executed correctly since the specified number of elements to receive in the process of rank<br>1 is smaller than the number of sending items by the process of rank 0.<br>O The code can't be executed correctly since the sending or receiving buffers are not set correctly.<br>O The code can't be executed correctly since the message tags are not correct.<br>O The code is correct.<br>

Extracted text: Question 12 Let us assume that there are only two processes and all data are set up for the communication and that the initialize() function is well defined to initialize the content of array a and b. Read the following communication part of a MPI program : int a[10], b[5], my_rank; MPI_Status status; initialize(a, b, 10); // initialize the array a and b MPI Comm_rank(MPI_COMM_WORLD, &my_rank); if (my_rank == 0){ MPI_Send(a, 10, MPI_INT, 1, 1, MPI_COMM_WORLD); MPI_Send(b, 5, MPI_INT, 1, 2, MPI_COMM_WORLD); else if (my rank == 1) { MPI_Recv(b, 5, MPI_INT, 0, 1, MPI COMM_WORLD, MPI_STATUS_IGNORE); MPI Recv(a, 10, MPI_INT, 0, 2, MPI_ COMM_WORLD, MPI_STATUS_IGNORE): Which statement is correct? O The code can't be executed correctly since the specified number of elements to receive in the process of rank 1 is smaller than the number of sending items by the process of rank 0. O The code can't be executed correctly since the sending or receiving buffers are not set correctly. O The code can't be executed correctly since the message tags are not correct. O The code is correct.

Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here