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.

I know that a PR was being worked on to provide nvidia support, but apparently it is no longer necessary with nvidia-docker2, but I cannot find anything in the documentation.

Is it currently possible (provided nvidia-docker2 is properly installed/configured) to do the equivalent of:

It looks like this is available via the runtime parameter?

docker run --runtime=nvidia nvidia/cuda nvidia-smi

and as of v17.12.0-ce:

docker service create -t --generic-resource "gpu=1" nvidia/cuda nvidia-smi

It looks like the resources API does not support --generic-resource

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mwilliammyerscommented, Jan 31, 2018

Yeah I am interested in implementing this. I’ll open a PR soon.

0reactions
mwilliammyerscommented, Feb 1, 2018

So I see a few options for implementing this:

1. Most explicit:

generic_reservations=[
   docker.types.DescreteGenericResource(kind='SSD', value=1),
   docker.types.NamedGenericResource(kind='GPU', value='UUID1')
]

pros:

  • puts the burden of figuring things out like value='1' on the user
  • dockerd will give an error for e.g.: docker.types.NamedGenericResource(kind='GPU', value=1)

cons:

  • cumbersome and awkward for the user

2. Determine NamedResourceSpec and DiscreteResourceSpec automatically with an isinstance() check:

generic_reservations=[
   docker.types.GenericResourceReservation(kind='SSD', value=3),
   docker.types.GenericResourceReservation(kind='GPU', value='UUID1')
]

pros:

  • a little less awkward than option 1

cons:

  • still cumbersome and awkward for the user, doesn’t gain ease of use

3. Use a list of dict and determine NamedResourceSpec and DiscreteResourceSpec automatically with an isinstance() check:

generic_reservations = [{'SSD': 3}, {'GPU': 'UUID1'}]

pros:

  • a lot simpler/cleaner for the user

cons:

  • less explicit, have to use isinstance() and all str values will be a NamedResourceSpec and all int values will be DiscreteResourceSpec.
  • Could lead to silent errors…

4. Use a list of str and determine NamedResourceSpec and DiscreteResourceSpec automatically with an isinstance() check:

generic_reservations = ['SSD=3', 'GPU=UUID1']

pros:

  • matches the docker CLI

cons:

  • Not very pythonic
  • A little awkward
  • Could lead to silent errors…

And for all cases, use generic_reservations like:

 client.services.create(resources=docker.types.Resources(generic_reservations=generic_reservations))

What are your thoughts? Or does it not matter? There seems to be some variation of each throughout the existing API…

I have them all pretty much coded up so it doesn’t a lot to me but I am partial to either 1 or 3

Read more comments on GitHub >

github_iconTop Results From Across the Web

Access Customer Support - NVIDIA
NVIDIA's customer support services are designed to meet the needs of both the consumer and enterprise customers.
Read more >
GeForce Product & Technical Support - NVIDIA
Find answers to the most common questions and issues. Our knowledgebase is ...
Read more >
Customer Support, Knowledgebase, and FAQs - NVIDIA
Get help with your online order, browse trending support topics, visit and ...
Read more >
Official Drivers - NVIDIA
Download latest drivers for NVIDIA products including GeForce, TITAN, NVIDIA RTX, Data Center, GRID and more. ... Need help? Technical Support ...
Read more >
GeForce Now - Reset Password | Nvidia Account
login.
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