Class SendSocket

Inheritance Relationships

Base Type

Derived Types

Class Documentation

class SendSocket : public netio3::libfabric::BaseSocket

Represents a socket for sending data using the Libfabric library.

The SendSocket class is a derived class of BaseSocket and provides further functionality for sending data using the Libfabric library. It encapsulates the creation of the endpoint and provides general functionality for sending data. The derived classes need to implement the registration of send buffers and format of the data. It is not meant to be used as a polymorphic base class.

Subclassed by netio3::libfabric::SendSocketBuffered, netio3::libfabric::SendSocketZeroCopy

Public Functions

inline const EndPointAddress &get_address() const

Returns the address of the socket.

Returns:

The address of the socket

Protected Functions

SendSocket(EndPointAddress address, NetworkMode mode, fid_fabric *fabric, fid_domain *domain)

Constructs a SendSocket object.

The constructor creates the endpoint. The constructor is protected to prevent users from creating an object of the base class.

Calls the following libfabric functions:

  • fi_connect on the ep

  • fi_control on the ep

Throws:

FailedOpenSendEndpoint – in case of a libfabric error

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

  • 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)

void init()

Connects the endpoint.

Connects the endpoint after buffers have been allocated. Called during construction.

inline NetioStatus send_data(iovec data, fid_mr *mr, std::uint64_t key) const

Sends data using the Libfabric library.

Helper function to send a single iovec. See send_data for more information.

Parameters:
  • data – The data to be sent

  • mr – The memory region associated with the data

  • key – The key associated with the memory region

Returns:

NetioStatus indicating the success or failure of the send operation

NetioStatus send_data(std::span<const iovec> data, std::span<fid_mr*> mrs, std::uint64_t key) const

Sends data using the using libfabric.

This function sends data using fi_sendmsg. It takes data as a span of iovecs. The data must already be in a registered memory region. The key passed in will be stored as context on the completion event to be provided in the on_send_completed callback. It returns a NetioStatus indicating the success or failure of the send operation.

Parameters:
  • data – The span of iovec structures representing the data to be sent

  • mrs – The memory regions associated with the data

  • key – The key associated with the send operation

Returns:

NetioStatus indicating the success or failure of the send operation