pygfx / wgpu-py

WebGPU for Python
https://wgpu-py.readthedocs.io
BSD 2-Clause "Simplified" License
409 stars 33 forks source link

Add convenience function `enumerate_adapters` #409

Closed skoudoro closed 10 months ago

skoudoro commented 10 months ago

Hi wgpu-py Team,

I can not find enumerate_adapters() to just get an idea of all gpu available in a machine.

is there an alternative way to do that and this is something to add?

Thank you for the feedback.

almarklein commented 10 months ago

The wgpy-native implementation: https://github.com/gfx-rs/wgpu-native/blob/cf02ef3a28c92340483a0393505717bc66103d18/ffi/wgpu.h#L226

Good point. We could add it.

The function is not part of the WebGPU spec, but an extra convenience function by wgpu-native. That's why the code-generation has not told us to add it yet. Will update the title of this issue accordingly.

Korijn commented 10 months ago

Could this be just to provide something like a dropdown to select an adapter? What's the purpose?

skoudoro commented 10 months ago

Could this be just to provide something like a dropdown to select an adapter? What's the purpose?

I use only the compute shader for scientific computation purpose (no visualization needed for now). I would like to select a specific GPU for that.

Thank you all for the feedback

toloudis commented 10 months ago

I also have this use case working with scientific data where it would be beneficial to be able to partition work across multiple GPUs on one system, or let user make an informed choice of which GPU is more powerful.