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

A wrapper for fi_close. More...

#include <lf_helper.hpp>

Collaboration diagram for rdma::memory_region:
Collaboration graph
[legend]

Public Member Functions

 memory_region (size_t size)
 Constructor Creates a buffer of the specified size and then calls the second constructor with the new buffer as an argument. More...
 
 memory_region (char *buffer, size_t size)
 Constructor Registers a memory region using the specified buffer and size. More...
 
uint64_t get_key () const
 get_key Returns the key associated with the registered memory region, which is used to access the region. More...
 
 memory_region (size_t size)
 
 memory_region (char *buffer, size_t size)
 
uint32_t get_rkey () const
 

Public Attributes

char *const buffer
 
const size_t size
 

Private Member Functions

 memory_region (size_t size, bool contiguous)
 

Private Attributes

std::unique_ptr< fid_mr, std::function< void(fid_mr *)> > mr
 Smart pointer for managing the registered memory region. More...
 
std::unique_ptr< char[]> allocated_buffer
 Smart pointer for managing the buffer the mr uses. More...
 
std::unique_ptr< ibv_mr, std::function< void(ibv_mr *)> > mr
 

Friends

class endpoint
 
class task
 
class queue_pair
 

Detailed Description

A wrapper for fi_close.

A C++ wrapper for the IB Verbs ibv_mr struct.

The previous way this was done used a lambda and std::function, but that incurs the overhead of type-erasure A C++ wrapper for the libfabric fid_mr struct. Registers a memory region for the provided buffer on construction, and deregisters it on destruction.

Registers a memory region for the provided buffer on construction, and deregisters it on destruction. Instances of this class can only be created after global Verbs initialization has been run, since it depends on the global Verbs resources.

Definition at line 53 of file lf_helper.hpp.

Constructor & Destructor Documentation

◆ memory_region() [1/5]

rdma::memory_region::memory_region ( size_t  size)

Constructor Creates a buffer of the specified size and then calls the second constructor with the new buffer as an argument.

Memory region constructors and member functions.

Parameters
sizeThe size in bytes of the buffer to be associated with the memory region.

Definition at line 203 of file lf_helper.cpp.

◆ memory_region() [2/5]

rdma::memory_region::memory_region ( char *  buffer,
size_t  size 
)

Constructor Registers a memory region using the specified buffer and size.

Parameters
bufferThe allocated memory that will be registered.
sizeThe size in bytes of the buffer to be associated with the memory region.

Register the memory, use it to construct a smart pointer

Definition at line 207 of file lf_helper.cpp.

◆ memory_region() [3/5]

rdma::memory_region::memory_region ( size_t  size,
bool  contiguous 
)
private

Definition at line 525 of file verbs_helper.cpp.

◆ memory_region() [4/5]

rdma::memory_region::memory_region ( size_t  size)

◆ memory_region() [5/5]

rdma::memory_region::memory_region ( char *  buffer,
size_t  size 
)

Member Function Documentation

◆ get_key()

uint64_t rdma::memory_region::get_key ( ) const

get_key Returns the key associated with the registered memory region, which is used to access the region.

Definition at line 226 of file lf_helper.cpp.

◆ get_rkey()

uint32_t rdma::memory_region::get_rkey ( ) const

Definition at line 533 of file verbs_helper.cpp.

Friends And Related Function Documentation

◆ endpoint

friend class endpoint
friend

Definition at line 59 of file lf_helper.hpp.

◆ queue_pair

friend class queue_pair
friend

Definition at line 45 of file verbs_helper.hpp.

◆ task

task
friend

Definition at line 60 of file lf_helper.hpp.

Member Data Documentation

◆ allocated_buffer

std::unique_ptr< char[]> rdma::memory_region::allocated_buffer
private

Smart pointer for managing the buffer the mr uses.

Definition at line 57 of file lf_helper.hpp.

◆ buffer

char *const rdma::memory_region::buffer

Definition at line 88 of file lf_helper.hpp.

◆ mr [1/2]

std::unique_ptr<ibv_mr, std::function<void(ibv_mr*)> > rdma::memory_region::mr
private

Definition at line 41 of file verbs_helper.hpp.

◆ mr [2/2]

std::unique_ptr<fid_mr, std::function<void(fid_mr *)> > rdma::memory_region::mr
private

Smart pointer for managing the registered memory region.

Definition at line 55 of file lf_helper.hpp.

◆ size

const size_t rdma::memory_region::size

Definition at line 89 of file lf_helper.hpp.


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