NVIDIA DeepStream SDK API Reference

9.1 Release
sources/libs/nvdsinferserver/infer_grpc_backend.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2021-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
27 #ifndef __NVDSINFERSERVER_GRPC_BACKEND_H__
28 #define __NVDSINFERSERVER_GRPC_BACKEND_H__
29 
30 #include "infer_common.h"
31 #include "infer_trtis_backend.h"
32 #include "infer_grpc_client.h"
33 
34 namespace nvdsinferserver {
35 
40 public:
41  TritonGrpcBackend(std::string model, int64_t version);
42  ~TritonGrpcBackend() override;
43 
44  void setOutputs(const std::set<std::string>& names) {
45  m_RequestOutputs = names;
46  }
47  void setUrl (const std::string &url) { m_Url = url;}
48  void setEnableCudaBufferSharing (const bool enableSharing) {
49  m_EnableCudaBufferSharing = enableSharing;
50  }
51  NvDsInferStatus initialize() override;
52 
53 protected:
55  InputsConsumed bufConsumed, InferenceDone inferenceDone) override;
56  void requestTritonOutputNames(std::set<std::string>& names) override;
57 
62  SharedBatchArray inputs, InputsConsumed bufConsumed,
63  AsyncDone asyncDone) override;
64 
65 private:
66  std::string m_Url;
67  std::set<std::string> m_RequestOutputs;
68  std::shared_ptr<nvdsinferserver::InferGrpcClient> m_InferGrpcClient;
69  bool m_EnableCudaBufferSharing = false;
70 };
71 
72 } // namespace nvdsinferserver
73 
74 #endif
nvdsinferserver
This is a header file for pre-processing cuda kernels with normalization and mean subtraction require...
Definition: sources/gst-plugins/gst-nvinferserver/gstnvinferserver_impl.h:69
nvdsinferserver::TritonGrpcBackend::setEnableCudaBufferSharing
void setEnableCudaBufferSharing(const bool enableSharing)
Definition: sources/libs/nvdsinferserver/infer_grpc_backend.h:48
nvdsinferserver::TritonGrpcBackend::initialize
NvDsInferStatus initialize() override
nvdsinferserver::TrtISBackend::model
const std::string & model() const
Definition: sources/libs/nvdsinferserver/infer_trtis_backend.h:78
nvdsinferserver::IBackend::InputsConsumed
std::function< void(SharedBatchArray)> InputsConsumed
Function wrapper called after the input buffer is consumed.
Definition: sources/libs/nvdsinferserver/infer_ibackend.h:75
infer_trtis_backend.h
Header file of Triton Inference Server inference backend.
nvdsinferserver::TrtISBackend
Triton backend processing class.
Definition: sources/libs/nvdsinferserver/infer_trtis_backend.h:44
nvdsinferserver::TritonGrpcBackend::ensureServerReady
NvDsInferStatus ensureServerReady() override
nvdsinferserver::TritonGrpcBackend::requestTritonOutputNames
void requestTritonOutputNames(std::set< std::string > &names) override
nvdsinferserver::SharedBatchArray
std::shared_ptr< BaseBatchArray > SharedBatchArray
Definition: sources/libs/nvdsinferserver/infer_common.h:80
nvdsinferserver::TrtISBackend::AsyncDone
std::function< void(NvDsInferStatus, SharedBatchArray)> AsyncDone
Asynchronous inference done function: AsyncDone(Status, outputs).
Definition: sources/libs/nvdsinferserver/infer_trtis_backend.h:174
nvdsinferserver::TritonGrpcBackend::ensureModelReady
NvDsInferStatus ensureModelReady() override
nvdsinferserver::TritonGrpcBackend::setupLayersInfo
NvDsInferStatus setupLayersInfo() override
nvdsinferserver::TritonGrpcBackend::Run
NvDsInferStatus Run(SharedBatchArray inputs, InputsConsumed bufConsumed, AsyncDone asyncDone) override
nvdsinferserver::TritonGrpcBackend::setOutputs
void setOutputs(const std::set< std::string > &names)
Definition: sources/libs/nvdsinferserver/infer_grpc_backend.h:44
infer_common.h
Header file of the common declarations for the nvinferserver library.
nvdsinferserver::IBackend::InferenceDone
std::function< void(NvDsInferStatus, SharedBatchArray)> InferenceDone
Function wrapper for post inference processing.
Definition: sources/libs/nvdsinferserver/infer_ibackend.h:71
nvdsinferserver::TritonGrpcBackend::enqueue
NvDsInferStatus enqueue(SharedBatchArray inputs, SharedCuStream stream, InputsConsumed bufConsumed, InferenceDone inferenceDone) override
nvdsinferserver::TrtISBackend::version
int64_t version() const
Definition: sources/libs/nvdsinferserver/infer_trtis_backend.h:79
nvdsinferserver::SharedCuStream
std::shared_ptr< CudaStream > SharedCuStream
Cuda based pointers.
Definition: sources/libs/nvdsinferserver/infer_common.h:89
nvdsinferserver::TritonGrpcBackend::~TritonGrpcBackend
~TritonGrpcBackend() override
nvdsinferserver::TritonGrpcBackend::TritonGrpcBackend
TritonGrpcBackend(std::string model, int64_t version)
infer_grpc_client.h
Header file for the gRPC client and request class for inference using the Triton Inference Server....
nvdsinferserver::TritonGrpcBackend::setUrl
void setUrl(const std::string &url)
Definition: sources/libs/nvdsinferserver/infer_grpc_backend.h:47
nvdsinferserver::TritonGrpcBackend
Triton gRPC mode backend processing class.
Definition: sources/libs/nvdsinferserver/infer_grpc_backend.h:39
NvDsInferStatus
NvDsInferStatus
Enum for the status codes returned by NvDsInferContext.
Definition: sources/includes/nvdsinfer.h:231