Getting Started with MPI - PowerPoint PPT Presentation

About This Presentation
Title:

Getting Started with MPI

Description:

Completion implies that the message has been received at its ... Specification of the method of operation and completion criteria for a communication routine ... – PowerPoint PPT presentation

Number of Views:36
Avg rating:3.0/5.0
Slides: 13
Provided by: ProjectA7
Category:

less

Transcript and Presenter's Notes

Title: Getting Started with MPI


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
  • Point-to-point communication
  • Collective communication
  • Communication mode
  • Blocking send
  • Synchronous send
  • Broadcast
  • Scatter
  • Gather
  • A send routine that does not return until it is
    complete
  • Communication involving one or more groups of
    processes
  • send routine that is not complete until receipt
    of the message at its destination has been
    acknowledged
  • An operation in which one process sends the same
    data to several others
  • Communication involving a single pair of
    processes
  • An operation in which one process distributes
    different elements of a local array to several
    others
  • An operation in which one process collects data
    from several others and assembles them in a local
    array
  • Specification of the method of operation and
    completion criteria for a communication routine

9
Matching Question
  • Correct Answers
  • E
  • B
  • H
  • A
  • C
  • D
  • F
  • G

10
Course Problem
11
Course Problem
  • 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
Write a Comment
User Comments (0)
About PowerShow.com