Is there any way to run op in specific provider? or does priority of provider exist?
Which API you are using? C/C++/Python?
@snnn Python.
@fumihwh ONNXRUNTIME provides APIs to set execution provider in C/C++. Python does not have. Should be added. Will keep this open to track this task.
@fumihwh : can you share some more details on your usage scenario? The python packages that are released are only built for single execution providers right now.
Does specific providers available now in onnxruntime python?
Otherwise we have to installed 2 different environments in order to switch between CPU and GPU as backend.
This commit attempts to fix this.
@pranavsharma this PR is good, will it merge?
This was merged 4 days back.
Is there any documentation on how to switch between CPU and GPU runtime?
Is there a support from python to use GPU runtime at all?
@fumihwh ONNXRUNTIME provides APIs to set execution provider in C/C++. Python does not have. Should be added. Will keep this open to track this task.
The issue is closed - does this mean API already supports switching between providers CPU and GPU?. Does python API support it?
Yes, the Python API supports it:
I just tried it. Before installing onnxruntime-gpu:
In [1]: session.get_providers()
Out[1]: ['CPUExecutionProvider']
afterwards:
In [1]: session.get_providers()
Out[1]: ['CUDAExecutionProvider', 'CPUExecutionProvider']
"CUDAExecutionProvider" being before CPU in the array means that onnxruntime will execute nodes with CUDA if capable and fallback to CPU if not. You can change the priority with session.set_providers.
Great, thank you!
session.get_providers()
Well, the thing is the fallback to CPU must(?) happen IF GPU is busy or not available. But it is not.. It throws an exception.
See the link: https://colab.research.google.com/drive/11ISt8zaGOKaLWCdsRcapcM9Cme109Zwq?usp=sharing
Good point, that should probably be a separate issue.
Most helpful comment
Is there any documentation on how to switch between CPU and GPU runtime?