Skip to content

Improve hostRequirements, Features support for dev containers that use GPUs #82

Closed

Description

@Chuxel

Dev containers can run on machines with GPUs and access them directly on Linux or through WSL on Windows. However, currently there is no direct support for a GPUs in the spec.

To enable GPU support, I'd propose we enhance the "hostRequirements" property to allow specifying GPU information. If this information is present, we then automatically enable GPU support (e.g., via --gpus all).

I'd propose we support a form that simply adds a requirement for any GPU, with the option to specify more requirements for further validation. Here's a proposed format:

Just enabling/requiring any GPU

"hostRequirements": {
    "gpu": true

Specifying cores and memory:

"hostRequirements": {
    "gpu": {
        "cores": 2
        "memory": "4gb" // Same value format as memory for the machine
    }
}

and with type

"hostRequirements": {
    "gpu": {
        "cores": 2
        "memory": "4gb"
        "type": "nvidia"
    }
}

To allow Dev Container Features (#61) to require a GPU (e.g., in an NVIDIA CUDA feature), I'd propose we also allow hostRequirements to be specified in devcontainer-features.json.

Activity

  1. chris-major-improbable commented on Aug 30, 2022

    @chris-major-improbable

    I generally like this - however I'd really like to be able to have a devcontainer that supports GPUs when available but doesn't require them.

    For my specific use case, we have some libraries that can use GPUs, but also fall back to CPUs if they are not available. Currently the developers need to manually add/remove the -gpus all.

    My sugestion would be to extended this proposal with something like:

    "hostRequirements": {
        "gpu": {
            "optional": true
        }
    }

    (I appreciate that mixing 'requirements' and optional elements seems a bit counter intuitive, however I can't think of a better option).

  2. Clockwork-Muse commented on Sep 9, 2022

    @Clockwork-Muse

    we then automatically enable GPU support (e.g., via --gpus all).

    This flag isn't present in podman, and isn't part of the CDI spec, btw. You're supposed to set things up differently in podman (although you can also install a global hook).

  3. added this to the Backlog milestone on Nov 4, 2022
  4. chrmarti commented on Nov 28, 2022

    @chrmarti
    Contributor

    Wrote down what we agreed on for the implementation here: #82

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

proposalStill under discussion, collecting feedback

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions