Site Tools


probing-mpi

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

probing-mpi [June 11, 2026 at 09:10] – created - external edit 127.0.0.1probing-mpi [June 11, 2026 at 09:15] (current) Ivan Janevski
Line 1: Line 1:
 # Probing for messages (MPI) # Probing for messages (MPI)
-A standard `recv()` on a socket requires a pre-allocated buffer. If the incoming message is larger than the buffer, data gets truncated or the call fails. The POSIX escape hatch is `MSG_PEEK`: pass it as a flag and `recv()` fills your buffer but leaves the data in the socket queue, letting you inspect the size before committing to a real receive. `ioctl(fd, FIONREAD, &n)` goes further and tells you exactly how many bytes are waiting. MPI's `MPI_Probe` does the same thing: it matches an incoming message and fills an `MPI_Status` struct with metadata — including the element count — without consuming the message from the queue.+A standard `recv()` on a socket requires a pre-allocated buffer. If the incoming message is larger than the buffer, data gets truncated or the call fails. The POSIX escape hatch is `MSG_PEEK`: pass it as a flag and `recv()` fills your buffer but leaves the data in the socket queue, letting you inspect the size before committing to a real receive. `ioctl(fd, FIONREAD, &n)` goes further and tells you exactly how many bytes are waiting. 
 + 
 +MPI's `MPI_Probe` does the same thing: it matches an incoming message and fills an `MPI_Status` struct with metadata — including the element count — without consuming the message from the queue.
  
 ```c ```c
probing-mpi.1781169013.txt.gz · Last modified: by 127.0.0.1