> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/holoscan/sdk-user-guide/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/holoscan/sdk-user-guide/_mcp/server.

# holoscan::GPUResidentDeck

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

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

```cpp showLineNumbers={false}
#include <holoscan/gpu_resident_deck.hpp>
```

---

## Constructors

### GPUResidentDeck \[#gpuresidentdeck]

```cpp showLineNumbers={false}
holoscan::GPUResidentDeck::GPUResidentDeck()
```

### Destructor \[#destructor]

### \~GPUResidentDeck

```cpp showLineNumbers={false}
holoscan::GPUResidentDeck::~GPUResidentDeck()
```

---

## Methods

### launch\_cuda\_graph \[#launchcudagraph]

```cpp showLineNumbers={false}
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 \[#datareadydeviceaddress]

```cpp showLineNumbers={false}
void * holoscan::GPUResidentDeck::data_ready_device_address()
```

### result\_ready\_device\_address \[#resultreadydeviceaddress]

```cpp showLineNumbers={false}
void * holoscan::GPUResidentDeck::result_ready_device_address()
```

### tear\_down\_device\_address \[#teardowndeviceaddress]

```cpp showLineNumbers={false}
void * holoscan::GPUResidentDeck::tear_down_device_address()
```

### timeout\_ms \[#timeoutms]

```cpp showLineNumbers={false}
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 \[#resultready]

```cpp showLineNumbers={false}
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 \[#teardown]

```cpp showLineNumbers={false}
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 \[#setdataready]

```cpp showLineNumbers={false}
void holoscan::GPUResidentDeck::set_data_ready()
```

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

### is\_launched \[#islaunched]

```cpp showLineNumbers={false}
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

| Name                        | Type                                                             | Description                                                                                                |
| --------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| `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_t`                                                   | RAII 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).             |