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

Native nvidia support #4202

Closed
joedborg opened this issue Apr 21, 2020 · 4 comments
Closed

Native nvidia support #4202

joedborg opened this issue Apr 21, 2020 · 4 comments

Comments

@joedborg
Copy link
Contributor

Seeing https://github.com/NVIDIA/nvidia-docker#quickstart

Note that with the release of Docker 19.03, usage of nvidia-docker2 packages are deprecated since NVIDIA GPUs are now natively supported as devices in the Docker runtime.

I was wondering if this is coming to containerd, assuming this is an implementation in runc? Or will we continue to need to add nvidia-container-runtime to the config.toml?

@cpuguy83
Copy link
Member

For vanilla containerd (not the cri plugin), the API is focused around the OCI spec.
So it's just about adding the right devices and hooks.
There is a package to assist with this: https://github.com/containerd/containerd/blob/master/contrib/nvidia/nvidia.go

@joedborg
Copy link
Contributor Author

Thanks @cpuguy83, are there any docs with how to use that?

@cpuguy83
Copy link
Member

WithGPUs is an oci.SpecOpts.
You can pass this into WithNewSpec: https://godoc.org/github.com/containerd/containerd#WithNewSpec
This is done when creating a container.

So something like:

client.NewContainer(ctx, "myContainer", containerd.WithNewSpec(containerd.WithDefaultSpec, nvidia.WithGPUs(...))

@crosbymichael
Copy link
Member

I'm also looking into better ways to handle this in CRI.

But right now, I tested this the other day on my ubuntu system and the WithGPUs works great still. You can also use ctr run --gpus 0 ... to test this.

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

No branches or pull requests

3 participants