Skip to content
Snippets Groups Projects
Commit 0c175054 authored by Chao Zhan's avatar Chao Zhan
Browse files

update slides

parent c6aaa5b4
No related branches found
No related tags found
No related merge requests found
slides/images/buffered-mode.png

15.7 KiB

slides/images/standard-mode.png

16 KiB

slides/images/synchronous-mode.png

16.5 KiB

...@@ -625,3 +625,117 @@ title: Non-Blocking Request Testing 2 ...@@ -625,3 +625,117 @@ title: Non-Blocking Request Testing 2
Use **MPI_STATUSES_IGNORE** to ignore status from -all/-some operations. Use **MPI_STATUSES_IGNORE** to ignore status from -all/-some operations.
See live demo. See live demo.
---
title: Communication Modes
---
## Communication Modes
Four send modes:
- **Standard**
- **Synchronous**
- **Buffered**
- _Ready_
Only one receive mode: **Synchronous**
Send modes differ in the relation between the **completion of the operation** and the **actual message transfer**
---
title: Send Modes I
---
### Standard Mode
The call blocks until the message has **either** been transferred or **copied** to an internal buffer for later delivery.
Representative: <span class="text-rose-500 font-bold">MPI_Send</span>
<div class="container flex justify-center mt-5">
<img src="/images/standard-mode.png" class="block w-lg"/>
</div>
---
title: Send Modes II
---
### Synchronous Mode
The call blocks until a matching receive has been posted and the message reception has started.
Representative: <span class="text-rose-500 font-bold">MPI_Ssend</span>
<div class="container flex justify-center mt-5">
<img src="/images/synchronous-mode.png" class="block w-lg"/>
</div>
---
title: Send Modes III
---
### Buffered Mode
The call blocks until the message has been copied to a user-supplied buffer. Actual transmission may happen at a later point
Representative: <span class="text-rose-500 font-bold">MPI_Bsend</span>
<div class="container flex justify-center mt-5">
<img src="/images/buffered-mode.png" class="block w-lg"/>
</div>
---
title: Send Modes IV
---
### Ready Mode (Don't use)
The operation succeeds only if a matching receive has already been posted.
Behaves as standard send in every other aspect
Representative: <span class="text-rose-500 font-bold">MPI_Rsend</span>
**Advice**: avoid using this function unless you are 100% sure of what you are doing. It's error-prone.
---
title: Send Modes Calls
---
**These modes can be combined with the concept of blocking and non-blocking:**
- **MPI_Send**: blocking standard send
- **MPI_Isend**: non-blocking standard send
- **MPI_Ssend**: blocking synchronous send
- **MPI_Issend**: non-blocking synchronous send
- **MPI_Bsend**: blocking buffered send
- **MPI_Ibsend**: non-blocking buffered send
- **MPI_Rsend**: blocking ready-mode send
- **MPI_Irsend**: non-blocking ready-mode send
**Buffered operations** require an explicitly provided user buffer using:
- **MPI_Buffer_attach (void \*buf, int size)**
- **MPI_Buffer_detach (void \*buf, int \*size)**
- Buffer size must also consider the envelope size (**MPI_BSEND_OVERHEAD**)
---
title: Caveats on Send Modes
---
## Caveats
One rarely needs anything else except the standard send.
The synchronous send can be used to synchronise two ranks.
**Simple correctness check:**
- Replacing all blocking standard sends with blocking synchronous sends should not result in deadlock
- If program deadlocks, you are relying on the buffering behaviour (implementation-specific) of the standard send -> change your algorithm
**Common Pitfalls**:
- Pass pointers to pointers in MPI calls.
- Use flat multidimensional arrays, arrays of pointers do not work.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment