cncf-tags / container-device-interface

Apache License 2.0
190 stars 36 forks source link

Does it make sense to provide a comma-separated list of device names and have them merged #198

Closed klueska closed 3 months ago

klueska commented 3 months ago

For example, it feels nicer to be able to run something like the following:

docker run -it --device nvidia.com/gpu=0,1,2,3 ubuntu:22.04

rather than:

docker run -it \
    --device nvidia.com/gpu=0 \
    --device nvidia.com/gpu=1 \
    --device nvidia.com/gpu=2 \
    --device nvidia.com/gpu=3
    ubuntu:22.04

However, I can see counter arguments against it since this is technically 4 devices, not 1, so maybe it should be 4 separate calls.

kad commented 3 months ago

I agree, it helps with UX, bug might be nonintuitive when device IDs are not simple 0,1,2,3 but card0,card1,... people might try to write --device nvidia.com/gpu=card0,1,2,3 instead of --device nvidia.com/gpu=card0,card1,card2,card3 WDYT?

klihub commented 3 months ago

If docker supports bit --opt val and --opt=val then shouldn't you be able to do this already in bash and compatible shells with something like

docker run -it --device=nvidia.com/gpu={0,1,2,3} ubuntu:22.04
klueska commented 3 months ago

That's a good point. I'd actually argue this is better since it's standard bash and probably less confusing than some non-standard syntax for pulling in multiple devices.