Program Listing for File cuda_object_handler.hpp
↰ Return to documentation for file (include/holoscan/core/cuda_object_handler.hpp
)
/*
* SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef HOLOSCAN_CORE_CUDA_OBJECT_HANDLER_HPP
#define HOLOSCAN_CORE_CUDA_OBJECT_HANDLER_HPP
#include <cuda_runtime.h>
#include <optional>
#include <string>
#include <vector>
namespace holoscan {
class Operator;
class CudaObjectHandler {
public:
virtual ~CudaObjectHandler() = default;
virtual void init_from_operator(Operator* op) = 0;
virtual int add_stream(const cudaStream_t stream, const std::string& output_port_name) = 0;
virtual cudaStream_t get_cuda_stream(void* context, const std::string& input_port_name,
bool allocate = false, bool sync_to_default = true) = 0;
virtual std::vector<std::optional<cudaStream_t>> get_cuda_streams(
void* context, const std::string& input_port_name) = 0;
virtual int synchronize_streams(std::vector<cudaStream_t> cuda_streams,
cudaStream_t target_stream,
bool sync_to_default_stream = true) = 0;
virtual int release_internal_streams(void* context) = 0;
virtual void clear_received_streams() = 0;
};
} // namespace holoscan
#endif/* HOLOSCAN_CORE_CUDA_OBJECT_HANDLER_HPP */