question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use runtime nvidia

See original GitHub issue

Hi all,

I’m trying to use docker spawner with runtime nvidia set in order attach GPUs installed on my JUPYTERHUB server.

I tried with the following snippet in my jupyterhub_config.py file but I was unlucky until now.

c.DockerSpawner.extra_create_kwargs.update({ 'runtime': 'nvidia' })

Can you help me understand how to set it up properly?

Thanks.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:7
  • Comments:26 (5 by maintainers)

github_iconTop GitHub Comments

15reactions
minrkcommented, Feb 25, 2021

Thanks for the working example! I’m not sure what a PR would include, though. From the looks of what you have there, it seems like extra_host_config is already enough:

import docker

c.DockerSpawner.extra_host_config = {
    "device_requests": [
        docker.types.DeviceRequest(
            count=-1,
            capabilities=[["gpu"]],
        ),
    ],
}

which seems to work when I try it, so we already have this feature satisfied by passing through arguments to docker-py.

6reactions
minrkcommented, Sep 3, 2018

Following up on that, the extra_create_kwargs is unnecessary. Only the extra_host_config is required. The main source of confusion was that the docker Python docs suggest that you can specify runtime via create, but this is only true if there is not a host_config also specified. Since DockerSpawner always specifies a host config, runtime can only be specified there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NVIDIA Container Runtime
NVIDIA Container Runtime is a GPU aware container runtime, compatible with the Open Containers Initiative (OCI) specification used by Docker, CRI-O, ...
Read more >
NVIDIA container runtime - GitHub
To register the nvidia runtime, use the method below that is best suited to your environment. You might need to merge the new...
Read more >
cuda - Add nvidia runtime to docker runtimes - Stack Overflow
1. Install latest driver for your NVIDIA GPU on the base system. · 2. Install docker-ce 19.03 or newer. · 3. launch your...
Read more >
Enabling GPU access with Compose - Docker Documentation
Use of service runtime property from Compose v2.3 format (legacy) . Docker Compose v1.27.0+ switched to using the Compose Specification schema which...
Read more >
Installing NVIDIA Docker component and Python packages - IBM
Procedure · Install the container runtime and runtime hook: · Set up the container runtime and tell Docker to use it as the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found