Presentation is loading. Please wait.

Presentation is loading. Please wait.

Getting Started with MPI Self Test with solution.

Similar presentations


Presentation on theme: "Getting Started with MPI Self Test with solution."— Presentation transcript:

1 Getting Started with MPI Self Test with solution

2 Self Test Is a blocking send necessarily also synchronous? –Yes –No

3 Self Test Yes –Incorrect - a synchronous send may be either blocking or nonblocking. Remember that the communication mode ("synchronous") implies a condition for the send to be complete (in this case, that the message is in the process of being received at its destination). A blocking synchronous send does not return until this condition is satisfied. A nonblocking synchronous send returns immediately, and you would then test later to check whether the completion condition has actually been satisfied. No –That's correct!

4 Self Test Consider the following fragment of MPI pseudo- code:... x = fun(y) MPI_SOME_SEND(the value of x to some other processor) x = fun(z)... where MPI_SOME_SEND is a generic send routine. In this case, it would be best to use … –A blocking send –A nonblocking send

5 Self Test A blocking send –Correct! This insures that the send is complete, and thus that it is safe to overwrite x on the sending processor. With a non-blocking send, there is no guarantee that the send will be complete before the subsequent update of x occurs. The value of x actually sent is thus unpredictable. A nonblocking send –Incorrect. Remember that a non-blocking send returns immediately, before the send has necessarily completed. In this case, the contents of x might be changed by the following statement before the send actually occurs. To insure that the correct value of x is sent in this case, use a blocking send. An alternative would be to use a non-blocking send and add code to test for the completion of the send before actually updating x.

6 Self Test Which of the following is true for all send routines? –It is always safe to overwrite the sent variable(s) on the sending processor after the send returns. –Completion implies that the message has been received at its destination. –It is always safe to overwrite the sent variable(s) on the sending processor after the send is complete. –All of the above. –None of the above.

7 Self Test It is always safe to overwrite the sent variable(s) on the sending processor after the send is complete. –Correct

8 Matching Question 1.Point-to-point communication 2.Collective communication 3.Communication mode 4.Blocking send 5.Synchronous send 6.Broadcast 7.Scatter 8.Gather a)A send routine that does not return until it is complete b)Communication involving one or more groups of processes c)send routine that is not complete until receipt of the message at its destination has been acknowledged d)An operation in which one process sends the same data to several others e)Communication involving a single pair of processes f)An operation in which one process distributes different elements of a local array to several others g)An operation in which one process collects data from several others and assembles them in a local array h)Specification of the method of operation and completion criteria for a communication routine

9 Matching Question Correct Answers 1.E 2.B 3.H 4.A 5.C 6.D 7.F 8.G

10 Course Problem

11 The initial problem implements a parallel search of an extremely large (several thousand elements) integer array. The program finds all occurrences of a certain integer, called the target, and writes all the array indices where the target was found to an output file. In addition, the program reads both the target value and all the array elements from an input file. Before writing a parallel version of a program, first write a serial version (that is, a version that runs on one processor). That is the task for this chapter. You can use C/C++ and should confirm that the program works by using a test input array.

12 Solution If you wish to confirm that these results are correct, you can run the serial code shown above using the input file "b.data". The results obtained from running this code are in the file "found.data" which contains the following: 62 183 271 291 296


Download ppt "Getting Started with MPI Self Test with solution."

Similar presentations


Ads by Google