container-device-interface icon indicating copy to clipboard operation
container-device-interface copied to clipboard

Extend spec to allow for "meta" devices.

Open elezar opened this issue 3 years ago • 6 comments

One of the use cases originally proposed for CDI was use of meta devices such as "all". Since these are generally vendor-specific supporting these in the API is not feasible. The proposal is to add a requires field to the device specification to allow for devices to be grouped. (See the example spec below).

The API would have to be extended to:

  • apply the edits for all devices in the requires list in addition to to the container edits specified
  • ensure that there are no cycles in the requires chain.

Open questions:

  • Should the entry in requires be a fully-qualified name?
  • Should we indicate that the entry in the requires list is a device explicitly?
cdiVersion: 0.5.0
kind: nvidia.com/gpu
devices:
- name: all
  requires:
    - GPU-edfee158-11c1-52b8-0517-92f30e7fac88
    - GPU-f22fb098-d1b3-3806-2655-ba25f02229c1
- name: GPU-edfee158-11c1-52b8-0517-92f30e7fac88
  containerEdits:
    mounts:
    - containerPath: /var/run/nvidia-container-devices/GPU-edfee158-11c1-52b8-0517-92f30e7fac88
      hostPath: /dev/null
      options:
      - ro
- name: GPU-f22fb098-d1b3-3806-2655-ba25f02229c1
  containerEdits:
    mounts:
    - containerPath: /var/run/nvidia-container-devices/GPU-f22fb098-d1b3-3806-2655-ba25f02229c1
      hostPath: /dev/null
      options:
      - ro
containerEdits:
  hooks:
  - args:
    - nvidia-container-runtime-hook
    - prestart
    hookName: prestart
    path: nvidia-container-runtime-hook

elezar avatar Jul 05 '22 11:07 elezar

cc @klueska

elezar avatar Jul 05 '22 13:07 elezar

Would supporting regexps, wildcards or predefined keywords in the device names be easier to do, e.g. nvidia.com/device=* or nvidia.com/device=all, or nvidia.com/device=gpu* ?

bart0sh avatar Jul 18 '22 09:07 bart0sh

cc @klihub @kad

bart0sh avatar Jul 18 '22 09:07 bart0sh

Would supporting regexps, wildcards or predefined keywords in the device names be easier to do, e.g. nvidia.com/device=* or nvidia.com/device=all, or nvidia.com/device=gpu* ?

We had that in the original updated API but it was then removed. I see a few options here but since I'm not familiar with the :

  1. re-add support for regexp-based injection
  2. implement something like the above suggested scheme of 'meta'-devices
  3. let a vendor-specific component dynamically generate spec files with 'meta'-entries

All of these have their pros and cons, including

  1. Fairly easy to implement. Might not be flexible enough (or too error prone) if meta-devices can't be picked by a simple enough pattern.
  2. Should be fairly easy to implement. Feels a bit superficial. For static specs, the entries could be added manually or generated.
  3. Already possible now. Requires an extra component.

@kad @bart0sh It's a bit difficult to guesstimate for the rest of us which of these would be sufficiently good or the best fit for the nvidia cases.

klihub avatar Sep 27 '22 08:09 klihub

This issue is stale because it has been open 90 days with no activity. This issue will be closed in 30 days unless new comments are made or the stale label is removed.

github-actions[bot] avatar May 29 '24 04:05 github-actions[bot]

This issue was automatically closed due to inactivity.

github-actions[bot] avatar Jun 29 '24 04:06 github-actions[bot]