Skip to content
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 determine which provider current inference is using? #22243

Open
SolveProb opened this issue Sep 27, 2024 · 3 comments
Open

How to determine which provider current inference is using? #22243

SolveProb opened this issue Sep 27, 2024 · 3 comments
Labels
core runtime issues related to core runtime stale issues that have not been addressed in a while; categorized by a bot

Comments

@SolveProb
Copy link

Hi, I am a newcomer to the community and have some questions to ask.

  1. How to determine which provider the current inference is running on?
  2. How to switch from CPU to GPU provider?
  3. How to set the priority of different providers?

The phenomenon I encountered is that for some reason, the inference process automatically switched from GPU to CPU.
The specific phenomenon is:
From 0 to 60 minutes, GPU memory occupied 500M, GPU utilization was about 50%, and CPU utilization was about 30%
After 60 minutes, GPU memory occupied 500M, GPU utilization was dropped to 0%, and CPU utilization was increased to 100%
Therefore, now I want to confirm which provider is used for each inference, monitor each inference, and automatically switch it to GPU provider if the last inference is on CPU.

After some searching, I found this GetAvailableProviders() function in the document, but the result it returns does not seem to accurately reflect the providers that can currently be executed normally.

I checked this issue 486 and the document, but still couldn't find the desired interface.

Currently using onnx 1.12.1 version using C++ API

Thanks very much.

@henryruhs
Copy link

Once you created a onnxruntime.InferenceSession there is the method get_providers that can be used.

Documentation: https://onnxruntime.ai/docs/api/python/api_summary.html#inferencesession

@SolveProb
Copy link
Author

Once you created a onnxruntime.InferenceSession there is the method get_providers that can be used.

Documentation: https://onnxruntime.ai/docs/api/python/api_summary.html#inferencesession

Thank you for your kind reminder.
I am using the C++ API and did not find the relevant function in the C++ documentation.

@yihonglyu yihonglyu added the core runtime issues related to core runtime label Oct 5, 2024
Copy link
Contributor

github-actions bot commented Nov 5, 2024

This issue has been automatically marked as stale due to inactivity and will be closed in 30 days if no further activity occurs. If further support is needed, please provide an update and/or more details.

@github-actions github-actions bot added the stale issues that have not been addressed in a while; categorized by a bot label Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core runtime issues related to core runtime stale issues that have not been addressed in a while; categorized by a bot
Projects
None yet
Development

No branches or pull requests

3 participants