helfrichmichael / prusaslicer-novnc

Simple Docker container that serves Prusaslicer via noVNC in your web browser.
52 stars 20 forks source link

feat:add virutalgl for hardware accelrated opengl #15

Closed vajonam closed 2 months ago

vajonam commented 3 months ago

Add support for virtualGL.

This however means you need to get VirtualGL supported on the host this involved the following

Once the X server is up and running. Then this container will with fully accelerated

vajonam commented 3 months ago

@helfrichmichael its in a decent spot now. This approach with VirtualGL it need a Xserver and VirtualGL running on the host (which can be headless). And we will need to make that a pre-req. We will have to document steps to get that going. I tried so many things so need to understand what I did from a docs perspective. But folks who already are using Xsever this should be quite easy.

vajonam commented 3 months ago

Need a solution for firefox, because in 22.04 it runs from snapd, and I can't be bothered to get snapd to work inside a container for now that is missing.

helfrichmichael commented 3 months ago

Interestingly, I cannot get the GPU (NVidia RTX 3070) to passthrough with NVidia + WSL2 + Docker on Windows. Using the benchmark in https://docs.docker.com/desktop/gpu/ works just fine though.

image

Command I'm using to start it: docker run --detach --volume=prusaslicer-novnc-data:/configs/ --volume=prusaslicer-novnc-prints:/prints/ -p 8080:8080 -e SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt" -e ENABLEHWGPU=true -e NVIDIA_DRIVER_CAPABILITIES="all" -e NVIDIA_VISIBLE_DEVICES="all" --name=prusaslicer-novnc prusaslicer-novnc

Wondering if I've done something wrong to cause the GPU to not passthrough?

vajonam commented 3 months ago

You might need to set permissions on the card on the host.

In the VirtualGL package there is vglserver_config tool you can run and select EGL and select N on the permission options. Give that a try. That is a useful tool to setup the card and driver on the host.

Also I am not sure how nvidia implements EGL in windows drivers. You need to check about that.

On Thu, Apr 4, 2024 at 2:48 PM Mike Helfrich @.***> wrote:

Interestingly, I cannot get the GPU (NVidia RTX 3070) to passthrough with NVidia + WSL2 + Docker on Windows. Using the benchmark in https://docs.docker.com/desktop/gpu/ works just fine though.

image.png (view on web) https://github.com/helfrichmichael/prusaslicer-novnc/assets/9116898/3b22c3c2-39bc-4359-ad34-5ece677d9e8f

Command I'm using to start it: docker run --detach --volume=prusaslicer-novnc-data:/configs/ --volume=prusaslicer-novnc-prints:/prints/ -p 8080:8080 -e SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt" -e ENABLEHWGPU=true -e NVIDIA_DRIVER_CAPABILITIES="all" -e NVIDIA_VISIBLE_DEVICES="all" --name=prusaslicer-novnc prusaslicer-novnc

Wondering if I've done something wrong to cause the GPU to not passthrough?

— Reply to this email directly, view it on GitHub https://github.com/helfrichmichael/prusaslicer-novnc/pull/15#issuecomment-2037960902, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABFHNNTV2DUMKUYTJHVM33Y3WOAVAVCNFSM6AAAAABFVHXM6OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZXHE3DAOJQGI . You are receiving this because you authored the thread.Message ID: @.***>

vajonam commented 3 months ago

Also make sure you can read /dev/dri/card0 from inside the docker container this is that vglrun uses. So that's the first place to look along with the tool I mentioned above

vajonam commented 3 months ago

The GPU benchmark is testing out CUDA cores which are differnt from the EGL features virtualGL uses. AFAIK. I am no expert just got into this a few days ago!

vajonam commented 3 months ago

added code to launch firefox-esr as accelerated if ENABLEHWGPU is set.

helfrichmichael commented 3 months ago

Sorry again for the delay. I'll be reviewing and merging this tonight after work. It's been a busy few days.

helfrichmichael commented 2 months ago

Super sorry for the delayed review! Merging now and we'll address any bugs along the way. Thanks again!