Skip to content
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

Hardware Accelerated X server on a remote server with Singularity using x11docker? #206

Closed
emiftari opened this issue Dec 10, 2019 · 2 comments

Comments

@emiftari
Copy link

We followed the discussion of issue #188 and would like to use x11docker to provide a hardware accelerated X server on a remote system with Singularity. The host has Xpra installed and we use the --nv option of Singularity to bind the necessary Nvidia libs and binaries inside the containers. Xpra would start containerized applications as child processes. How should we start x11docker and get Xpra to use that X server?

What we basically want is mentioned in the following comment:

You can still use x11docker to run an X server and provide this X server to singularity applications.
Setting up X on a remote server with GPU support is out of scope of x11docker, but if you want to set this up, I'm happy to help with some hints.

@emiftari emiftari changed the title Hardware Accelerated X server on a remote server using x11docker? Hardware Accelerated X server on a remote server with Singularity using x11docker? Dec 10, 2019
@mviereck
Copy link
Owner

mviereck commented Dec 10, 2019

In #197 and #199 we found a setup for this conditions:

  • headless server
  • NVIDIA GPU
  • accelerated Xorg started by x11docker
  • remote access with xpra

This is quite similar to your request, I think.

Do you have a headless server / without a monitor?
If yes, you need to configure xorg.conf to provide a virtual monitor. Something like this should work:

 sudo nvidia-xconfig --allow-empty-initial-configuration --virtual=1280x1024

Create a script like this (and replace SINGULARITY_COMMAND with your desired application. Don't miss the --):

#! /bin/bash
read Xenv < <(x11docker --xorg --gpu --xtest --display=30 --showenv --exe -- SINGULARITY_COMMAND)
env $Xenv xpra start :30 --use-display --start-via-proxy=no --daemon=no

Run the script on the server.
On the client connect with: (replace USER@SERVER)

xpra attach ssh://USER@SERVER/30

Additional notes:

  • This example uses a defined display number 30 to make things easier. Otherwise x11docker would choose another one and you would need to parse $Xenv. However, the commands will fail if display number 30 is already in use. Try another display number than.
  • If you need to provide a .pem file for ssh, look at this example: Is it possible to tunnel SSH with Nvidia closed source driver? #197 (comment)
  • x11docker sets environment variables DISPLAY and XAUTHORITY before starting the command after --. I hope Singularity regards them on itself, or you can provide them somehow.
    • If the Singularity container cannot access /tmp/.X11-unix, e.g. because of a fakeroot setup, try x11docker option --xoverip.
    • If the Singularity container cannot access the file in XAUTHORITY, you can try x11docker option --no-auth. A non-authenticated X access is discouraged, especially if you use --xoverip. Other users in the network might get access without authentication.
  • Untested: Instead of --virtual=1280x1024 in nvidia-xconfig it might works to specify a desired screen size with x11docker option --size 1280x1024.

Setup alternatives:

#! /bin/bash
read Xenv < <(x11docker --xorg --gpu --xtest --display=30 --showenv --xonly)
env $Xenv xpra start :30 --use-display --start-via-proxy=no
env $Xenv SINGULARITY_COMMAND
#! /bin/bash
read Xenv < <(x11docker --xorg --gpu --xtest --display=30 --showenv --xonly)
env $Xenv xpra start :30 --use-display --start-via-proxy=no --start-child='SINGULARITY_COMMAND'

Alternative to x11docker: It is possible to develop a customized Xorg script based on the extended Xephyr script.
It would be much less code than x11docker and you could easily maintain and customize it yourself.

@mviereck
Copy link
Owner

Closing due to inactivity.

@emiftari Feel free to ask further questions, I am happy to reopen this ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants