How to fix "Failed to set CUDA device 0!" on WSL2 when trying to run spatial analysis container?

aaron lewis 0 Reputation points
2024-08-07T21:15:44.3333333+00:00

I'm in the process of following the tutorial for setting up the spatial analysis container on a local desktop machine with Windows 11 and WSL2, using Ubuntu 18.04 LTS.

Here is the documentation for the tutorial: https://video2.skills-academy.com/en-us/azure/ai-services/computer-vision/spatial-analysis-container?tabs=desktop-machine#install-docker-ce-and-nvidia-docker2-on-the-vm

I've been through the process a few times, trying different things, but can't seem to get anywhere. The whole thing seems to be set up correctly in azure and with registering my device as an edge device, but I get hung up when I deploy the spatial analysis container. I can confirm that all the containers are running (see image below), also reflected in the terminal when running docker ps.

User's image

I am not receiving any feedback or JSON events expected from the container. Everything I've seen online and from the countless experiments leads me to believe that it's an error in some interaction between WSL and my GPU or the NVIDIA CUDA Toolkit, but I could be wrong. After looking at the docker logs for the spatial analysis container, I see the following lines:

User's image

How can I get around this? If you have any experience or guidance, it would be greatly appreciated. Thank you!

Azure Computer Vision
Azure Computer Vision
An Azure artificial intelligence service that analyzes content in images and video.
366 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.