NVIDIA DeepStream SDK API Reference

9.1 Release
sources/libs/nvdsinferserver/infer_common.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2020-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 
25 #ifndef __NVDSINFERSERVER_COMMON_H__
26 #define __NVDSINFERSERVER_COMMON_H__
27 
28 #include <dlfcn.h>
29 #include <inttypes.h>
30 #include <pthread.h>
31 #include <stdarg.h>
32 #include <string.h>
33 #include <unistd.h>
34 
35 #include <algorithm>
36 #include <cassert>
37 #include <condition_variable>
38 #include <future>
39 #include <map>
40 #include <mutex>
41 #include <set>
42 #include <shared_mutex>
43 #include <sstream>
44 #include <stdexcept>
45 #include <string>
46 #include <thread>
47 #include <unordered_map>
48 
49 #include <infer_datatypes.h>
50 #include <infer_defines.h>
51 
52 namespace nvdsinferserver {
53 
54 class BaseBatchBuffer;
55 class BaseBatchArray;
56 class RefBatchBuffer;
57 
58 class SysMem;
59 class CudaStream;
60 class CudaEvent;
61 class CudaTensorBuf;
62 
63 class IPreprocessor;
64 class IPostprocessor;
65 class IBackend;
66 class BasePreprocessor;
67 class BasePostprocessor;
68 class BaseBackend;
69 
70 class TrtISBackend;
71 
76 using SharedBatchBuf = std::shared_ptr<BaseBatchBuffer>;
77 using UniqBatchBuf = std::unique_ptr<BaseBatchBuffer>;
78 using SharedOptions = std::shared_ptr<IOptions>;
79 
80 using SharedBatchArray = std::shared_ptr<BaseBatchArray>;
81 using UniqBatchArray = std::unique_ptr<BaseBatchArray>;
82 using SharedRefBatchBuf = std::shared_ptr<RefBatchBuffer>;
89 using SharedCuStream = std::shared_ptr<CudaStream>;
90 using UniqCuStream = std::unique_ptr<CudaStream>;
91 using SharedCuEvent = std::shared_ptr<CudaEvent>;
92 using UniqCuEvent = std::unique_ptr<CudaEvent>;
93 using SharedSysMem = std::shared_ptr<SysMem>;
94 using UniqSysMem = std::unique_ptr<SysMem>;
95 using UniqCudaTensorBuf = std::unique_ptr<CudaTensorBuf>;
96 using SharedCudaTensorBuf = std::shared_ptr<CudaTensorBuf>;
103 using UniqPostprocessor = std::unique_ptr<BasePostprocessor>;
104 using UniqPreprocessor = std::unique_ptr<BasePreprocessor>;
105 
106 using UniqTrtISBackend = std::unique_ptr<TrtISBackend>;
113 using UniqLock = std::unique_lock<std::mutex>;
114 
115 class DlLibHandle;
116 using SharedDllHandle = std::shared_ptr<DlLibHandle>;
117 
118 template <typename T>
119 using UniqTritonT = std::unique_ptr<T, std::function<void(T*)>>;
120 
121 template <typename T>
122 using ShrTritonT = std::shared_ptr<T>;
123 
124 class TrtISServer;
125 class TrtServerAllocator;
126 using TrtServerPtr = std::shared_ptr<TrtISServer>;
127 
128 using UniqTritonAllocator = std::unique_ptr<TrtServerAllocator>;
129 using ShrTritonAllocator = std::shared_ptr<TrtServerAllocator>;
130 using WeakTritonAllocator = std::weak_ptr<TrtServerAllocator>;
131 
132 class LstmController;
133 using UniqLstmController = std::unique_ptr<LstmController>;
134 
135 class StreamManager;
136 using UniqStreamManager = std::unique_ptr<StreamManager>;
143 class InferExtraProcessor;
144 using UniqInferExtraProcessor = std::unique_ptr<InferExtraProcessor>;
146 using InferCustomProcessorPtr = std::shared_ptr<IInferCustomProcessor>;
149 } // namespace nvdsinferserver
150 
151 #endif
nvdsinferserver::StreamManager
Definition: sources/libs/nvdsinferserver/infer_stream_manager.h:31
nvdsinferserver::IInferCustomProcessor
Interface of Custom processor which is created and loaded at runtime through CreateCustomProcessorFun...
Definition: sources/includes/nvdsinferserver/infer_custom_process.h:39
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::UniqCuStream
std::unique_ptr< CudaStream > UniqCuStream
Definition: sources/libs/nvdsinferserver/infer_common.h:90
nvdsinferserver::UniqTritonAllocator
std::unique_ptr< TrtServerAllocator > UniqTritonAllocator
Definition: sources/libs/nvdsinferserver/infer_common.h:128
nvdsinferserver::TrtISServer
Wrapper class for creating Triton Inference Server instance.
Definition: sources/libs/nvdsinferserver/infer_trtis_server.h:538
nvdsinferserver::SharedDllHandle
std::shared_ptr< DlLibHandle > SharedDllHandle
Definition: sources/libs/nvdsinferserver/infer_common.h:116
nvdsinferserver::UniqCudaTensorBuf
std::unique_ptr< CudaTensorBuf > UniqCudaTensorBuf
Definition: sources/libs/nvdsinferserver/infer_common.h:95
nvdsinferserver::SharedRefBatchBuf
std::shared_ptr< RefBatchBuffer > SharedRefBatchBuf
Definition: sources/libs/nvdsinferserver/infer_common.h:82
nvdsinferserver::ShrTritonT
std::shared_ptr< T > ShrTritonT
Definition: sources/libs/nvdsinferserver/infer_common.h:122
nvdsinferserver::SharedBatchBuf
std::shared_ptr< BaseBatchBuffer > SharedBatchBuf
Common buffer interfaces (internal).
Definition: sources/libs/nvdsinferserver/infer_common.h:76
nvdsinferserver::SharedBatchArray
std::shared_ptr< BaseBatchArray > SharedBatchArray
Definition: sources/libs/nvdsinferserver/infer_common.h:80
nvdsinferserver::TrtServerAllocator
Wrapper class for Triton server output memory allocator.
Definition: sources/libs/nvdsinferserver/infer_trtis_server.h:356
nvdsinferserver::SharedCuEvent
std::shared_ptr< CudaEvent > SharedCuEvent
Definition: sources/libs/nvdsinferserver/infer_common.h:91
nvdsinferserver::InferCustomProcessorPtr
std::shared_ptr< IInferCustomProcessor > InferCustomProcessorPtr
Definition: sources/libs/nvdsinferserver/infer_common.h:146
nvdsinferserver::UniqBatchBuf
std::unique_ptr< BaseBatchBuffer > UniqBatchBuf
Definition: sources/libs/nvdsinferserver/infer_common.h:77
CudaStream
Helper class for managing Cuda Streams.
Definition: sources/gst-plugins/gst-nvdspreprocess/nvdspreprocess_lib/nvdspreprocess_impl.h:102
nvdsinferserver::UniqTrtISBackend
std::unique_ptr< TrtISBackend > UniqTrtISBackend
Definition: sources/libs/nvdsinferserver/infer_common.h:106
nvdsinferserver::UniqSysMem
std::unique_ptr< SysMem > UniqSysMem
Definition: sources/libs/nvdsinferserver/infer_common.h:94
nvdsinferserver::UniqTritonT
std::unique_ptr< T, std::function< void(T *)> > UniqTritonT
Definition: sources/libs/nvdsinferserver/infer_common.h:119
nvdsinferserver::UniqPostprocessor
std::unique_ptr< BasePostprocessor > UniqPostprocessor
Processor interfaces.
Definition: sources/libs/nvdsinferserver/infer_common.h:103
nvdsinferserver::LstmController
Definition: sources/libs/nvdsinferserver/infer_lstm.h:29
nvdsinferserver::UniqBatchArray
std::unique_ptr< BaseBatchArray > UniqBatchArray
Definition: sources/libs/nvdsinferserver/infer_common.h:81
nvdsinferserver::SharedCuStream
std::shared_ptr< CudaStream > SharedCuStream
Cuda based pointers.
Definition: sources/libs/nvdsinferserver/infer_common.h:89
nvdsinferserver::ShrTritonAllocator
std::shared_ptr< TrtServerAllocator > ShrTritonAllocator
Definition: sources/libs/nvdsinferserver/infer_common.h:129
nvdsinferserver::UniqStreamManager
std::unique_ptr< StreamManager > UniqStreamManager
Definition: sources/libs/nvdsinferserver/infer_common.h:136
nvdsinferserver::UniqLock
std::unique_lock< std::mutex > UniqLock
Miscellaneous declarations.
Definition: sources/libs/nvdsinferserver/infer_common.h:113
nvdsinferserver::SharedOptions
std::shared_ptr< IOptions > SharedOptions
Definition: sources/libs/nvdsinferserver/infer_common.h:78
nvdsinferserver::UniqLstmController
std::unique_ptr< LstmController > UniqLstmController
Definition: sources/libs/nvdsinferserver/infer_common.h:133
nvdsinferserver::SharedSysMem
std::shared_ptr< SysMem > SharedSysMem
Definition: sources/libs/nvdsinferserver/infer_common.h:93
nvdsinferserver::InferExtraProcessor
: Extra processing pre/post inference.
Definition: sources/libs/nvdsinferserver/infer_extra_processor.h:42
nvdsinferserver::TrtServerPtr
std::shared_ptr< TrtISServer > TrtServerPtr
Definition: sources/libs/nvdsinferserver/infer_common.h:126
nvdsinferserver::UniqPreprocessor
std::unique_ptr< BasePreprocessor > UniqPreprocessor
Definition: sources/libs/nvdsinferserver/infer_common.h:104
nvdsinferserver::UniqCuEvent
std::unique_ptr< CudaEvent > UniqCuEvent
Definition: sources/libs/nvdsinferserver/infer_common.h:92
nvdsinferserver::UniqInferExtraProcessor
std::unique_ptr< InferExtraProcessor > UniqInferExtraProcessor
Definition: sources/libs/nvdsinferserver/infer_common.h:144
nvdsinferserver::SharedCudaTensorBuf
std::shared_ptr< CudaTensorBuf > SharedCudaTensorBuf
Definition: sources/libs/nvdsinferserver/infer_common.h:96
nvdsinferserver::WeakTritonAllocator
std::weak_ptr< TrtServerAllocator > WeakTritonAllocator
Definition: sources/libs/nvdsinferserver/infer_common.h:130