-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to Allocate Host Mem for dynamic model with batch_size > 1? #1564
Comments
@ThuyHoang9001 , could you use |
close since no activity for more than 3 weeks, please reopen if you still have question, thanks! |
Hi @ttyio , I have the same issue here. I am trying to run a model with dynamic batch size:
Here's my code:
|
Hey, I am also trying to find a workaround to this. The thing here is you might not need to convert to a dynamic engine as you can set the the axis which you want to vary as 1 and later multiply it by batch size or whatever axis of interest (as long as it is supported). So a static input shape might work if you change a little bit in the buffering allocation However, I am still experimenting this and the code works well but not sure about the logic as I still didn't visualize the results. Did you find a workaround that we may discuss? |
@abdulazizab2 I have excatly the same issue my shape is (-1, 32, 32, 1) and getting the same error if I'm taking the abs of its volume. |
it just means that dynamic shape not set right ? @ttyio |
@lix19937 yes, we also have api |
@ttyio Hey I am facing a problem with dynamic batching, basically on how to set the host mem size according to varying input batch size at runtime Can you provide a example script in python?
|
你好,我用的tensorrt8.6.1遇到了和你 一样的问题,请问应该怎么处理? |
Description
Cuda Mem Host is allocated FAIL .
Environment
TensorRT Version: 8.2.0.6
GPU Type:
Nvidia Driver Version: TU102 [GeForce RTX 2080 Ti]
CUDA Version: 11.4.2
CUDNN Version:
Operating System + Version: Linux 20.0.4
Python Version (if applicable): 3.8.10
TensorFlow Version (if applicable):
PyTorch Version (if applicable): 1.9.1+cu102
Baremetal or Container (if container which image + tag):
Steps To Reproduce
I tried to allocate host memory for dynamic model with batch_size > 1:
But it is fail as below:
bingding: input (-1, 3, 112, 112)
Traceback (most recent call last):
File "infer_insight_face.py", line 434, in
trt_wrapper = TRTClass(engine_file_path)
File "infer_insight_face.py", line 103, in init
host_mem = cuda.pagelocked_empty(size, dtype)
pycuda._driver.MemoryError: cuMemHostAlloc failed: out of memory
[10/20/2021-01:41:09] [TRT] [E] 1: [defaultAllocator.cpp::deallocate::35] Error Code 1: Cuda Runtime (invalid argument)
Segmentation fault (core dumped)
The text was updated successfully, but these errors were encountered: