holoscan::GPUResidentDeck

Beta
View as Markdown

GPU-resident deck is the CPU-side software component that is responsible for communication with the asynchronously running GPU-resident CUDA workload.

#include <holoscan/gpu_resident_deck.hpp>

Constructors

GPUResidentDeck

holoscan::GPUResidentDeck::GPUResidentDeck()holoscan::GPUResidentDeck::GPUResidentDeck()

Destructor

~GPUResidentDeck

holoscan::GPUResidentDeck::~GPUResidentDeck()holoscan::GPUResidentDeck::~GPUResidentDeck()

Methods

launch_cuda_graph

std::future<void> holoscan::GPUResidentDeck::launch_cuda_graph(
cudaGraphExec_t graph
)

This function launches an executable CUDA graph asynchronously.

Returns: std::future<void> A future that will be set when the CUDA graph has finished executing.

Parameters

graph
cudaGraphExec_t

The executable CUDA graph to launch asynchronously.

data_ready_device_address

void * holoscan::GPUResidentDeck::data_ready_device_address()

result_ready_device_address

void * holoscan::GPUResidentDeck::result_ready_device_address()

tear_down_device_address

void * holoscan::GPUResidentDeck::tear_down_device_address()

timeout_ms

void holoscan::GPUResidentDeck::timeout_ms(
unsigned long long timeout_ms
)

Sets the timeout for the GPU-resident CUDA graph execution.

If timeout is zero, then the asynchronous execution will wait until an external tear down is triggered.

Parameters

timeout_ms
unsigned long long

The timeout in milliseconds.

result_ready

bool holoscan::GPUResidentDeck::result_ready()

Indicates whether the result of a single iteration of the GPU-resident CUDA graph is ready or not.

Returns: true if the result is ready, false otherwise.

tear_down

void holoscan::GPUResidentDeck::tear_down()

Sends a tear down signal to the GPU-resident CUDA graph.

The timeout has to be set to zero for this to work for now. In the future, we will support ignoring the timeout when tear down is triggered.

set_data_ready

void holoscan::GPUResidentDeck::set_data_ready()

This function informs GPU-resident CUDA graph that the data is ready for the main workload.

is_launched

bool holoscan::GPUResidentDeck::is_launched() const

Indicates whether the GPU-resident CUDA graph has been launched.

Returns: true if the CUDA graph has been launched, false otherwise.


Member variables

NameTypeDescription
cpu_data_ready_trigger_std::shared_ptr< holoscan::utils::cuda::CudaHostMappedBuffer >We create three different status buffers to track :
cpu_result_ready_trigger_std::shared_ptr< holoscan::utils::cuda::CudaHostMappedBuffer >
cpu_tear_down_trigger_std::shared_ptr< holoscan::utils::cuda::CudaHostMappedBuffer >
execution_stream_cudaStream_tRAII for cudaStream_t is not being used here, as we specifically keep track of the streams in this class.
status_stream_cudaStream_t
timeout_ms_unsigned long long
graph_launched_std::atomic< bool >Atomic variable to track whether the CUDA graph has been launched (true) or torn down (false).