-
Notifications
You must be signed in to change notification settings - Fork 39
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 support for GPU acceleration in Windows (only NVIDIA validated) #476
base: humble-devel
Are you sure you want to change the base?
Conversation
Sadly I cannot test this in Windows. If someone else can test it, it would be appreciated |
I have the same problem, I can't test it in Windows |
Maybe @codezerro can help? |
@dpascualhe how can i help you? |
@codezerro we need to validate that the new version of the introspection script for GPU selection in this PR is working as expected for Windows environments. Given that it is just a single file, the easier way for me to test it is to simply run the latest RoboticsBackend container, copy the updated file, and then manually launch the entrypoint. Instructions (all of them must be run from a WSL2 environment with working CUDA drivers; check that you can run
docker run --hostname my-postgres --name academy_db -d -e POSTGRES_DB=academy_db -e POSTGRES_USER=user-dev -e POSTGRES_PASSWORD=robotics-academy-dev -e POSTGRES_PORT=5432 -d -p 5432:5432 jderobot/robotics-database:latest
docker run --rm -it $(nvidia-smi >/dev/null 2>&1 && echo "--gpus all" || echo "") -v /usr/lib/wsl:/usr/lib/wsl -e LD_LIBRARY_PATH=/usr/lib/wsl/lib --device /dev/dri -p 6080:6080 -p 1108:1108 -p 7163:7163 -p 7164:7164 --link academy_db --entrypoint /bin/bash jderobot/robotics-academy:latest
docker cp set_dri_name.sh <robotics backend container id>:set_dri_name.sh
./entrypoint.sh Things we need to check:
(@javizqh @dduro2020 maybe this is a weird process? let me know if you think there's a more straightforward approach) |
If you are not building a RADI to test, I cannot think of an easier way to test it |
@dpascualhe let me some time. |
@dpascualhe first attempt was not very good. I faced some technical issues. I'll update you when I get some results. |
Issues due to the WSL2+CUDA+Docker environment or RoboticsAcademy? |
@dpascualhe i done it successfully, but some tasks are unclear to me. you can use my system. |
From @codezerro PC (Windows 11 + CUDA 12.7 + WSL with Ubuntu 24.04), after following the instructions the above:
A screenshot for further proof: @javizqh , from my side, I consider the changes in this PR sufficiently validated for merging (being aware that our testing pool for different Windows/WSL/CUDA configurations has been small) |
Have you checked that it still works fine in Linux @dpascualhe? If so I will merge it. |
We have been able to achieve GPU acceleration for NVIDIA GPUs in Windows when launching from within WSL2. The user needs to have a valid installation of WSL2 + CUDA and Docker Desktop, and the Docker container must be launched from within the WSL2 terminal. Some extra flags are required in the
docker run
command:docker run -it --gpus all -v /usr/lib/wsl:/usr/lib/wsl -e LD_LIBRARY_PATH=/usr/lib/wsl/lib --device /dev/dri -p 7164:7164 -p 6080:6080 -p 1108:1108 -p 7163:7163 jderobot/robotics-academy:latest)
Output from the script:
Oddly enough, all GPUs seem to be visible within the WSL, but they are disguised as Microsoft devices so the actual vendor information can't be accessed. We'll have to settle with 'Microsoft' vendor for now. The new
set_dri_name.sh
adds Microsoft vendor as the last resort, checks if there is any card available in/dev/dri
, and keeps the first one. It also checks if nvidia-smi can be run from within the container, which would mean that the selected GPU is likely to be NVIDIA. In dual GPU systems I have not been able to access Intel GPUs, so further testing would be required in that regard.