Class SendSocketZeroCopy

Inheritance Relationships

Base Type

Class Documentation

class SendSocketZeroCopy : public netio3::libfabric::SendSocket

Represents a send socket for zero-copy data transmission.

This class extends the SendSocket class and provides functionality for sending data over the network without copying data. Therefore, two buffers are allocated: The memory region which contains the data (e.g. a DMA buffer) and the header buffer which contains the header information like the tag and other user data. Compared to buffered sending, this is necessary because the data is not copied to a buffer before sending.

The header buffer is registered as a single memory region but contains several slots that can be used to store header information. Only the relevant part is send over the network.

The key that is returned to the user on the on_send_complete callback is the same as the one which is passed to the send_data function.

Public Functions

SendSocketZeroCopy(EndPointAddress address, const ConnectionParameters &connection_params, NetworkMode mode, fid_fabric *fabric, DomainContext &domain)

Constructs a SendSocketZeroCopy object.

The constructor calls the constructor of the base class creating the endpoint. It then allocates the header buffer and registers the header buffer and the memory region specified in the connection parameters as MRs.

Parameters:
  • address – The endpoint address to which the socket will send data

  • connection_params – The connection parameters containing the address of the MR

  • mode – The network mode to be used for communication (TCP or RDMA)

  • fabric – The network fabric (used to create endpoint)

  • domain – The send domain (used to create endpoint)

SendSocketZeroCopy(const SendSocketZeroCopy&) = delete
SendSocketZeroCopy(SendSocketZeroCopy&&) = delete
SendSocketZeroCopy &operator=(const SendSocketZeroCopy&) = delete
SendSocketZeroCopy &operator=(SendSocketZeroCopy&&) = delete
~SendSocketZeroCopy()

Destroys the SendSocketZeroCopy object.

Unregister the buffers.

inline auto operator<=>(const SendSocketZeroCopy &other) const
NetioStatus send_data(std::span<std::uint8_t> data, std::span<const std::uint8_t> header_data, std::uint64_t key)

Sends an array of data without copying.

Parameters:
  • data – The data to send

  • header_data – The header data associated with the data

  • key – The key to be returned on completion callback

Returns:

The status of the send operation

NetioStatus send_data(std::span<const iovec> iov, std::span<const std::uint8_t> header_data, std::uint64_t key)

Sends an array of data without copying.

Requests a header slot to store the header data and prepend the header data to the vector of iovs before sending. This means header data will be prepended to the message. The data need to be in the registered memory region. The return value indicates whether the send operation was successful. A maximum of NUM_HEADER_SLOTS send operations can happen in parallel.

Parameters:
  • iov – The vector of iovec structures representing the data to send

  • header_data – The header data associated with the data

  • key – The key to be returned on completion callback

Returns:

The status of the send operation

std::uint64_t release_buffer(std::uint64_t bufnum)

Marks a slot in the header buffer as available for reuse.

Parameters:

bufnum – The buffer number to release

Returns:

The key corresponding to the buffer number

std::size_t get_num_available_buffers()

Retrieves the number of available slots in the header buffer.

Returns the mininum number of available buffers since the last call to this function.

Returns:

The number of available buffers

std::vector<std::uint64_t> get_pending_sends()

Retrieves the keys of pending send operations.

To be called when the connection is closed to notify that these sends will not complete

Returns:

The keys of pending send operations