shouxieai / tensorRT_Pro

C++ library based on tensorrt integration
MIT License
2.62k stars 549 forks source link

NVInfer INTERNAL_ERROR: [defaultAllocator.cpp::nvinfer1::internal::DefaultAllocator::allocate::63] Error Code 1: Cuda Runtime (out of memory) #126

Closed geoexploring closed 2 years ago

geoexploring commented 2 years ago

增大语义分割模型输入图片大小,报错:

[2022-08-01 11:01:54][info][trt_builder.cpp:474]:Compile FP32 Onnx Model './seg.onnx'.
[2022-08-01 11:01:56][info][trt_builder.cpp:558]:Input shape is -1 x 3 x 2000 x 2000
[2022-08-01 11:01:56][info][trt_builder.cpp:559]:Set max batch size = 1
[2022-08-01 11:01:56][info][trt_builder.cpp:560]:Set max workspace size = 1024.00 MB
[2022-08-01 11:01:56][info][trt_builder.cpp:561]:Base device: [ID 0]<NVIDIA GeForce RTX 2080>[arch 7.5][GMEM 6.84 GB/8.00 GB]
[2022-08-01 11:01:56][info][trt_builder.cpp:564]:Network has 1 inputs:
[2022-08-01 11:01:56][info][trt_builder.cpp:570]:      0.[modelInput] shape is -1 x 3 x 2000 x 2000
[2022-08-01 11:01:56][info][trt_builder.cpp:576]:Network has 1 outputs:
[2022-08-01 11:01:56][info][trt_builder.cpp:581]:      0.[modelOutput] shape is -1 x 2 x 2000 x 2000
[2022-08-01 11:01:56][info][trt_builder.cpp:585]:Network has 1323 layers:
[2022-08-01 11:01:56][info][trt_builder.cpp:652]:Building engine...
[2022-08-01 11:01:56][warn][trt_builder.cpp:33]:NVInfer: Detected invalid timing cache, setup a local cache instead
[2022-08-01 11:03:18][error][trt_builder.cpp:27]:NVInfer INTERNAL_ERROR: [defaultAllocator.cpp::nvinfer1::internal::DefaultAllocator::allocate::63] Error Code 1: Cuda Runtime (out of memory)

环境:

cudnn  8.2.2.26
cuda  11.2
TensorRT 8.0.1.6

修改const size_t maxWorkspaceSize = 1ul << 30 ,无论是改大还是改小都无法解决问题,请问有没有什么解决方案呢?

谢谢!

shouxieai commented 2 years ago

2000*2000的分辨率太大了。你的内存只有7GB可用,明显不够

geoexploring commented 2 years ago

@shouxieai ,感谢!

有可能是这个问题,我已经向NVIDIA官方报告了这个错误NVIDIA/TensorRT #2198