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

Is there a way to pass {'device_id': 0} to DmlExecution Provider ? #908

Open
alanoo81 opened this issue Jan 31, 2025 · 3 comments
Open

Is there a way to pass {'device_id': 0} to DmlExecution Provider ? #908

alanoo81 opened this issue Jan 31, 2025 · 3 comments

Comments

@alanoo81
Copy link

Windows on an AMD laptop here with discrete GPU.
Default DirectML seems to use the iGPU

Got the stuff working, but it seems to only use the GPU 1 which in this case is the iGPU (Radeon 680M, so quite weak for those tasks)

I can see reference of options for DmlExecutionProvider, but haven't found a way to pass the device_id to it

Image

I can understand we should so something like this : w-okada/voice-changer#410
But can't figure out myself with my low skills.

Can someone help ?

@alanoo81 alanoo81 changed the title Is there a way I can pass {'device_id': 0} to DmlExecution Provider ? Is there a way to pass {'device_id': 0} to DmlExecution Provider ? Jan 31, 2025
@AVGRadmin
Copy link

AVGRadmin commented Jan 31, 2025

Are you running the source code or the pre-built version?
If source code:
You could add os.environ["CUDA_VISIBLE_DEVICES"] = "0" to force cuda to use the First GPU(0) by hiding the second one.

os.environ["CUDA_VISIBLE_DEVICES"] = "0" = Use the first.
os.environ["CUDA_VISIBLE_DEVICES"] = "1" = use the second (and so on).

This would have to be added in the core.py at the very top somewhere.

Alternatively you could try to set the environment arg BEFORE starting the app. I'm a pure linux user tho, so i'm not 100% certain that this would solve it, but you could try. I'm also just assuming that the Pre-Built app will use this cuda os enviroment arg, but i see no reason why not.
You might have to start the app (bat/exe) from the same CLI window as the one you pass CUDA_VISIBLE_DEVICES=X to.
Worst case, reboot your PC to discard/reset CUDA_VISIBLE_DEVICES env.

Mr.GPT as a reference since i'm not entirely sure about windows:

Image

I'm using this method myself to select which GPU to use, but i'm on linux and doing it in my docker-compose file.

@alanoo81
Copy link
Author

I'm running the python source version, but not CUDA unfortunately, DirectML because AMD hardware, so CUDA env variables would not work

@AVGRadmin
Copy link

Oh yeah that's right. My bad. I'm not used to AMD personally myself and forgot about that tiny important fact.. facepalm xD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants