Which code segment should you use?

You develop a parallel application that will be deployed on a Windows HPC Server 2008 cluster.The application uses point-to-point communication.

The process that has a rank 0 sends an array of integer values to the rank 1 process by using the following code segment. (Line numbers are included for reference only.)

01 int values[5];
02 MPI_Send(values, 5, MPI_INT, 1, 42,
03 MPI_COMM_WORLD);

You need to ensure that each receiving process is able to correctly receive the values in the most efficient manner possible.
Which code segment should you use?

You develop a parallel application that will be deployed on a Windows HPC Server 2008 cluster.The application uses point-to-point communication.

The process that has a rank 0 sends an array of integer values to the rank 1 process by using the following code segment. (Line numbers are included for reference only.)

01 int values[5];
02 MPI_Send(values, 5, MPI_INT, 1, 42,
03 MPI_COMM_WORLD);

You need to ensure that each receiving process is able to correctly receive the values in the most efficient manner possible.
Which code segment should you use?

A.
int values[5];
int buffer[5];
MPI_Reduce(buffer, values, 5, MPI_INT, MPI_SUM, 1, MPI_COMM_WORLD);

B.
int values[5];
MPI_Status status;
MPI_Recv(values, 5, MPI_INT, 0, 42, MPI_COMM_WORLD, &status);

C.
int value;
MPI_Status status;
MPI_Recv(&value, 1, MPI_INT, 0, 42, MPI_COMM_WORLD, &status);

D.
int values[5];
MPI_Status status;
MPI_Recv(values, sizeof(int), MPI_INT, 0, 42, MPI_COMM_WORLD, &status);



Leave a Reply 0

Your email address will not be published. Required fields are marked *