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

Add host_config_options to allow configuration of DockerTask for GPU resources #3234

Merged
merged 2 commits into from Apr 21, 2023

Conversation

acmiyaguchi
Copy link
Contributor

Description

This adds a new host_config_options property to DockerTask that gives access to the underlying Docker API for things like gpu requests or increased shared memory. I've also added references to the docker documentation and a few small examples.

Motivation and Context

I need to grant GPU access to a few docker tasks, but the current API interface of the DockerTask doesn't allow any sort of access to the underlying Docker API to be able to make the necessary requests. I've modeled this change after the container_options property which allows broad underlying access to the relevant Docker API calls.

Have you tested this? If so, how?

I have tested this with some code that I'm working with on a Telsa T4: https://github.com/dsgt-birdclef/birdclef-2023/blob/22c8bcb53c297e68298be5fb41933d59e11f55cd/workflows/mixit/docker.py

In particular, I added the following:

    host_config_options = {
        "device_requests": [docker.types.DeviceRequest(count=1, capabilities=[["gpu"]])]
    }

This seems to work as expected with my workflow.

@acmiyaguchi acmiyaguchi requested review from dlstadther and a team as code owners April 3, 2023 00:15
@acmiyaguchi acmiyaguchi changed the title Docker host options Add host_config_options to allow configuration of DockerTask for GPU resources Apr 3, 2023
@dlstadther dlstadther merged commit 154a4f7 into spotify:master Apr 21, 2023
34 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants