-
Notifications
You must be signed in to change notification settings - Fork 379
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
Run with --gpu option and fail to get a glx context (remote server with NVIDIA GPU) #337
Comments
FYI, my NVIDIA Driver version:
|
With option Possibilities to use an NVIDIA GPU are described also in https://github.com/mviereck/x11docker/wiki/NVIDIA-driver-support-for-docker-container |
So here is the full output of using the example above:
Once I read the note, suggesting to use Full output:
This seems to be better than using Is there a way for me to test if Nvidia is loading up? I tried running this:
But I wasn't able to see any output through x11 forwarding, and I wasn't able to confirm by running
|
Also, I tried this, which I presume uses
And here's the output:
|
This is the note you should regard:
The NVIDIA driver is installed on host, but is needed in the container, too. You can either try the suggestion from the note or look at the alternatives explained in the wiki. Likely unrelated:
Can you show me |
Ok, neither of those directories exist. So I am creating the directory
Is it the case that if xpra is installed on the host, that it uses it by default? I think originally when I ran |
The file permissions are good, x11docker just needs read access; that is given for everyone. Now that the driver file is provided, x11docker should automatically install it in container if you use option
With proprietary NVIDIA driver and option |
Ok, the new output is:
So it shows that it is installing the driver, however, still isn't using Nvidia for Open GL. I also ran this just to see, and I can see it is running on my CPU:
Here is what you asked for:
I am running an x11docker on screen 30 right now, but it was just me testing something. Do I need to close all instances of x11docker? |
That looks good so far.
Indeed, it runs on CPU. Try:
No, that is not needed.
It seems display :11 is running over tcp instead over a unix socket. That is a quite unusual setup. Is that a custom setup of you? |
As for the Here is the output of
When I add the
Which looks like it's still running on CPU. |
What system do you run? Which desktop? Which display manager?
For further test runs it makes sense to always use
Yes. Can you show me |
I'm running Ubuntu 20.04. Originally installed the Server Edition. I used the apt package manager to install I am gathering the logs and will send you the link to them, thank you. |
@mviereck Here you go: https://pastebin.com/NFwQ6Xzm |
Some points I found so far, will look further tomorrow: Xorg seems to load the NVIDIA driver fom host (lines 1647-1652), but unloads it later for unknown reasons (lines 2081-2088):
Can you successfully use the NVIDIA GPU with host applications? I found this warning,missed it above:
Did you run all the commands over SSH? Using headless NVIDIA GPU over SSH is a quite special task. I wasn't aware that this is the situation we are speaking of. Somewhere is a ticket with a successful setup, will look for it tomorrow. |
Have a look at #199 |
So I made some progress thanks to what you mentioned here (#199 (comment)). I needed to add a virtual display to my Xorg.conf file.
Now, from within the container, I'm able to run
And when I run
If I wanted to document this for others, where should I add this to the wiki? Really appreciate your help on this, so it'd be great if I could contribute as well. |
So I'll pick this up again tomorrow, but I wanted to say, when I run this
So there is a difference between running the line above and running this script below that I want to nail down so I can fully understand it:
I was using this script above in my comment where I was able to run glxinfo and glxgears on the GPU from within the container. |
Great! Success so far. glxgears runs at the monitor refresh rate, I mostly get about 60 fps.
Surprising. Good that you found this!
If that works (output of
That would be nice! |
Thanks for all the help! At the end of this, I'll take a look at the wiki and run by you the various pages I think could be updated about it. And I'll draft up an article dedicated to this special setup, with specifics on This is pretty great progress, but here's the issue I'm running into. I'm actually able to get it to report the GPU with this command
If I'm running the above script, then I can't get glxinfo in a separate container to report the GPU. Even when adding Still, this is pretty great progress. Any ideas on how I can get multiple containers with GPU access going? |
Oh, and I tried running glxgears with
And I can see the FPS go to the full capacity of the GPU. |
Also, I'm not sure how this happened, but the size is not being set when I'm running the script again. I thought it might be due to the changed xorg.conf settings, so I went and commented out the lines I added for the virtual display, and I still get this:
|
Oh, now I see the reason: Only one Xorg at a time can use the GPU. Additional Xorg sessions can only use software rendering or have to wait for the GPU to be released. If I run multiple Xorg wih glxgears on a headfull system, i.e. with a monitor, and switch between the ttys, only the currently visible Xorg gets GPU access. On the other Xorgs glxgears is frozen until I switch back to its tty. So with this core setup only one container can use the GPU.
One possibility: Run only one Xorg with With MESA drivers we would have more secure possible setups. The closed source NVIDIA driver restricts x11docker to Another possibility I am not familiar with: docker provides an option
Not sure what happened here. Not sure about the correct syntax. Maybe:
or:
Just found this for two virtual displays on an intel GPU: https://askubuntu.com/a/1062889 This output is odd:
Can you show me the output of |
I ran some tests with a remote headless server with an intel GPU. Additional experiments with intel virtual heads and also with I wonder if NVIDIA really needs the Could you please update (
I am interested if you get a visible (after |
I tried the Also, I experimented with another container image and I was able to get multiple containers spun up, each with their own xorg servers running on the GPU. I don't know if any of what's being done in there can apply here, but thought I'd link it to you: https://github.com/ehfd/docker-nvidia-glx-desktop I will try omitting the |
Just FYI, to show the multiple Xorgs running concurrently with the container referenced above:
|
Also, the |
Great!
That is surprising. I'd expect it to be rather less performant.
By default applications use direct rendering, i.e. they directly communicate with the GPU. For x11docker this is of interest in some special use cases. For example, with In a nutshell:
That sounds interesting. I had a look and did not understand the full setup so far. From what I see:
Can you confirm that acceleration works on all of them simultaneously, not only on one of them at a time? |
Thanks for the info about iglx. That's quite interesting. I'll do some more testing to confirm that behavior. I'll also confirm that acceleration works on all of the Xorgs simultaneously. I wanted to let you know that I saw this in the news today, might be interesting to test within x11docker: Xwayland: Support hardware accelerated rendering with the proprietary NVIDIA driver |
I might have to dig deeper how his is possible. Currently I don't find the mind for investigation. If you find out more about this, please tell me!
Those are good news! So this might works within this year once NVIDIA catches up. Thank you for telling me. |
@mviereck FYI according to the author, selkies-project/docker-nvidia-glx-desktop#8 (comment)
|
That is quite interesting, thank you for the investigation! You can specify the TTY with x11docker option One possible issue comes to mind: If one Xorg terminates, it might release the TTY and thus crash the other Xorg instances. Edit: Just checked with intel GPU, but failed. Message of second Xorg:
|
I experimented in dind with two NVIDIA GPUs without privileged but Xorg doesn't manage to start because of an error on opening TTY. |
I am not sure, but I assume yes. However, it is possible to run multiple Xwayland instances on one Wayland compositor. |
This would surely mean a more plausible solution than now. https://github.com/ehfd/docker-nvidia-egl-desktop We have this now but this only supports OpenGL acceleration. Vulkan doesn't run at all. https://github.com/ehfd/docker-nvidia-glx-desktop This is improved by symlinking /dev/ptmx to /dev/tty7 and using the -novtswitch -sharevts options in Xorg. |
Your setups look interesting. Though, I cannot test them myself because I don't have NVIDIA hardware.
With open source MESA drivers this already works well. |
I am trying to follow an example found here: #198
I ran this:
And I have nvidia drivers installed on my host. I get the following error:
Am I missing something? I was hoping the
--gpu
option would suffice for passing the GPU through to my x11docker container and I'm not seeing that is the case. So I ran the test above, and I can see the same error that I was getting in the context of another container (x11docker/lxde-wine) when trying to run an openGL application.The text was updated successfully, but these errors were encountered: