Derecho  0.9
Distributed systems toolkit for RDMA
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
rdma::endpoint Class Reference

A C++ wrapper for the libfabric fid_ep struct and its associated functions. More...

#include <lf_helper.hpp>

Inheritance diagram for rdma::endpoint:
Inheritance graph
[legend]
Collaboration diagram for rdma::endpoint:
Collaboration graph
[legend]

Public Member Functions

virtual ~endpoint ()
 
 endpoint (size_t remote_index, bool is_lf_server)
 Constructor Calls the second constructor with an empty lambda as the second argument. More...
 
 endpoint (size_t remote_index, bool is_lf_server, std::function< void(endpoint *)> post_recvs)
 Constructor Initializes members and then calls endpoint::connect. More...
 
 endpoint (endpoint &&)=default
 Constructor Default move constructor. More...
 
int init (struct fi_info *fi)
 init Creates an endpoint, and then initializes/enables it More...
 
void connect (size_t remote_index, bool is_lf_server, std::function< void(endpoint *)> post_recvs)
 connect Uses the initialized endpoint to connect to a remote node More...
 
bool post_send (const memory_region &mr, size_t offset, size_t size, uint64_t wr_id, uint32_t immediate, const message_type &type)
 post_send Uses the libfabrics API to post a buffer to an endpoint. More...
 
bool post_recv (const memory_region &mr, size_t offset, size_t size, uint64_t wr_id, const message_type &type)
 post_recv Uses the libfabrics API to post a buffer to the recv queue of an endpoint. More...
 
bool post_empty_send (uint64_t wr_id, uint32_t immediate, const message_type &type)
 
bool post_empty_recv (uint64_t wr_id, const message_type &type)
 
bool post_write (const memory_region &mr, size_t offset, size_t size, uint64_t wr_id, remote_memory_region remote_mr, size_t remote_offset, const message_type &type, bool signaled=false, bool send_inline=false)
 

Public Attributes

fi_addr_t remote_fi_addr
 

Protected Member Functions

 endpoint ()
 

Protected Attributes

std::unique_ptr< fid_eq, std::function< void(fid_eq *)> > eq
 Smart pointer for managing the endpoint. More...
 
std::unique_ptr< fid_ep, std::function< void(fid_ep *)> > ep
 

Friends

class task
 

Detailed Description

A C++ wrapper for the libfabric fid_ep struct and its associated functions.

Definition at line 157 of file lf_helper.hpp.

Constructor & Destructor Documentation

◆ endpoint() [1/4]

rdma::endpoint::endpoint ( )
inlineexplicitprotected

Definition at line 163 of file lf_helper.hpp.

◆ ~endpoint()

rdma::endpoint::~endpoint ( )
virtual

Definition at line 245 of file lf_helper.cpp.

◆ endpoint() [2/4]

rdma::endpoint::endpoint ( size_t  remote_index,
bool  is_lf_server 
)
explicit

Constructor Calls the second constructor with an empty lambda as the second argument.

Parameters
remote_indexThe id of the remote node.

Definition at line 246 of file lf_helper.cpp.

◆ endpoint() [3/4]

rdma::endpoint::endpoint ( size_t  remote_index,
bool  is_lf_server,
std::function< void(endpoint *)>  post_recvs 
)

Constructor Initializes members and then calls endpoint::connect.

Parameters
remote_indexThe index of the remote node in the group.
is_lf_serverThis parameter decide local role in connection. If is_lf_server is true, it waits on PEP for connection from remote side. Otherwise, it initiate a connection to remote side.
post_recvsA lambda that is called at the end of initializing the endpoints on the client and remote sides to avoid race conditions between post_send() and post_recv().

Definition at line 248 of file lf_helper.cpp.

◆ endpoint() [4/4]

rdma::endpoint::endpoint ( endpoint &&  )
default

Constructor Default move constructor.

Member Function Documentation

◆ connect()

void rdma::endpoint::connect ( size_t  remote_index,
bool  is_lf_server,
std::function< void(endpoint *)>  post_recvs 
)

connect Uses the initialized endpoint to connect to a remote node

Parameters
remote_indexThe index of the remote node in the group.
is_lf_serverThis parameter decide local role in connection. If is_lf_server is true, it waits on PEP for connection from remote side. Otherwise, it initiate a connection to remote side.
post_recvsA lambda that is called at the end of initializing the endpoints on the client and remote sides to avoid race conditions between post_send() and post_recv().

Populate local cm struct and exchange cm info

Connect to remote node

Synchronously read from the passive event queue, init the server ep

TODO document this

TODO document this

TODO document this

Definition at line 309 of file lf_helper.cpp.

◆ init()

int rdma::endpoint::init ( struct fi_info *  fi)

init Creates an endpoint, and then initializes/enables it

Parameters
fiA struct containing information about the current fabric services.

Open an endpoint

Construct the smart pointer to manage the endpoint

Create an event queue

Construct the smart pointer to manage the event queue

Bind endpoint to event queue and completion queue

Definition at line 253 of file lf_helper.cpp.

◆ post_empty_recv()

bool rdma::endpoint::post_empty_recv ( uint64_t  wr_id,
const message_type type 
)

Definition at line 456 of file lf_helper.cpp.

◆ post_empty_send()

bool rdma::endpoint::post_empty_send ( uint64_t  wr_id,
uint32_t  immediate,
const message_type type 
)

Definition at line 441 of file lf_helper.cpp.

◆ post_recv()

bool rdma::endpoint::post_recv ( const memory_region mr,
size_t  offset,
size_t  size,
uint64_t  wr_id,
const message_type type 
)

post_recv Uses the libfabrics API to post a buffer to the recv queue of an endpoint.

Parameters
mrThe wrapper around the memory region that is being posted.
offsetThe offset into the buffer managed by mr.
sizeThe size (in bytes) of the buffer.
wr_idA parameter used to differentiate types of messages.
message_type

Definition at line 420 of file lf_helper.cpp.

◆ post_send()

bool rdma::endpoint::post_send ( const memory_region mr,
size_t  offset,
size_t  size,
uint64_t  wr_id,
uint32_t  immediate,
const message_type type 
)

post_send Uses the libfabrics API to post a buffer to an endpoint.

Parameters
mrThe wrapper around the memory region that is being sent.
offsetThe offset into the buffer managed by mr.
sizeThe size (in bytes) of the buffer being sent.
wr_idA parameter used to differentiate types of messages.
immediateA parameter used only for send operations.
message_type

Definition at line 397 of file lf_helper.cpp.

◆ post_write()

bool rdma::endpoint::post_write ( const memory_region mr,
size_t  offset,
size_t  size,
uint64_t  wr_id,
remote_memory_region  remote_mr,
size_t  remote_offset,
const message_type type,
bool  signaled = false,
bool  send_inline = false 
)

Definition at line 469 of file lf_helper.cpp.

Friends And Related Function Documentation

◆ task

friend class task
friend

Definition at line 165 of file lf_helper.hpp.

Member Data Documentation

◆ ep

std::unique_ptr<fid_ep, std::function<void(fid_ep *)> > rdma::endpoint::ep
protected

Definition at line 161 of file lf_helper.hpp.

◆ eq

std::unique_ptr<fid_eq, std::function<void(fid_eq *)> > rdma::endpoint::eq
protected

Smart pointer for managing the endpoint.

Definition at line 160 of file lf_helper.hpp.

◆ remote_fi_addr

fi_addr_t rdma::endpoint::remote_fi_addr

Definition at line 255 of file lf_helper.hpp.


The documentation for this class was generated from the following files: