Utilities#
2026-03-31
20 min read time
This page provides references for utility types and functions in the ucxx library,
including type definitions, multi-buffer header metadata, exception handling, and
miscellaneous helpers.
Type Definitions#
#include <ucxx/typedefs.h>
namespace ucxx
-
namespace ucxx
Typedefs
-
typedef std::unordered_map<std::string, std::string> ConfigMap#
A UCP configuration map.
A UCP configuration map, with keys being the configuration name and value being the actual value set.
-
typedef std::function<void(ucs_status_t, std::shared_ptr<void>)> RequestCallbackUserFunction#
A user-defined function to execute as part of a
ucxx::Requestcallback.A user-defined function to execute as part of a
ucxx::Requestcallback, allowing execution of custom code upon request completion.
-
typedef std::shared_ptr<void> RequestCallbackUserData#
Data for the user-defined function provided to the
ucxx::Requestcallback.Data passed to the user-defined function provided to the
ucxx::Requestcallback, which the custom user-defined function may act upon.
-
typedef RequestCallbackUserFunction EndpointCloseCallbackUserFunction#
A user-defined function to execute after an endpoint closes.
A user-defined function to execute after an endpoint closes, allowing execution of custom code after such event.
-
typedef RequestCallbackUserData EndpointCloseCallbackUserData#
Data for the user-defined function provided to endpoint close callback.
Data passed to the user-defined function provided to the endpoint close callback, which the custom user-defined function may act upon.
- std::function< std::shared_ptr< Buffer >size_t)> AmAllocatorType
Custom Active Message allocator type.
Type for a custom Active Message allocator that can be registered by a user so that the Active Message receiver can allocate a buffer of such type upon receiving message.
-
typedef std::function<void(std::shared_ptr<Request>, ucp_ep_h)> AmReceiverCallbackType#
Active Message receiver callback.
Type for a custom Active Message receiver callback, executed by the remote worker upon Active Message request completion. The first parameter is the request that completed, the second is the handle of the UCX endpoint of the sender.
-
typedef std::string AmReceiverCallbackOwnerType#
Active Message receiver callback owner name.
A string containing the owner’s name of an Active Message receiver callback. The owner should be a reasonably unique name, usually identifying the application, to allow other applications to coexist and register their own receiver callbacks.
-
typedef uint64_t AmReceiverCallbackIdType#
Active Message receiver callback identifier.
A 64-bit unsigned integer unique identifier type of an Active Message receiver callback.
-
typedef const std::string SerializedRemoteKey#
Serialized form of a remote key.
A string type representing the serialized form of a remote key, used for transmission and storage of remote memory access information.
Enums
-
enum ucxx_log_level_t#
Available logging levels.
Available logging levels that are used to enable specific log types based on user’s configuration and also to define appropriate functions to be used in UCXX code to log only when the appropriate level is enabled.
Values:
-
enumerator UCXX_LOG_LEVEL_FATAL#
-
enumerator UCXX_LOG_LEVEL_ERROR#
-
enumerator UCXX_LOG_LEVEL_WARN#
-
enumerator UCXX_LOG_LEVEL_DIAG#
-
enumerator UCXX_LOG_LEVEL_INFO#
-
enumerator UCXX_LOG_LEVEL_DEBUG#
-
enumerator UCXX_LOG_LEVEL_TRACE#
-
enumerator UCXX_LOG_LEVEL_TRACE_REQ#
-
enumerator UCXX_LOG_LEVEL_TRACE_DATA#
-
enumerator UCXX_LOG_LEVEL_TRACE_ASYNC#
-
enumerator UCXX_LOG_LEVEL_TRACE_FUNC#
-
enumerator UCXX_LOG_LEVEL_TRACE_POLL#
-
enumerator UCXX_LOG_LEVEL_LAST#
-
enumerator UCXX_LOG_LEVEL_PRINT#
-
enumerator UCXX_LOG_LEVEL_FATAL#
-
enum class TransferDirection#
The direction of a UCXX transfer.
The direction of a UCXX transfer, can be either
SendorReceive.Values:
-
enumerator Send#
-
enumerator Receive#
-
enumerator Send#
-
enum Tag#
Strong type for a UCP tag.
Strong type for a UCP tag, preventing accidental mixing with wrong types, especially useful to prevent passing an argument in wrong order.
Values:
-
enum TagMask#
Strong type for a UCP tag mask.
Strong type for a UCP tag mask, preventing accidental mixing with wrong types, especially useful to prevent passing an argument in wrong order.
Values:
Variables
-
class TagRecvInfo#
- #include <typedefs.h>
Information about probed tag message.
Contains information returned when probing by a tag message received by the worker but not yet consumed.
Public Functions
- explicit TagRecvInfo(
- const ucp_tag_recv_info_t &info
Construct a TagRecvInfo object from a UCP tag receive info structure.
- Parameters:
info – [in] The UCP tag receive info structure containing the sender tag and received data length.
-
class AmReceiverCallbackInfo#
- #include <typedefs.h>
Information of an Active Message receiver callback.
Type identifying an Active Message receiver callback’s owner name and unique identifier.
Public Functions
- AmReceiverCallbackInfo(
- AmReceiverCallbackInfo(
- const AmReceiverCallbackOwnerType owner,
- AmReceiverCallbackIdType id
Construct an AmReceiverCallbackInfo object.
- Parameters:
owner – [in] The owner name of the callback.
id – [in] The unique identifier of the callback.
Public Members
-
const AmReceiverCallbackOwnerType owner#
The owner name of the callback.
-
const AmReceiverCallbackIdType id#
The unique identifier of the callback.
-
typedef std::unordered_map<std::string, std::string> ConfigMap#
Header#
The ucxx::Header class provides metadata for multi-buffer transfers, describing
the layout and types of buffers being transferred.
#include <ucxx/header.h>
namespace ucxx
-
class Header#
A serializable object containing metadata of multiple buffers.
A serializable object containing metadata of a pre-defined number of buffers used to inform the remote endpoint of multiple incoming messages from buffers of given properties.
Public Functions
- Header(
- bool next,
- size_t nframes,
- int *isCUDA,
- size_t *size
Constructor of a fixed-size header.
Constructor of a fixed-size header used to transmit pre-defined information about frames that the receiver does not need to know anything about.
This constructores receives a flag
nextindicating whether the next message the receiver should expect is another header (in case the number of frames is larger than the pre-defined size), the number of framesnframesit contains information for, and pointers tonframesarrays of whether each frame is CUDA (isCUDA == true) or host (isCUDA == false) and the sizesizeof each frame in bytes.- Parameters:
next – [in] whether the receiver should expect a next header.
nframes – [in] the number of frames the header contains information for (must be lower or equal than
HeaderFramesSize).isCUDA – [in] array with length
nframescontaining flag of whether each of the frames being transferred are CUDA (true) or host (false).size – [in] array with length
nframescontaining the size in bytes of each frame.
- explicit Header(
- const std::string &serializedHeader
Constructor of a fixed-size header from serialized data.
Reconstruct (i.e., deserialize) a fixed-size header from serialized data.
- Parameters:
serializedHeader – [in] the header in serialized format.
- const std::string serialize(
Get the serialized data.
Get the serialized data ready for transfer.
- Returns:
the serialized data.
Public Members
-
bool next#
Whether there is a next header.
-
size_t nframes#
Number of frames.
-
std::array<int, HeaderFramesSize> isCUDA#
Flag for whether each frame is CUDA or host.
-
std::array<size_t, HeaderFramesSize> size#
Size in bytes of each frame.
Public Static Functions
- static size_t dataSize(
Get the size of the underlying data.
Get the size of the underlying data, in other words, the size of a serialized
ucxx::Headerready for transfer.- Returns:
the size of the underlying data.
- static std::vector<Header> buildHeaders(
- const std::vector<size_t> &size,
- const std::vector<int> &isCUDA
Convenience method to build headers given arbitrary-sized input.
Convenience method to build one or more headers given arbitrary-sized input
sizeandisCUDAvectors.- Parameters:
isCUDA – [in] vector containing flag of whether each frame being transferred are CUDA (
1) or host (0).size – [in] vector containing the size in bytes of eachf frame.
- Returns:
A vector of one or more
ucxx::Headerobjects.
Exceptions#
#include <ucxx/exception.h>
namespace ucxx
-
namespace ucxx
-
class Error : public std::exception#
- #include <exception.h>
The base class for all UCX exceptions.
The base class for all UCX errors that may occur made into C++ exceptions.
Subclassed by ucxx::AlreadyExistsError, ucxx::BufferTooSmallError, ucxx::BusyError, ucxx::CanceledError, ucxx::ConnectionResetError, ucxx::EndpointTimeoutError, ucxx::ExceedsLimitError, ucxx::FirstEndpointFailureError, ucxx::FirstLinkFailureError, ucxx::IOError, ucxx::InvalidAddrError, ucxx::InvalidParamError, ucxx::LastEndpointFailureError, ucxx::LastLinkFailureError, ucxx::MessageTruncatedError, ucxx::NoDeviceError, ucxx::NoElemError, ucxx::NoMemoryError, ucxx::NoMessageError, ucxx::NoProgressError, ucxx::NoResourceError, ucxx::NotConnectedError, ucxx::NotImplementedError, ucxx::OutOfRangeError, ucxx::RejectedError, ucxx::ShmemSegmentError, ucxx::SomeConnectsFailedError, ucxx::TimedOutError, ucxx::UnreachableError, ucxx::UnsupportedError
Public Functions
- inline explicit Error(
- const std::string &msg
The base class constructor.
The base class constructor taking the explanatory string of the error.
- Parameters:
msg – [in] the explanatory string of the error.
- inline const char *what(
Returns an explanatory string.
Returns an explanatory string of the UCX error that has occurred.
- Returns:
the explanatory string.
Private Members
-
std::string _msg = {}#
-
class NoMessageError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_NO_MESSAGE.The exception raised when
UCS_ERR_NO_MESSAGEoccurs in UCX.Public Functions
- inline explicit NoMessageError(
- const std::string &msg
The
UCS_ERR_NO_MESSAGEconstructor.The constructor for an exception raised with
UCS_ERR_NO_MESSAGEoccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class NoResourceError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_NO_RESOURCE.The exception raised when
UCS_ERR_NO_RESOURCEoccurs in UCX.Public Functions
- inline explicit NoResourceError(
- const std::string &msg
The
UCS_ERR_NO_RESOURCEconstructor.The constructor for an exception raised with
UCS_ERR_NO_RESOURCEoccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class IOError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_IO_ERROR.The exception raised when
UCS_ERR_IO_ERRORoccurs in UCX.Public Functions
- inline explicit IOError(
- const std::string &msg
The
UCS_ERR_IO_ERRORconstructor.The constructor for an exception raised with
UCS_ERR_IO_ERRORoccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class NoMemoryError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_NO_MEMORY.The exception raised when
UCS_ERR_NO_MEMORYoccurs in UCX.Public Functions
- inline explicit NoMemoryError(
- const std::string &msg
The
UCS_ERR_NO_MEMORYconstructor.The constructor for an exception raised with
UCS_ERR_NO_MEMORYoccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class InvalidParamError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_INVALID_PARAM.The exception raised when
UCS_ERR_INVALID_PARAMoccurs in UCX.Public Functions
- inline explicit InvalidParamError(
- const std::string &msg
The
UCS_ERR_INVALID_PARAMconstructor.The constructor for an exception raised with
UCS_ERR_INVALID_PARAMoccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class UnreachableError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_UNREACHABLE.The exception raised when
UCS_ERR_UNREACHABLEoccurs in UCX.Public Functions
- inline explicit UnreachableError(
- const std::string &msg
The
UCS_ERR_UNREACHABLEconstructor.The constructor for an exception raised with
UCS_ERR_UNREACHABLEoccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class InvalidAddrError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_INVALID_ADDR.The exception raised when
UCS_ERR_INVALID_ADDRoccurs in UCX.Public Functions
- inline explicit InvalidAddrError(
- const std::string &msg
The
UCS_ERR_INVALID_ADDRconstructor.The constructor for an exception raised with
UCS_ERR_INVALID_ADDRoccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class NotImplementedError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_NOT_IMPLEMENTED.The exception raised when
UCS_ERR_NOT_IMPLEMENTEDoccurs in UCX.Public Functions
- inline explicit NotImplementedError(
- const std::string &msg
The
UCS_ERR_NOT_IMPLEMENTEDconstructor.The constructor for an exception raised with
UCS_ERR_NOT_IMPLEMENTEDoccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class MessageTruncatedError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_MESSAGE_TRUNCATED.The exception raised when
UCS_ERR_MESSAGE_TRUNCATEDoccurs in UCX.Public Functions
- inline explicit MessageTruncatedError(
- const std::string &msg
The
UCS_ERR_MESSAGE_TRUNCATEDconstructor.The constructor for an exception raised with
UCS_ERR_MESSAGE_TRUNCATEDoccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class NoProgressError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_NO_PROGRESS.The exception raised when
UCS_ERR_NO_PROGRESSoccurs in UCX.Public Functions
- inline explicit NoProgressError(
- const std::string &msg
The
UCS_ERR_NO_PROGRESSconstructor.The constructor for an exception raised with
UCS_ERR_NO_PROGRESSoccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class BufferTooSmallError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_BUFFER_TOO_SMALL.The exception raised when
UCS_ERR_BUFFER_TOO_SMALLoccurs in UCX.Public Functions
- inline explicit BufferTooSmallError(
- const std::string &msg
The
UCS_ERR_BUFFER_TOO_SMALLconstructor.The constructor for an exception raised with
UCS_ERR_BUFFER_TOO_SMALLoccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class NoElemError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_NO_ELEM.The exception raised when
UCS_ERR_NO_ELEMoccurs in UCX.Public Functions
- inline explicit NoElemError(
- const std::string &msg
The
UCS_ERR_NO_ELEMconstructor.The constructor for an exception raised with
UCS_ERR_NO_ELEMoccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class SomeConnectsFailedError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_SOME_CONNECTS_FAILED.The exception raised when
UCS_ERR_SOME_CONNECTS_FAILEDoccurs in UCX.Public Functions
- inline explicit SomeConnectsFailedError(
- const std::string &msg
The
UCS_ERR_SOME_CONNECTS_FAILEDconstructor.The constructor for an exception raised with
UCS_ERR_SOME_CONNECTS_FAILEDoccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class NoDeviceError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_NO_DEVICE.The exception raised when
UCS_ERR_NO_DEVICEoccurs in UCX.Public Functions
- inline explicit NoDeviceError(
- const std::string &msg
The
UCS_ERR_NO_DEVICEconstructor.The constructor for an exception raised with
UCS_ERR_NO_DEVICEoccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class BusyError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_BUSY.The exception raised when
UCS_ERR_BUSYoccurs in UCX.Public Functions
- inline explicit BusyError(
- const std::string &msg
The
UCS_ERR_BUSYconstructor.The constructor for an exception raised with
UCS_ERR_BUSYoccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class CanceledError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_CANCELED.The exception raised when
UCS_ERR_CANCELEDoccurs in UCX.Public Functions
- inline explicit CanceledError(
- const std::string &msg
The
UCS_ERR_CANCELEDconstructor.The constructor for an exception raised with
UCS_ERR_CANCELEDoccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class ShmemSegmentError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_SHMEM_SEGMENT.The exception raised when
UCS_ERR_SHMEM_SEGMENToccurs in UCX.Public Functions
- inline explicit ShmemSegmentError(
- const std::string &msg
The
UCS_ERR_SHMEM_SEGMENTconstructor.The constructor for an exception raised with
UCS_ERR_SHMEM_SEGMENToccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class AlreadyExistsError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_ALREADY_EXISTS.The exception raised when
UCS_ERR_ALREADY_EXISTSoccurs in UCX.Public Functions
- inline explicit AlreadyExistsError(
- const std::string &msg
The
UCS_ERR_ALREADY_EXISTSconstructor.The constructor for an exception raised with
UCS_ERR_ALREADY_EXISTSoccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class OutOfRangeError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_OUT_OF_RANGE.The exception raised when
UCS_ERR_OUT_OF_RANGEoccurs in UCX.Public Functions
- inline explicit OutOfRangeError(
- const std::string &msg
The
UCS_ERR_OUT_OF_RANGEconstructor.The constructor for an exception raised with
UCS_ERR_OUT_OF_RANGEoccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class TimedOutError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_TIMED_OUT.The exception raised when
UCS_ERR_TIMED_OUToccurs in UCX.Public Functions
- inline explicit TimedOutError(
- const std::string &msg
The
UCS_ERR_TIMED_OUTconstructor.The constructor for an exception raised with
UCS_ERR_TIMED_OUToccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class ExceedsLimitError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_EXCEEDS_LIMIT.The exception raised when
UCS_ERR_EXCEEDS_LIMIToccurs in UCX.Public Functions
- inline explicit ExceedsLimitError(
- const std::string &msg
The
UCS_ERR_EXCEEDS_LIMITconstructor.The constructor for an exception raised with
UCS_ERR_EXCEEDS_LIMIToccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class UnsupportedError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_UNSUPPORTED.The exception raised when
UCS_ERR_UNSUPPORTEDoccurs in UCX.Public Functions
- inline explicit UnsupportedError(
- const std::string &msg
The
UCS_ERR_UNSUPPORTEDconstructor.The constructor for an exception raised with
UCS_ERR_UNSUPPORTEDoccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class RejectedError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_REJECTED.The exception raised when
UCS_ERR_REJECTEDoccurs in UCX.Public Functions
- inline explicit RejectedError(
- const std::string &msg
The
UCS_ERR_REJECTEDconstructor.The constructor for an exception raised with
UCS_ERR_REJECTEDoccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class NotConnectedError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_NOT_CONNECTED.The exception raised when
UCS_ERR_NOT_CONNECTEDoccurs in UCX.Public Functions
- inline explicit NotConnectedError(
- const std::string &msg
The
UCS_ERR_NOT_CONNECTEDconstructor.The constructor for an exception raised with
UCS_ERR_NOT_CONNECTEDoccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class ConnectionResetError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_CONNECTION_RESET.The exception raised when
UCS_ERR_CONNECTION_RESEToccurs in UCX.Public Functions
- inline explicit ConnectionResetError(
- const std::string &msg
The
UCS_ERR_CONNECTION_RESETconstructor.The constructor for an exception raised with
UCS_ERR_CONNECTION_RESEToccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class FirstLinkFailureError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_FIRST_LINK_FAILURE.The exception raised when
UCS_ERR_FIRST_LINK_FAILUREoccurs in UCX.Public Functions
- inline explicit FirstLinkFailureError(
- const std::string &msg
The
UCS_ERR_FIRST_LINK_FAILUREconstructor.The constructor for an exception raised with
UCS_ERR_FIRST_LINK_FAILUREoccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class LastLinkFailureError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_LAST_LINK_FAILURE.The exception raised when
UCS_ERR_LAST_LINK_FAILUREoccurs in UCX.Public Functions
- inline explicit LastLinkFailureError(
- const std::string &msg
The
UCS_ERR_LAST_LINK_FAILUREconstructor.The constructor for an exception raised with
UCS_ERR_LAST_LINK_FAILUREoccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class FirstEndpointFailureError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_FIRST_ENDPOINT_FAILURE.The exception raised when
UCS_ERR_FIRST_ENDPOINT_FAILUREoccurs in UCX.Public Functions
- inline explicit FirstEndpointFailureError(
- const std::string &msg
The
UCS_ERR_FIRST_ENDPOINT_FAILUREconstructor.The constructor for an exception raised with
UCS_ERR_FIRST_ENDPOINT_FAILUREoccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class EndpointTimeoutError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_ENDPOINT_TIMEOUT.The exception raised when
UCS_ERR_ENDPOINT_TIMEOUToccurs in UCX.Public Functions
- inline explicit EndpointTimeoutError(
- const std::string &msg
The
UCS_ERR_ENDPOINT_TIMEOUTconstructor.The constructor for an exception raised with
UCS_ERR_ENDPOINT_TIMEOUToccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class LastEndpointFailureError : public ucxx::Error#
- #include <exception.h>
The exception for
UCS_ERR_LAST_ENDPOINT_FAILURE.The exception raised when
UCS_ERR_LAST_ENDPOINT_FAILUREoccurs in UCX.Public Functions
- inline explicit LastEndpointFailureError(
- const std::string &msg
The
UCS_ERR_LAST_ENDPOINT_FAILUREconstructor.The constructor for an exception raised with
UCS_ERR_LAST_ENDPOINT_FAILUREoccurs in UCX.- Parameters:
msg – [in] the explanatory string of the error.
-
class Error : public std::exception#
Utility Helpers#
Socket Address Utilities#
#include <ucxx/utils/sockaddr.h>
namespace ucxx::utils
-
namespace ucxx
-
namespace utils#
Functions
- std::unique_ptr<struct addrinfo, void (*)(struct addrinfo*)> get_addrinfo(
- const char *ip_address,
- uint16_t port
Get an addrinfo struct corresponding to an address and port.
This information can later be used to bind a UCP listener or endpoint.
- Parameters:
ip_address – [in] valid socket address (e.g., IP address or hostname) or NULL as a wildcard for “all” to set the socket address storage to.
port – [in] port to set the socket address storage to.
- Returns:
unique pointer wrapping a
struct addrinfo(frees the addrinfo when out of scope)
- void sockaddr_get_ip_port_str(
- const struct sockaddr_storage *sock_addr,
- char *ip_str,
- char *port_str,
- size_t max_str_size
Get socket address and port of a socket address storage.
Get the socket address (usually the IP address) and port from a socket address storage pointer.
- Parameters:
sock_addr – [in] pointer to the socket address storage.
ip_str – [in] socket address (or IP) contained the socket address storage.
port_str – [in] port contained the socket address storage.
max_str_size – [in] size of the
ip_strandport_strstrings.
-
namespace utils#
File Descriptor Utilities#
#include <ucxx/utils/file_descriptor.h>
namespace ucxx::utils
-
namespace ucxx
-
namespace utils
Functions
- FILE *createTextFileDescriptor(
Create a file descriptor from a temporary file.
Create a file descriptor from a temporary file.
- Throws:
std::ios_base::failure – if creating a temporary file fails, a common cause being lack of write permissions to
/tmp.- Returns:
The file descriptor created.
- std::string decodeTextFileDescriptor(
- FILE *textFileDescriptor
Decode text file descriptor.
Decode a text file descriptor and return it as a string.
- Throws:
std::ios_base::failure – if reading the file descriptor fails.
- Returns:
The string with a copy of the file descriptor contents.
-
namespace utils
UCX Wrappers#
#include <ucxx/utils/ucx.h>
namespace ucxx::utils
-
namespace ucxx
-
namespace utils
Functions
- void ucsErrorThrow(
- const ucs_status_t status,
- std::string userMessage = ""
Throw appropriate exception on UCS error.
Throw an exception appropriately mapped from a UCS error. For status
UCS_OKandUCS_INPROGRESSor unknown values, calling this function acts as a no-op. Additionally set themsg_contextstring to a human-readable error message.- Parameters:
status – [in] UCS status for which to check state.
userMessage – [out] user-defined, human-readable error message.
- Throws:
NoMessageError – if
status == UCS_ERR_NO_MESSAGENoResourceError – if
status == UCS_ERR_NO_RESOURCEIOError – if
status == UCS_ERR_IO_ERRORNoMemoryError – if
status == UCS_ERR_NO_MEMORYInvalidParamError – if
status == UCS_ERR_INVALID_PARAMUnreachableError – if
status == UCS_ERR_UNREACHABLEInvalidAddrError – if
status == UCS_ERR_INVALID_ADDRNotImplementedError – if
status == UCS_ERR_NOT_IMPLEMENTEDMessageTruncatedError – if
status == UCS_ERR_MESSAGE_TRUNCATEDNoProgressError – if
status == UCS_ERR_NO_PROGRESSBufferTooSmallError – if
status == UCS_ERR_BUFFER_TOO_SMALLNoElemError – if
status == UCS_ERR_NO_ELEMSomeConnectsFailedError – if
status == UCS_ERR_SOME_CONNECTS_FAILEDNoDeviceError – if
status == UCS_ERR_NO_DEVICEBusyError – if
status == UCS_ERR_BUSYCanceledError – if
status == UCS_ERR_CANCELEDShmemSegmentError – if
status == UCS_ERR_SHMEM_SEGMENTAlreadyExistsError – if
status == UCS_ERR_ALREADY_EXISTSOutOfRangeError – if
status == UCS_ERR_OUT_OF_RANGETimedOutError – if
status == UCS_ERR_TIMED_OUTExceedsLimitError – if
status == UCS_ERR_EXCEEDS_LIMITUnsupportedError – if
status == UCS_ERR_UNSUPPORTEDRejectedError – if
status == UCS_ERR_REJECTEDNotConnectedError – if
status == UCS_ERR_NOT_CONNECTEDConnectionResetError – if
status == UCS_ERR_CONNECTION_RESETFirstLinkFailureError – if
status == UCS_ERR_FIRST_LINK_FAILURELastLinkFailureError – if
status == UCS_ERR_LAST_LINK_FAILUREFirstEndpointFailureError – if
status == UCS_ERR_FIRST_ENDPOINT_FAILUREEndpointTimeoutError – if
status == UCS_ERR_ENDPOINT_TIMEOUTLastEndpointFailureError – if
status == UCS_ERR_LAST_ENDPOINT_FAILURE
-
namespace utils