Toms MPI II Notes
From Education
Contents |
Four Send Modes
- Are we going to use a buffer or not for the sending process?
- How are we doing our synchronization - Ie when can sends and receives start and finish?
4 Blocking Send Modes
- Intersection analogy:
- The standard, the easiest, is the one at the bottom because in some ways it's the hardest to understand, because you can shoot yourself most easily.
- The buffer is a separate one from the storage on the sender and receiver: a third magical buffer.
- Synchronous: Like a stop sign. No buffer. We're both going to wait until we see each other, we're ready to do it, and we do it. The price paid is time. Neither MPI's buffer or your own buffer. How many copies are there? The data only gets copied once.
- Buffered: Many cars can fill the roundabout. The receiver doesn't have to worry about being ready if the sender can just add to the buffer. Then the receiver just reads from the buffer. The price paid is paying for the buffer: some space, but there's an extra copy. You create your own buffer (explicitly defined).
- Ready: When the firetruck is ready to go, it barrels through. People in intersection might get hit. The firetruck says its prepared that everything will be right the way it is. One side rules when it's going to happen.
- Standard: This is the mix between buffered and synchronous using MPI's buffer, because you don't know which, and you don't know how big the buffer is. (Or even whether the buffer is there or not.)
...
- Henry story: The weather people had written code at OSCER, and it ported in first new cluster, and then broke in the next new cluster. When they did everybody send, followed by everybody receive, it didn't work anymore. The MPI document said that they didn't promise that would work (in more detail). If everybody receives, and then everybody sends - will that work? No. Receive is by definition a blocking communication. You're waiting patiently to send while everyone else is waiting patiently for you to send. What if everyone sends and then receives, will that work?
- Buffer - a place to hold stuff temporarily
- You have your own buffer you malloc'ed or whatever, but MPI has its own buffer. If MPI has enough space in buffer for messages everyone is sending, then they will get to other person and MPI send will keep going on and you won't have to wait.
- Buffers: Yours (senders), Its (receivers), and one in the middle (if you want there to be)
- Tom's story: If amount of data you're sending in MPI's buffer fits, then you're going to be able to send and then you can go on. If it doesn't fit, you have to go to synchronous.
- Either you use your buffer, or MPI's buffer. But it's more labor to create your own, so people usually use MPI's.
...Kay had to do other stuff...
Ready
- Like a catcher waiting for the pitcher to be ready.
- No special handshaking to make it synchronous, no extra copy to the buffer. The receiver is waiting and when the sender is ready, the sender sends.
- Receiver doesn't say that go it, or even that it's ready.