20

On an fresh Ubuntu 20.04 Server machine with 2 Nvidia GPU cards and i7-5930K, running nvidia-smi shows that 170 MB of GPU memory is being used by /usr/lib/xorg/Xorg.

Since this system is being used for deep learning, we will like to free up as much GPU memory as possible.

Question: How can we prevent gnome and Xorg from taking up 179 MB of GPU memory?

Output of nvidia-smi

Sat Oct  3 20:27:19 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.66       Driver Version: 450.66       CUDA Version: 11.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  GeForce GTX 1080    Off  | 00000000:02:00.0 Off |                  N/A |
|  0%   54C    P8    11W / 210W |      7MiB /  8119MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   1  GeForce GTX 1080    Off  | 00000000:03:00.0 Off |                  N/A |
|  0%   50C    P8    10W / 210W |    179MiB /  8116MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      1109      G   /usr/lib/xorg/Xorg                  4MiB |
|    1   N/A  N/A      1109      G   /usr/lib/xorg/Xorg                166MiB |
|    1   N/A  N/A      1189      G   /usr/bin/gnome-shell                9MiB |
+-----------------------------------------------------------------------------+
Nyxynyx
  • 993
  • 5
  • 12
  • 27
  • Possible: https://askubuntu.com/questions/869496/force-xorg-to-use-cpu-not-gpu Unfortunately I don't have a way to verify it since I only use 1 video card in my system. – Terrance Oct 03 '20 at 20:56

3 Answers3

8

I had the same issue. Many of the suggestions were saying to edit /etc/X11/xorg.conf which doesn't exist for me on Ubuntu 20.04. I needed to keep X11 because I occasionally use X2go or X11 over SSH. I did manage to find a file /usr/share/X11/xorg.conf.d/10-nvidia.conf and then commented out all the lines with #. I was then able to restart X11 with:

sudo systemctl restart display-manager

Voilà, no more GNOME/X11 on GPU.

$ nvidia-smi
Wed Feb  3 19:44:02 2021       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.102.04   Driver Version: 450.102.04   CUDA Version: 11.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  GeForce RTX 208...  Off  | 00000000:01:00.0 Off |                  N/A |
| 27%   33C    P8     1W / 250W |    882MiB / 11019MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
|   1  GeForce GTX 1070    Off  | 00000000:4D:00.0 Off |                  N/A |
|  0%   41C    P8    10W / 151W |      2MiB /  8119MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A   1075324      C   python                            879MiB |
+-----------------------------------------------------------------------------+
vozman
  • 210
  • 2
  • 6
robmsmt
  • 391
  • 3
  • 6
  • 2
    I commented out everything in `/usr/share/X11/xorg.conf.d/10-nvidia.conf`, then restart the display manager as you said. Then my max resolution drop to 1024. – Tai Christian Oct 29 '21 at 10:04
  • 1
    Careful! I commented out everthing as well but when i commanded systemctl restart, screen went black and did not come back even after several reboots. I had to open the recovery mode root shell and removed commented lines. – alercelik Oct 15 '22 at 19:21
  • 1
    For a remote computer for deep learning processing, it works pretty well. No issue with the resolution drop over an ssh terminal. – David Beauchemin Feb 17 '23 at 10:21
2

I have a setup with Nvidia 2080 GPU. I have observed that remoting into the machine via xrdp leads to a GPU use of only 14 Mb. If a physical screen is connected, it consumes the memory as per the screenshot posted above.

Edit: Even chrome remote desktop leads to xorg consuming just 14 Mb of GPU RAM

Sud Ka
  • 21
  • 3
1

I just figured out today that since I am remote ssh to server, and most the gpu memory is consumed by gnome_shell and xorg, I can simplify "turn off the auto-login" then my gpu memory usaged is reduced from 450MB to 68MB. That's good enough to me.

(base) ➜  /boot nvidia-smi
Sat Apr 15 18:30:57 2023
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.105.17   Driver Version: 525.105.17   CUDA Version: 12.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:26:00.0  On |                  N/A |
|  0%   53C    P8    19W / 240W |     72MiB /  8192MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A     69418      G   /usr/lib/xorg/Xorg                 61MiB |
|    0   N/A  N/A     69559      G   /usr/bin/gnome-shell                7MiB |
+-----------------------------------------------------------------------------+
Houcheng
  • 121
  • 2