Hi folks.
Can we run Docker using GPUs on Prefect?
Any help would be appreciated.
o
Oscar Björhn
01/11/2024, 12:32 PM
Hey, I don't think you need to post this question in every channel.. You can delete the other ones.
👍 4
p
Petko
01/11/2024, 12:35 PM
Any answers to the question? If any help, I appriciate it.
r
Ryan Peden
01/11/2024, 2:56 PM
It doesn't look like the Docker worker currently supports setting docker-py's
device_requests
parameter, which would let you decide whether or not to use GPU(s) on a per-flow-deployment basis.
However, if you're willing to run a worker dedicated to running GPU-enabled flows, you can set an environment variable before you start the worker:
NVIDIA_VISIBLE_DEVICES=all
That should give you the same functionality you get when you use the Docker CLI with the
--gpus
flag.
p
Petko
01/24/2024, 7:08 AM
Tried that and does not work.
j
Janghoo Lee
02/27/2024, 9:25 AM
hi, I've also been looking for the same feature, but realized Prefect doesn't officially support it. Prefect offer a job template for Docker runners, which relies on the Docker Python SDK for backend operations, the job template lacks an option to pass through device settings. It seems that the only workaround might be to edit the '/etc/docker/daemon.json' file to set the Nvidia Docker runtime as the default. This appears to be the sole method for utilizing GPUs with Docker deployments in Prefect.
r
Ryan Peden
02/27/2024, 3:57 PM
It looks like someone opened a PR that should address this, but abandoned it before finishing it: https://github.com/PrefectHQ/prefect-docker/pull/85
It looks like it'd be easy to finish it. I'd like to use this functionality too, so I'll try to set aside some time this week to make the required changes, add some tests, and make sure GPU containers work as expected.
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.