How to prevent Xorg process from using the GPU? on Ubuntu 20.04.3 LTS (with a RTX 3050 Ti)

I want to preserve as much of the GPU memory as possible for deep learning processes. How can I prevent video processes from utilizing GPU resources?

Many solutions for older versions suggest to edit/create:
/etc/X11/xorg.conf

with:

Section “Device”
Identifier “intel”
Driver “modesetting”
BusID “PCI:0:2:0”
EndSection

There is no such file on my laptop.

What I want is to remove the following line in $ nvidia-smi

0 N/A N/A 1123 G /usr/lib/xorg/Xorg 896MiB

±----------------------------------------------------------------------------+
| NVIDIA-SMI 495.46 Driver Version: 495.46 CUDA Version: 11.5 |
|-------------------------------±---------------------±---------------------+
| 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:01:00.0 Off | N/A |
| N/A 58C P3 10W / N/A | 1468MiB / 3913MiB | 4% Default |
| | | N/A |
±------------------------------±---------------------±---------------------+

±----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 1123 G /usr/lib/xorg/Xorg 896MiB |
| 0 N/A N/A 1473 G /usr/bin/gnome-shell 110MiB |
| 0 N/A N/A 1909 G …AAAAAAAAA= --shared-files 187MiB |
| 0 N/A N/A 34218 G …AAAAAAAAA= --shared-files 268MiB |
±----------------------------------------------------------------------------+

Any updated solution?

Thanks

nvidia-bug-report.log.gz (1.4 MB)

1 Like

Please run nvidia-bug-report.sh as root and attach the resulting nvidia-bug-report.log.gz file to your post.

Just uploaded the file. Thanks

Just run
sudo prime-select on-demand
and reboot. This will run everything on the intel igpu, only leaving a 4MB process on the nvidia left.
If you also want to get of that, additionally create the file you mentioned in your first post, you’ll then have to make sure the nvidia-persistenced daemon is started on boot.

1 Like

Hey @generix , Well done! It was much simpler than I thought. Indeed, I have now my /usr/lib/xorg/Xorg process with only 4MB and nothing else. Exactly the kind of GPU optimization I was looking for.

Thanks a lot for your quick support.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.