microsoft / microsoft/onnxruntime
[Feature Request] determine if particular execution provider is available for given platform ahead of time
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 21.9k
- Forks
- 4.2k
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 184
Description
### Describe the feature request
onnxruntime makes it difficult to determine ahead of time, if particular execution provider is available
Installing onnxruntime-gpu package installs 3 different execution providers
1. TensorRT
2. Cuda
3. CPU
We plan to use onnxruntime-gpu package and depending on whether gpu is available or not, we want to switch to CPUExecutionProvider ahead of time to reduce load time overhead.
e.g. in PyTorch once can determine this using `torch.cuda.is_available()`
can we have something similar in onnxruntime to determine if cuda/particular execution provider is indeed valid for given installation.
https://onnxruntime.ai/docs/api/python/api_summary.html
```
onnxruntime.get_available_providers() → [list](https://docs.python.org/3/library/stdtypes.html#list)[[str](https://docs.python.org/3/library/stdtypes.html#str)]
Return list of available Execution Providers in this installed version of Onnxruntime. The order of elements represents the default priority order of Execution Providers from highest to lowest.
```
get_available_providers() returns available provider for installed package but not which one can be actually used during runtime.
### Describe scenario use case
use case in https://github.com/quic/aimet
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Python API documentation for onnxruntime.get_available_providers() and compare its reported providers with the requested runtime-validity check. Review the use case from quic/aimet and define completion as a documented way to determine whether a particular execution provider can actually be used on the target platform before session loading.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100