microsoft / microsoft/onnxruntime

[Feature Request] determine if particular execution provider is available for given platform ahead of time

Open
#24,841 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.