NVIDIA DeepStream SDK API Reference

6.4 Release
infer_common.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2020-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4  *
5  * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6  * property and proprietary rights in and to this material, related
7  * documentation and any modifications thereto. Any use, reproduction,
8  * disclosure or distribution of this material and related documentation
9  * without an express license agreement from NVIDIA CORPORATION or
10  * its affiliates is strictly prohibited.
11  */
12 
20 #ifndef __NVDSINFERSERVER_COMMON_H__
21 #define __NVDSINFERSERVER_COMMON_H__
22 
23 #include <dlfcn.h>
24 #include <inttypes.h>
25 #include <pthread.h>
26 #include <stdarg.h>
27 #include <string.h>
28 #include <unistd.h>
29 
30 #include <algorithm>
31 #include <cassert>
32 #include <condition_variable>
33 #include <future>
34 #include <map>
35 #include <mutex>
36 #include <set>
37 #include <shared_mutex>
38 #include <sstream>
39 #include <stdexcept>
40 #include <string>
41 #include <thread>
42 #include <unordered_map>
43 
44 #include <infer_datatypes.h>
45 #include <infer_defines.h>
46 
47 namespace nvdsinferserver {
48 
49 class BaseBatchBuffer;
50 class BaseBatchArray;
51 class RefBatchBuffer;
52 
53 class SysMem;
54 class CudaStream;
55 class CudaEvent;
56 class CudaTensorBuf;
57 
58 class IPreprocessor;
59 class IPostprocessor;
60 class IBackend;
61 class BasePreprocessor;
62 class BasePostprocessor;
63 class BaseBackend;
64 
65 class TrtISBackend;
66 
71 using SharedBatchBuf = std::shared_ptr<BaseBatchBuffer>;
72 using UniqBatchBuf = std::unique_ptr<BaseBatchBuffer>;
73 using SharedOptions = std::shared_ptr<IOptions>;
74 
75 using SharedBatchArray = std::shared_ptr<BaseBatchArray>;
76 using UniqBatchArray = std::unique_ptr<BaseBatchArray>;
77 using SharedRefBatchBuf = std::shared_ptr<RefBatchBuffer>;
84 using SharedCuStream = std::shared_ptr<CudaStream>;
85 using UniqCuStream = std::unique_ptr<CudaStream>;
86 using SharedCuEvent = std::shared_ptr<CudaEvent>;
87 using UniqCuEvent = std::unique_ptr<CudaEvent>;
88 using SharedSysMem = std::shared_ptr<SysMem>;
89 using UniqSysMem = std::unique_ptr<SysMem>;
90 using UniqCudaTensorBuf = std::unique_ptr<CudaTensorBuf>;
91 using SharedCudaTensorBuf = std::shared_ptr<CudaTensorBuf>;
98 using UniqPostprocessor = std::unique_ptr<BasePostprocessor>;
99 using UniqPreprocessor = std::unique_ptr<BasePreprocessor>;
100 
101 using UniqTrtISBackend = std::unique_ptr<TrtISBackend>;
108 using UniqLock = std::unique_lock<std::mutex>;
109 
110 class DlLibHandle;
111 using SharedDllHandle = std::shared_ptr<DlLibHandle>;
112 
113 template <typename T>
114 using UniqTritonT = std::unique_ptr<T, std::function<void(T*)>>;
115 
116 template <typename T>
117 using ShrTritonT = std::shared_ptr<T>;
118 
119 class TrtISServer;
120 class TrtServerAllocator;
121 using TrtServerPtr = std::shared_ptr<TrtISServer>;
122 
123 using UniqTritonAllocator = std::unique_ptr<TrtServerAllocator>;
124 using ShrTritonAllocator = std::shared_ptr<TrtServerAllocator>;
125 using WeakTritonAllocator = std::weak_ptr<TrtServerAllocator>;
126 
127 class LstmController;
128 using UniqLstmController = std::unique_ptr<LstmController>;
129 
130 class StreamManager;
131 using UniqStreamManager = std::unique_ptr<StreamManager>;
138 class InferExtraProcessor;
139 using UniqInferExtraProcessor = std::unique_ptr<InferExtraProcessor>;
141 using InferCustomProcessorPtr = std::shared_ptr<IInferCustomProcessor>;
144 } // namespace nvdsinferserver
145 
146 #endif
nvdsinferserver::StreamManager
Definition: infer_stream_manager.h:25
nvdsinferserver::IInferCustomProcessor
Interface of Custom processor which is created and loaded at runtime through CreateCustomProcessorFun...
Definition: infer_custom_process.h:38
nvdsinferserver
Copyright (c) 2021, NVIDIA CORPORATION.
Definition: infer_custom_process.h:28
nvdsinferserver::UniqInferExtraProcessor
std::unique_ptr< InferExtraProcessor > UniqInferExtraProcessor
Definition: infer_common.h:139
nvdsinferserver::SharedDllHandle
std::shared_ptr< DlLibHandle > SharedDllHandle
Definition: infer_common.h:111
nvdsinferserver::InferCustomProcessorPtr
std::shared_ptr< IInferCustomProcessor > InferCustomProcessorPtr
Definition: infer_common.h:141
nvdsinferserver::SharedBatchBuf
std::shared_ptr< BaseBatchBuffer > SharedBatchBuf
Common buffer interfaces (internal).
Definition: infer_common.h:71
nvdsinferserver::TrtISServer
Wrapper class for creating Triton Inference Server instance.
Definition: infer_trtis_server.h:533
nvdsinferserver::SharedSysMem
std::shared_ptr< SysMem > SharedSysMem
Definition: infer_common.h:88
infer_datatypes.h
Header file for the data types used in the inference processing.
nvdsinferserver::ShrTritonT
std::shared_ptr< T > ShrTritonT
Definition: infer_common.h:117
infer_defines.h
nvdsinferserver::UniqBatchArray
std::unique_ptr< BaseBatchArray > UniqBatchArray
Definition: infer_common.h:76
nvdsinferserver::WeakTritonAllocator
std::weak_ptr< TrtServerAllocator > WeakTritonAllocator
Definition: infer_common.h:125
nvdsinferserver::TrtServerAllocator
Wrapper class for Triton server output memory allocator.
Definition: infer_trtis_server.h:351
nvdsinferserver::UniqTritonAllocator
std::unique_ptr< TrtServerAllocator > UniqTritonAllocator
Definition: infer_common.h:123
nvdsinferserver::ShrTritonAllocator
std::shared_ptr< TrtServerAllocator > ShrTritonAllocator
Definition: infer_common.h:124
nvdsinferserver::UniqTrtISBackend
std::unique_ptr< TrtISBackend > UniqTrtISBackend
Definition: infer_common.h:101
nvdsinferserver::TrtServerPtr
std::shared_ptr< TrtISServer > TrtServerPtr
Definition: infer_common.h:121
nvdsinferserver::UniqCudaTensorBuf
std::unique_ptr< CudaTensorBuf > UniqCudaTensorBuf
Definition: infer_common.h:90
nvdsinferserver::UniqBatchBuf
std::unique_ptr< BaseBatchBuffer > UniqBatchBuf
Definition: infer_common.h:72
CudaStream
Helper class for managing Cuda Streams.
Definition: nvdspreprocess_impl.h:107
nvdsinferserver::UniqCuStream
std::unique_ptr< CudaStream > UniqCuStream
Definition: infer_common.h:85
nvdsinferserver::UniqTritonT
std::unique_ptr< T, std::function< void(T *)> > UniqTritonT
Definition: infer_common.h:114
nvdsinferserver::LstmController
Definition: infer_lstm.h:23
nvdsinferserver::SharedOptions
std::shared_ptr< IOptions > SharedOptions
Definition: infer_common.h:73
nvdsinferserver::SharedCuStream
std::shared_ptr< CudaStream > SharedCuStream
Cuda based pointers.
Definition: infer_common.h:84
nvdsinferserver::InferExtraProcessor
: Extra processing pre/post inference.
Definition: infer_extra_processor.h:37
nvdsinferserver::UniqPreprocessor
std::unique_ptr< BasePreprocessor > UniqPreprocessor
Definition: infer_common.h:99
nvdsinferserver::UniqCuEvent
std::unique_ptr< CudaEvent > UniqCuEvent
Definition: infer_common.h:87
nvdsinferserver::UniqStreamManager
std::unique_ptr< StreamManager > UniqStreamManager
Definition: infer_common.h:131
nvdsinferserver::SharedRefBatchBuf
std::shared_ptr< RefBatchBuffer > SharedRefBatchBuf
Definition: infer_common.h:77
nvdsinferserver::UniqLstmController
std::unique_ptr< LstmController > UniqLstmController
Definition: infer_common.h:128
nvdsinferserver::UniqPostprocessor
std::unique_ptr< BasePostprocessor > UniqPostprocessor
Processor interfaces.
Definition: infer_common.h:98
nvdsinferserver::SharedCuEvent
std::shared_ptr< CudaEvent > SharedCuEvent
Definition: infer_common.h:86
nvdsinferserver::UniqLock
std::unique_lock< std::mutex > UniqLock
Miscellaneous declarations.
Definition: infer_common.h:108
nvdsinferserver::SharedBatchArray
std::shared_ptr< BaseBatchArray > SharedBatchArray
Definition: infer_common.h:75
nvdsinferserver::SharedCudaTensorBuf
std::shared_ptr< CudaTensorBuf > SharedCudaTensorBuf
Definition: infer_common.h:91
nvdsinferserver::UniqSysMem
std::unique_ptr< SysMem > UniqSysMem
Definition: infer_common.h:89