Class BaseSocket
Defined in File BaseSocket.hpp
Inheritance Relationships
Derived Types
public netio3::libfabric::ReceiveSocket
(Class ReceiveSocket)public netio3::libfabric::SendSocket
(Class SendSocket)
Class Documentation
-
class BaseSocket
Provides common functionality for send and receive sockets.
Not meant to be used as a polymorphic base class.
Subclassed by netio3::libfabric::ReceiveSocket, netio3::libfabric::SendSocket
Public Functions
-
inline const Endpoint &get_endpoint() const
Get the endpoint associated with the socket.
- Returns:
A const reference for const objects, non const for non const objects
-
inline CqCmFds get_cq_cm_fds() const
Get the file descriptors of the completion and event queues.
- Returns:
CqCmFds The file descriptors of the completion and event queues
-
inline void set_cq_ev_ctx(EventContext ctx)
Set the event context for the completion queue.
- Parameters:
ctx – Event context containing callback
-
inline void set_eq_ev_ctx(EventContext ctx)
Set the event context for the event queue.
- Parameters:
ctx – Event context containing callback
-
inline const EventContext &get_eq_ev_ctx() const
Get the event context for the event queue.
- Returns:
A const reference to the event context
-
inline const EventContext &get_cq_ev_ctx() const
Get the event context for the completion queue.
- Returns:
A const reference to the event context
Protected Functions
-
inline explicit BaseSocket(Endpoint ep)
Constructs a BaseSocket object with the specified endpoint.
Constructor is protected to prevent users creating an object of the base class.
- Parameters:
ep – The endpoint to associate with the socket
Protected Static Functions
-
static void open_endpoint(const EndPointAddress &address, Endpoint &ep, fid_fabric *fabric, fid_domain *domain, fi_info *info)
Opens the endpoint with the specified address.
Opening the end point is the first step to create a send or receive socket. The procedure is identical for both.
The following functions are called in this order:
fi_eq_open on eq
fi_endpoint
fi_ep_bind on ep
- Throws:
FailedOpenEndpoint – If any operation failed
- Parameters:
address – The address of the endpoint (used for logging/error handling)
ep – The endpoint to open
fabric – The fabric to use for opening the endpoint
domain – The domain to use for opening the endpoint
info – The information about the network
-
static void enable_endpoint(const EndPointAddress &address, Endpoint &ep)
Enables the endpoint with the specified address.
Enabling the end point is the last step to create a send or receive socket. The procedure is identical for both.
The following functions are called in this order:
fi_enable
fi_control
- Throws:
FailedOpenEndpoint – If any operation failed
- Parameters:
address – The address of the endpoint (used for logging/error handling)
ep – The endpoint to enable
-
static fi_cq_attr prepare_cq_attr()
Prepares the completion queue attributes.
Helper function to create open CQ for send and receive sockets.
- Returns:
The prepared completion queue attributes
-
template<BufferConcept BufferType>
static void register_buffer(BufferType &buf, DomainContext &domain, int access_flag) Registers a buffer as a memory region.
Can be used to register both send and receive MRs (defined by access flag). Zero copy send sockets use a dedicated buffer type with the same interface but a different underlying buffer. Therefore, the buffer type is a template argument. The domain is passed to check if too many MRs are registered for the given domain.
- Throws:
LibFabricBufferError – If the buffer could not be registered or too many buffers are registered for this domain
- Template Parameters:
BufferType – The type of the buffer to register (Buffer or ZeroCopyBuffer)
- Parameters:
buf – The buffer to register
domain – The domain context to use for registration
access_flag – The access flag for the buffer (send or receive)
-
template<BufferConcept BufferType>
static void close_buffer(const BufferType &buffer) Unregister the previously registered buffer.
- Template Parameters:
BufferType – The type of the buffer to close (Buffer or ZeroCopyBuffer)
- Parameters:
buffer – The buffer to close
-
inline const Endpoint &get_endpoint() const