This is a simple question which should be obvious but I've Googled and I don't see an answer.

If I set up X windows remotely like this: https://fabianlee.org/2018/10/14/ubuntu-x11-forwarding-to-view-gui-applications-running-on-server-hosts/

Can I share one Ubuntu box with another where both of us are running X windows, so both of us are hitting the graphics card?

NOTE: There is a similar question from 2010. Has anything changed or are the replies there the state of the art?

  • 1
    It's unclear what you are asking. A headless (application, file) server may run multiple X clients to different remote X-servers, but your reference to "both of us hitting the graphics card" make it seem that both remote uses are on the same remote system. Think of X-server as "X display server", none needed on the remote (app) server, just X clients for that machine. – ubfan1 May 23 at 15:18
  • I assumed that with a graphics application running on the server to create a visual display, the GPU is effectively being shared amongst multiple users. I don't know how well that works. I do know that the Switch User function is very buggy, I get a lot of crashes switching between two users on Ubuntu. – Lars Ericson May 23 at 17:08

Yes. Multiple users can run programs remotely. However, I would not say that users are using remote XWindows, because they aren't.

You have to run XServer on your computer, from where you login to remote computer. Remote computer does not need to run XWindows and its graphics card is not neded at all. It can be in text mode. It is a basic function of X11 present long before network and remote connections became so popular.

When you login remotely with X11 forwarding, your computer acts as an XServer. The program runs on a remote computer, but graphics commands are sent to XServer. Xserver receives X graphics commands and executes them. Executing X graphics commands, means drawing application's window and its content. The X protocol is so "smart" that it does not send the picture like VNC or other remote desktop applications. It sends X graphics commands to draw content, like draw line, arc, font, etc. That means, that the amount of network traffic is usually smaller than when sending the whole picture. The application will send only the window content. Your window manager needs to take care of window borders, title bar, etc.

When running a graphics program in linux/unix, you can always specify on which display you want to run it. That means that program logic will be executed on the computer, where it was started, while graphics commands will be sent to another computer, where XServer is running. The command

DISPLAY=remoteIP:0 xclock

will run xclock on the cumputer where command was executed. DISPLAY=remoteIP:0 means that graphics commands will be sent to display number 0 on remoteIP. You have to allow remote graphics connections on remoteIP, of course. If you want to try, xhost + on remotIP computer should allow any X graphics remote connections. Type

set | grep DISPLAY

on your computer and on computer where you login remotely with ssh -Y or ssh -X. You will probably see DISPLAY=:0 on local computer, which means programs will be displayed on default computer on display 0. When logged in with ssh, you will see something like DISPLAY=:11, which means X protocol is redirected via ssh to you computer. If you set the $DISPLAY variable to some other display (XServer), applications will be opened on another display.

You can log in remotely from Microsoft Windows, too. In that case, you have to run a XServer on your MS Windows.

As many users as can login remotely with SSH can therefore run graphics applications and show them on their screens as long as they use X11 forwarding and have running XServer on their computers.

If you would like to use the graphics card on remote computer, then you can use multiseat setup (https://wiki.ubuntu.com/Multiseat, https://www.freedesktop.org/wiki/Software/systemd/multiseat/). Multiseat setup means that more XWindows sessions are running on one computer. Each XWindows session typically has its keyboard, video and mouse hardware. In that case you can make VNC or similar connection to each Xwindows session. Then graphics card on a remote computer is used.

| improve this answer | |
  • If I run Jupyter notebook and do a plotting command, while logged in via X Windows, where does the plot calculation happen, on the server GPU or on the client GPU? It seems to me it would have to run on the server GPU. – Lars Ericson May 23 at 17:10
  • If you connect to a server from your laptop with ssh and X11 forwarding enabled, and execute a GUI application that is shown on your laptop, then your laptop GPU is processing graphics commands. App is running on server so server is executing the applications and sending X11 commands to XServer (Xorg) on your laptop using laptop GPU. XServer executes X11 commands and draws them on your screen. – nobody May 24 at 10:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.