Which code segment should you insert at line 06?

You create a Microsoft Message Passing Interface (MPI) application by using Microsoft Visual C++. You write the following code segment. (Line numbers are included for reference only.)

01 int data;
02 //Assign value to variable data
03 MPI_Request myRequest;
04 MPI_Isend(&data, 1, MPI_INT, 0, 1, MPI_COMM_WORLD, &myRequest);
05 //Other calculations not involving variable data
06 //Alter variable data

You discover that at times, an incorrect value is sent to rank 0. You need to ensure that the variable data is ready to be modified at line 08.
Which code segment should you insert at line 06?

You create a Microsoft Message Passing Interface (MPI) application by using Microsoft Visual C++. You write the following code segment. (Line numbers are included for reference only.)

01 int data;
02 //Assign value to variable data
03 MPI_Request myRequest;
04 MPI_Isend(&data, 1, MPI_INT, 0, 1, MPI_COMM_WORLD, &myRequest);
05 //Other calculations not involving variable data
06 //Alter variable data

You discover that at times, an incorrect value is sent to rank 0. You need to ensure that the variable data is ready to be modified at line 08.
Which code segment should you insert at line 06?

A.
MPI_Cancel(&myRequest);

B.
MPI_Barrier(MPI_COMM_SELF);

C.
MPI_Grequest_complete(myRequest);

D.
MPI_Status status;
MPI_Wait(&myRequest,&status);



Leave a Reply 0

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