docker-py icon indicating copy to clipboard operation
docker-py copied to clipboard

Gpus update

Open hnine999 opened this issue 5 years ago • 9 comments

Unfortunately wasn't able to build docs -- doesn't look like they need to be updated for this change(?)

Mod was based on "runtime" argument -- searched for this argument in the source files, and wherever it appeared, added "gpus" argument, with dependency on api version 1.40 (the most recent version as of Docker version 19.03.1, build 74b1e89).

hnine999 avatar Aug 29 '19 17:08 hnine999

Please sign your commits following these rules: https://github.com/moby/moby/blob/master/CONTRIBUTING.md#sign-your-work The easiest way to do this is to amend the last commit:

$ git clone -b "gpus-update" [email protected]:hnine999/docker-py.git somewhere
$ cd somewhere
$ git rebase -i HEAD~842356982816
editor opens
change each 'pick' to 'edit'
save the file and quit
$ git commit --amend -s --no-edit
$ git rebase --continue # and repeat the amend for each commit
$ git push -f

Amending updates the existing PR. You DO NOT need to open a new one.

GordonTheTurtle avatar Aug 29 '19 17:08 GordonTheTurtle

Is this still being worked on? As far as I understand "Gpus" is not part of HostConfig which is being set in this patch. When --gpus is used with Docker run the GPU configuration ends up in the DeviceRequests section under HostConfig, as documented here: https://docs.docker.com/engine/api/v1.40/#operation/ContainerCreate

DesktopMan avatar Sep 10 '19 12:09 DesktopMan

Still being worked on.

hnine999 avatar Sep 10 '19 16:09 hnine999

I did a quick hack based on the patch by @hnine999 that grabs all available gpus (https://github.com/sigurdkb/docker-py/tree/gpus_parameter). It is not pretty, but it works :-)

As mentioned by @DesktopMan, it converts any gpus parameter value to a hard coded DeviceRequests section under HostConfig that grabs all GPUs: https://github.com/sigurdkb/docker-py/blob/f5e11cdc6e3bd179312aceededf323cbb7cdc448/docker/types/containers.py#L525

sigurdkb avatar Sep 11 '19 08:09 sigurdkb

Considering the Docker API implements the DeviceRequests parameter and not the Gpus parameter, which parameter should this library use? device_requests would match the Docker API, while gpus match the Docker client. Are there any guidelines for this?

sigurdkb avatar Sep 11 '19 18:09 sigurdkb

Who is responsible for answering some of the questions that @sigurdkb posed so that this can be addressed?

I'm open to submitting a PR myself, but the fact that @sigurdkb has already proposed a hack and/or PR several weeks ago, asked some architectural questions on how to proceed, and still hasn't received any response to those questions is not encouraging.

Thanks.

AndrewJDR avatar Oct 04 '19 07:10 AndrewJDR

Any Progress on this PR?

eugland avatar Dec 02 '19 15:12 eugland

There is a cleaner and better implementation here https://github.com/docker/docker-py/pull/2471

La0 avatar Dec 02 '19 16:12 La0

Is this superseded by #2471?

EpicWink avatar Aug 14 '20 08:08 EpicWink