fi_rma(3) Libfabric Programmer's Manual
fi_rma - Remote memory access operations
- fi_read / fi_readv / fi_readmsg
- Initiates a read from remote memory
- fi_write / fi_writev / fi_writemsg
- fi_inject_write / fi_writedata
- Initiate a write to remote memory
- Fabric endpoint on which to initiate read or write operation.
- Local data buffer to read into (read target) or write from (write source)
- Length of data to read or write, specified in bytes. Valid transfers are from 0 bytes up to the endpoint’s max_msg_size.
- Vectored data buffer.
- Count of vectored data entries.
- Address of remote memory to access.
- Protection key associated with the remote memory.
- Descriptor associated with the local data buffer
- Remote CQ data to transfer with the operation.
- Destination address for connectionless write transfers. Ignored for connected endpoints.
- Source address to read from for connectionless transfers. Ignored for connected endpoints.
- Message descriptor for read and write operations.
- Additional flags to apply for the read or write operation.
- User specified pointer to associate with the operation.
RMA (remote memory access) operations are used to transfer data directly between a local data buffer and a remote data buffer. RMA transfers occur on a byte level granularity, and no message boundaries are maintained.
The write functions – fi_write, fi_writev, fi_writemsg, fi_inject_write, and fi_writedata – are used to transmit data into a remote memory buffer. The main difference between write functions are the number and type of parameters that they accept as input. Otherwise, they perform the same general function.
The read functions – fi_read, fi_readv, and fi_readmsg – are used to transfer data from a remote memory region into local data buffer(s). Similar to the write operations, read operations operate asynchronously. Users should not touch the posted data buffer(s) until the read operation has completed.
Completed RMA operations are reported to the user through one or more completion queues associated with the endpoint. Users provide context which are associated with each operation, and is returned to the user as part of the completion. See fi_cq for completion event details.
By default, the remote endpoint does not generate an event or notify the user when a memory region has been accessed by an RMA read or write operation. However, immediate data may be associated with an RMA write operation. RMA writes with immediate data will generate a completion entry at the remote endpoint, so that the immediate data may be delivered.
The call fi_write transfers the data contained in the user-specified data buffer to a remote memory region. The local endpoint must be connected to a remote endpoint or destination before fi_write is called. Unless the endpoint has been configured differently, the data buffer passed into fi_write must not be touched by the application until the fi_write call completes asynchronously.
The fi_writev call adds support for a scatter-gather list to fi_write. The fi_writev transfers the set of data buffers referenced by the iov parameter to the remote memory region.
The fi_writemsg call supports data transfers over both connected and unconnected endpoints, with the ability to control the write operation per call through the use of flags. The fi_writemsg function takes a struct fi_msg_rma as input.
The write inject call is an optimized version of fi_write. The fi_inject_write function behaves as if the FI_INJECT transfer flag were set, and FI_COMPLETION were not. That is, the data buffer is available for reuse immediately on returning from from fi_inject_write, and no completion event will be generated for this write. The completion event will be suppressed even if the endpoint has not been configured with FI_COMPLETION. See the flags discussion below for more details.
The write data call is similar to fi_write, but allows for the sending of remote CQ data (see FI_REMOTE_CQ_DATA flag) as part of the transfer.
The fi_read call requests that the remote endpoint transfer data from the remote memory region into the local data buffer. The local endpoint must be connected to a remote endpoint or destination before fi_read is called.
The fi_readv call adds support for a scatter-gather list to fi_read. The fi_readv transfers data from the remote memory region into the set of data buffers referenced by the iov parameter.
The fi_readmsg call supports data transfers over both connected and unconnected endpoints, with the ability to control the read operation per call through the use of flags. The fi_readmsg function takes a struct fi_msg_rma as input.
The fi_readmsg and fi_writemsg calls allow the user to specify flags which can change the default data transfer operation. Flags specified with fi_readmsg / fi_writemsg override most flags previously configured with the endpoint, except where noted (see fi_endpoint). The following list of flags are usable with fi_readmsg and/or fi_writemsg.
- Applies to fi_writemsg and fi_writedata. Indicates that remote CQ data is available and should be sent as part of the request. See fi_getinfo for additional details on FI_REMOTE_CQ_DATA.
- Indicates that a completion entry should be generated for the specified operation. The endpoint must be bound to an event queue with FI_COMPLETION that corresponds to the specified operation, or this flag is ignored.
- Indicates that the user has additional requests that will immediately be posted after the current call returns. Use of this flag may improve performance by enabling the provider to optimize its access to the fabric hardware.
- Applies to fi_writemsg. Indicates that the outbound data buffer should be returned to user immediately after the write call returns, even if the operation is handled asynchronously. This may require that the underlying provider implementation copy the data into a local buffer and transfer out of that buffer.
- Applies to fi_writemsg. Indicates that a completion should be generated when the source buffer(s) may be reused.
- Applies to fi_writemsg. Indicates that a completion should not be generated until the operation has been successfully transmitted and is no longer being tracked by the provider.
- Indicates that the requested operation, also known as the fenced operation, be deferred until all previous operations targeting the same target endpoint have completed.
Returns 0 on success. On error, a negative value corresponding to fabric
errno is returned. Fabric errno values are defined in
- Indicates that the underlying provider currently lacks the resources needed to initiate the requested operation. This may be the result of insufficient internal buffering, in the case of FI_INJECT, or processing queues are full. The operation may be retried after additional provider resources become available, usually through the completion of currently outstanding operations.