【本文适用环境:Redhat或CentOS】
前提:nvidia-smi能正常读取GPU卡信息
关闭gdm
[root@host ~]# systemctl stop gdm
查询系统下是否存在/etc/X11/xorg.conf文件,如果不存在则执行下述步骤生成配置文件
[root@host ~]# nvidia-xconfig --query-gpu-info
Number of GPUs: 1
GPU #0:
Name : A10
UUID : GPU-dadxxxxxxxxxxxx
PCI BusID : PCI:11:0:0
Number of Display Devices: 0
基于获取的PCI BusID生成配置文件
[root@host ~]# nvidia-xconfig -a --busid=PCI:11:0:0
WARNING: Unable to locate/open X configuration file.
New X configuration file written to '/etc/X11/xorg.conf'
注意/etc/X11/xorg.conf的BusID为十进制,nvidia-smi输出的Bus-Id为十六进制
开启gdm
[root@host ~]# systemctl start gdm
如果系统下没有/etc/X11/xorg.conf,则开启gdm时,X会在CPU上创建。系统的/etc/X11/xorg.conf配置正确,则开启gdm时,X会在GPU上创建,可通过nvidia-smi查询看到进程
[root@host ~]# nvidia-smi
......
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 17146 G /usr/bin/X 63MiB |
| 0 N/A N/A 17210 G /usr/bin/gnome-shell 16MiB |
+-----------------------------------------------------------------------------+
/etc/X11/xorg.conf配置错误时,gdm服务也能开启,但查看gdm状态会输出:
Dec 19 18:24:00 host gdm[30131]: GdmLocalDisplayFactory: maximum number of X display failures reached: check X server log for errors
可根据xorg日志分析原因,日志为/var/log/Xorg.*.log*
如果配置文件中的BusID写错了,则xorg日志中会出现报错信息:
/var/log/xorg.log (ee) no devices detected
标签:xorg,etc,conf,GPU,X11,gdm
From: https://blog.csdn.net/qq_39534108/article/details/144672311