Public Member Functions | Friends | List of all members
ucxx::RemoteKey Class Reference

Component holding a UCP rkey (remote key). More...

#include <remote_key.h>

Inheritance diagram for ucxx::RemoteKey:
ucxx::Component

Public Member Functions

ucp_rkey_h getHandle ()
 Get the underlying ucp_rkey_h handle. More...
 
size_t getSize () const
 Get the size of the memory allocation. More...
 
uint64_t getBaseAddress ()
 Get the base address of the memory allocation. More...
 
SerializedRemoteKey serialize () const
 Serialize the remote key. More...
 
- Public Member Functions inherited from ucxx::Component
void setParent (std::shared_ptr< Component > parent)
 Set the internal parent reference. More...
 
std::shared_ptr< Component > getParent () const
 Get the internal parent reference. More...
 

Friends

class detail::ConstructorFactory
 

Additional Inherited Members

- Protected Attributes inherited from ucxx::Component
std::shared_ptr< Component > _parent {nullptr}
 A reference-counted pointer to the parent.
 

Detailed Description

Component holding a UCP rkey (remote key).

To provide RMA (Remote Memory Access) to memory handles, UCP packs their information in the form of ucp_rkey_h (remote key, or rkey for short). This class encapsulates that object and provides methods to simplify its handling, both locally and remotely including (de-)serialization for transfers over the wire and reconstruction of the object on the remote process.

Member Function Documentation

◆ getBaseAddress()

uint64_t ucxx::RemoteKey::getBaseAddress ( )

Get the base address of the memory allocation.

Get the base address of the memory allocation the remote key packs, which is going to be used as the remote address to put or get memory via the ucxx::Endpoint::memPutBuilder() or ucxx::Endpoint::memGetBuilder() methods.

// remoteKey is `std::shared_ptr<ucxx::RemoteKey>`
auto remoteMemoryBaseAddress = remoteKey->getBaseAddress();
Returns
The base address of the memory allocation.

◆ getHandle()

ucp_rkey_h ucxx::RemoteKey::getHandle ( )

Get the underlying ucp_rkey_h handle.

Lifetime of the ucp_rkey_h handle is managed by the ucxx::RemoteKey object and its ownership is non-transferrable. Once the ucxx::RemoteKey is destroyed the handle becomes invalid and so does the address to the remote memory handle it points to, it is the user's responsibility to ensure the owner's lifetime while using the handle.

// remoteKey is `std::shared_ptr<ucxx::RemoteKey>`
auto remoteKeyHandle = remoteKey->getHandle();
Returns
The underlying ucp_mem_h handle.

◆ getSize()

size_t ucxx::RemoteKey::getSize ( ) const

Get the size of the memory allocation.

Get the size of the memory allocation the remote key packs, which is at least the number of bytes specified with the size argument passed to memoryHandleBuilder().

// remoteKey is `std::shared_ptr<ucxx::RemoteKey>`
auto remoteMemorySize = remoteKey->getSize();
Returns
The size of the memory allocation.

◆ serialize()

SerializedRemoteKey ucxx::RemoteKey::serialize ( ) const

Serialize the remote key.

Serialize the remote key to allow over-the-wire transfer and subsequent reconstruction of the object in the remote process.

// remoteKey is `std::shared_ptr<ucxx::RemoteKey>`
auto serializedRemoteKey = remoteKey->serialize();
Returns
The serialized remote key.

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