-
Notifications
You must be signed in to change notification settings - Fork 3.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
TensorRT backend not work when the device_id is greater than 0 #19467
Comments
Some conversations here |
Can you share your C++ code of how you set device id? We suggest to use |
This is part of my code to append tensorrt backend to sess_options:
|
Thanks, the code to append TRT EP to session options looks okay. Could you also share the
Please note that users can only specify device_id at session initialization time and it's one gpu for one session. I'm still not sure what your application code is for now. |
Reply other discussion thread here
"subsequent threads can not change device by modifying CUDA_VISIBLE_DEVICES", other threads try to change the device at session creation? Or session.Run()? |
Without setting |
My previous description was inaccurate, I create theses sessions sequentially in a single thread, like:
Above code can use a device with device_id > 0, but all sessions use the same device with device_id=device_ids[0]. |
That's a bit strange, i can't repro from my side with devide_id specified by provider option:
Is that all the error message? Could you help enable verbose log by adding a line of code as below to see the TRT EP's full log?
you will see the device_id configured by TRT EP provider options: (you should see different devide_id for different session)
|
I can't repro from my side using CUDA_VISIBLE_DEVICES either |
Follow-up questions here:
|
Thanks for your reply, I have switched to multiple processes version, it runs fine on multiple cuda devices. |
1: cuda ep works with correct device, just switch the ep to tensorrt. |
I decide to close this issue and reopen it when there is new progress. |
Good job! I will plan to test it recently. |
Describe the issue
Cuda backend runs fine on multiple gpus, but TensorRT fails when the device_id is specified as a value greater than 0.
One successful workaround I have tried so far is using multiple processes, and each using different environment variables
CUDA_VISIBLE_DEVICES=device_id
.To reproduce
...
Urgency
Urgent, because the project is organized in multiple threads, and no workaround works.
Platform
Linux
OS Version
20.04
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
1.16.3 and 1.17.0
ONNX Runtime API
C++
Architecture
X64
Execution Provider
TensorRT
Execution Provider Library Version
TensorRT 8.6
The text was updated successfully, but these errors were encountered: