By Steve McAtee
I’m using Pytorch in a python program that is in a docker container. When I run it I cannot see the GPU or detect it. I’ve launched an AMD GPU Droplet that should have rocm already installed on host.
I’m running the container with docker run --device /dev/kfd --device /dev/dri --security-opt seccomp=unconfined
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hey!
What base image are you using in your container? If it’s not one of the official ROCm supported images (like rocm/pytorch
), that might be part of the issue.
You’re already passing the right flags with --device=/dev/kfd
and /dev/dri
, but sometimes it still won’t detect the GPU unless the container has everything set up for ROCm.
Might also be worth running rocminfo
or hipinfo
inside the container to see if anything shows up at all.
If it’s still not working, could be something subtle with the setup. I’d suggest reaching out to DigitalOcean support at do.co/support. They might be able to confirm whether ROCm is fully set up and available for your Droplet.
- Bobby
Heya, @stevemcatee
If your container isn’t using a ROCm-ready base image (like rocm/pytorch or an Ubuntu image with ROCm installed), PyTorch won’t see the GPU. --device=/dev/kfd
and /dev/dri
are needed, but sometimes /dev/dri/renderD128
helps too. Always test with rocminfo or rocm-smi inside the container — if those don’t see the GPU, PyTorch won’t either.
If you’ve got the right base image and devices but it still fails, it’s worth checking with DigitalOcean support to confirm the host’s ROCm drivers are set up correctly for your Droplet type.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.