Oh wow, thank you jjyao. That is exactly what I need I think. So there is no public API for this?
I will test if it works, then file a GH feature request. It seems like an “obvious” thing (and indeed allows people to define their own GPU resources etc., when you have heterogenous GPUs on the system for example).