Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Chuxel opened this issue Aug 11, 2022 · 3 comments
Closed
Assignees
Labels
proposal Still under discussion, collecting feedback
Milestone

Comments

@Chuxel
Copy link
Member

Chuxel commented Aug 11, 2022

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.

@chris-major-improbable
Copy link

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).

@Clockwork-Muse
Copy link

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).

@chrmarti
Copy link
Contributor

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

chrmarti added a commit to microsoft/vscode that referenced this issue Nov 28, 2022
sourcegraph-bot pushed a commit to sgtest/megarepo that referenced this issue Nov 28, 2022
Commit: 9dba5385c7aefebe3756ed413da7fedf1868a71c
chrmarti added a commit that referenced this issue Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal Still under discussion, collecting feedback
Projects
None yet
Development

No branches or pull requests

4 participants