File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
libs/qec/lib/decoders/plugins/trt_decoder Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,9 @@ class trt_decoder : public decoder {
124124 // Validate parameters
125125 trt_decoder_internal::validate_trt_decoder_parameters (params);
126126
127+ // Check if CUDA is available
128+ check_cuda ();
129+
127130 bool has_engine_path = params.contains (" engine_load_path" );
128131
129132 if (has_engine_path) {
@@ -275,6 +278,20 @@ class trt_decoder : public decoder {
275278 }
276279 }
277280
281+ private:
282+ void check_cuda () {
283+ int deviceCount = 0 ;
284+ cudaError_t error = cudaGetDeviceCount (&deviceCount);
285+ if (error != cudaSuccess || deviceCount == 0 ) {
286+ throw std::runtime_error (
287+ " CUDA is not available or no CUDA-capable devices found. "
288+ " TensorRT decoder requires CUDA to be installed and at least one "
289+ " CUDA-capable GPU. Error: " +
290+ std::string (cudaGetErrorString (error)));
291+ }
292+ }
293+
294+ public:
278295 CUDAQ_EXTENSION_CUSTOM_CREATOR_FUNCTION (
279296 trt_decoder, static std::unique_ptr<decoder> create (
280297 const cudaqx::tensor<uint8_t > &H,
You can’t perform that action at this time.
0 commit comments