Holoscan SDK v3.10.0

Class UcxContext

Base Type

class UcxContext : public holoscan::gxf::GXFNetworkContext

UCX-based NetworkContext class used by distributed applications.

Application authors do not need to use this class directly. It will be initialized by the application at runtime as needed.

==Parameters==

  • entity_serializer (std::shared_ptr<UcxEntitySerializer>): The entity serializer that will be used for any network connections (i.e. add_flow connections between fragments). A UcxEntitySerializer will be used by default.

  • reconnect (bool, optional): Try to reconnect if a connection is closed during run (default: true).

  • cpu_data_only (bool, optional): This flag should be set to true on a system which does not have any (visible) CUDA capable devices.

  • enable_async (bool, optional): If false, synchronous operation of message transmission will be used (Default: false). The HOLOSCAN_UCX_ASYNCHRONOUS environment variable can be used to set the value that Holoscan will use for this parameter when creating its internal UcxNetworkContext. This parameter is deprecated in Holoscan v3.7 and will be removed in v4.0. The new behavior will be equivalent to a value of false here.

  • shutdown_timeout_ms (uint64_t, optional): Timeout in milliseconds for shutdown operations such as thread joins and pending request cancellation (default: 2000). The HOLOSCAN_UCX_SHUTDOWN_TIMEOUT_MS environment variable can be used to override this value.

Public Functions

template<typename ArgT, typename ...ArgsT, typename = std::enable_if_t<!std::is_base_of_v<::holoscan::NetworkContext, std::decay_t<ArgT>> && (std::is_same_v<::holoscan::Arg, std::decay_t<ArgT>> || std::is_same_v<::holoscan::ArgList, std::decay_t<ArgT>>)>>
inline explicit UcxContext(ArgT &&arg, ArgsT&&... args)
UcxContext() = default
inline virtual const char *gxf_typename() const override

Get the type name of the GXF network context.

The returned string is the type name of the GXF network context and is used to create the GXF network context.

Example: “nvidia::holoscan::UcxContext”

Returns

The type name of the GXF network context.

inline std::shared_ptr<UcxEntitySerializer> entity_serializer()
virtual void setup(ComponentSpec &spec) override

Define the network context specification.

Parameters

spec – The reference to the component specification.

virtual void initialize() override

Initialize the network context.

This function is called after the network context is created by holoscan::Fragment::make_network_context().

nvidia::gxf::UcxContext *get() const
void initiate_shutdown()

Initiates graceful shutdown of UCX connections.

Sets the shutting_down_ flag and signals TX/RX threads to exit. This allows pending operations to complete within the shutdown timeout rather than blocking indefinitely.

Call this early in the shutdown sequence (before stop_execution()) to ensure UCX threads exit cleanly and connection errors during shutdown are treated as expected rather than fatal.

bool is_shutting_down() const

Check if shutdown has been initiated.

Returns

true if shutdown is in progress

Previous Class UcxComponentSerializer
Next Class UcxEntitySerializer
© Copyright 2022-2026, NVIDIA. Last updated on Feb 2, 2026