[ofiwg] fi_msg : Is it possible to receive partial data from the message?
sean.hefty at intel.com
Thu Jan 21 07:30:32 PST 2016
> Therefore I wanted to ask, if there is there any way to:
> 1) Wait for CQ when the message arrives
> 2) Peek the first few bytes (header)
> 3) Then read the entire buffer
Libfabric is message based, not stream based, and buffering is the responsibility of the app. The behavior that you're asking for would result in receive side data copies and is not supported. The receive side buffering must be provided before the send is initiated, or the incoming send will be dropped/truncated.
There are a couple ways to handle this. A less efficient way is to post a bunch of buffers large enough to receive any incoming message. A more efficient way is to use FI_MULTI_RECV to post a single large buffer that will be used to pack received messages into the larger buffer.
There shouldn't be a need to carry the message size in an app header, as the completion will report the size of the message that was received. But if you really need to implement the above behavior, it would need to be done as an abstraction over some method like one mentioned.
More information about the ofiwg