我已经尝试了很多个小时在我的独立 NVIDIA GPU 上运行 Vulkan 应用程序。我在 ASUS ZenBook Pro K53SV 上运行 Ubuntu 22.04,它有一个 NVIDIA RTX 3050 Ti 移动 GPU。GPU 注册为 3D 适配器:
$ lspci -k
...
01:00.0 3D controller: NVIDIA Corporation GA107M [GeForce RTX 3050 Ti Mobile] (rev a1)
Subsystem: ASUSTeK Computer Inc. GA107M [GeForce RTX 3050 Ti Mobile]
Kernel driver in use: nvidia
Kernel modules: nvidiafb, nouveau, nvidia_drm, nvidia
...
05:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cezanne (rev c4)
Subsystem: ASUSTeK Computer Inc. Cezanne
Kernel driver in use: amdgpu
Kernel modules: amdgpu
...
我正在研究 GPGPU 计算,我想在我的专用 GPU 上运行基于 Vulkan 的应用程序。但是,Vulkan 通常不会检测到它:
$ vulkaninfo --summary
Can't open bumblebee display.
ERROR: [Loader Message] Code 0 : loader_scanned_icd_add: ICD libnv_vulkan_wrapper.so.1 doesn't support interface version compatible with loader, skip this ICD.
WARNING: lavapipe is not a conformant vulkan implementation, testing use only.
==========
VULKANINFO
==========
Vulkan Instance Version: 1.3.204
Instance Extensions: count = 19
-------------------------------
VK_EXT_acquire_drm_display : extension revision 1
VK_EXT_acquire_xlib_display : extension revision 1
VK_EXT_debug_report : extension revision 10
VK_EXT_debug_utils : extension revision 2
VK_EXT_direct_mode_display : extension revision 1
VK_EXT_display_surface_counter : extension revision 1
VK_KHR_device_group_creation : extension revision 1
VK_KHR_display : extension revision 23
VK_KHR_external_fence_capabilities : extension revision 1
VK_KHR_external_memory_capabilities : extension revision 1
VK_KHR_external_semaphore_capabilities : extension revision 1
VK_KHR_get_display_properties2 : extension revision 1
VK_KHR_get_physical_device_properties2 : extension revision 2
VK_KHR_get_surface_capabilities2 : extension revision 1
VK_KHR_surface : extension revision 25
VK_KHR_surface_protected_capabilities : extension revision 1
VK_KHR_wayland_surface : extension revision 6
VK_KHR_xcb_surface : extension revision 6
VK_KHR_xlib_surface : extension revision 6
Instance Layers: count = 3
--------------------------
VK_LAYER_MESA_device_select Linux device selection layer 1.2.73 version 1
VK_LAYER_MESA_overlay Mesa Overlay layer 1.2.199 version 1
VK_LAYER_PRIMUS_PrimusVK Primus-vk - https://github.com/felixdoerre/primus_vk 1.2.0 version 1
Devices:
========
GPU0:
apiVersion = 4202700 (1.2.204)
driverVersion = 1 (0x0001)
vendorID = 0x10005
deviceID = 0x0000
deviceType = PHYSICAL_DEVICE_TYPE_CPU
deviceName = llvmpipe (LLVM 13.0.1, 256 bits)
driverID = DRIVER_ID_MESA_LLVMPIPE
driverName = llvmpipe
driverInfo = Mesa 22.0.1 (LLVM 13.0.1)
conformanceVersion = 0.0.0.0
deviceUUID = 00000000-0000-0000-0000-000000000000
driverUUID = 00000000-0000-0000-0000-000000000000
GPU1:
apiVersion = 4206796 (1.3.204)
driverVersion = 92274689 (0x5800001)
vendorID = 0x1002
deviceID = 0x1638
deviceType = PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU
deviceName = AMD RADV RENOIR
driverID = DRIVER_ID_MESA_RADV
driverName = radv
driverInfo = Mesa 22.0.1
conformanceVersion = 1.2.7.1
deviceUUID = 00000000-0500-0000-0000-000000000000
driverUUID = 414d442d-4d45-5341-2d44-525600000000
阅读这我知道我可能会遇到一些叫做primus_vk。我花了一下午的时间安装正确的驱动程序,让 Bumblebee 成功运行 Firefox 等简单应用程序(显然,这是 primus_vk 正常工作的必要条件)。事实上:
$ optirun --status
Bumblebee status: Ready (3.2.1). X inactive. Discrete video card is likely on.
并且optirun firefox
运行正确,即使日志显示来自 amdgpu 的消息,这很奇怪:
Gtk-Message: 19:03:56.447: Failed to load module "canberra-gtk-module"
Gtk-Message: 19:03:56.448: Failed to load module "canberra-gtk-module"
ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.
amdgpu: os_same_file_description couldn't determine if two DRM fds reference the same file description.
If they do, bad things may happen!
ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.
Missing chrome or resource URL: resource://gre/modules/UpdateListener.jsm
Missing chrome or resource URL: resource://gre/modules/UpdateListener.sys.mjs
目标是成功使用pvkrun
。pvkrun firefox
产生与使用 optirun 时相同的输出,但遗憾的是pvkrun vulkaninfo --summary
输出
primus: fatal: failed to load any of the libraries: /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1
/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1: cannot open shared object file: No such file or directory
并挂起而不终止。我不知道这是否相关,但optirun vulkaninfo --summary
被 SEGV 终止。我尝试grep
在整个文件系统中对上面提到的路径进行“ing”,但是什么也没找到。任何帮助都将不胜感激。以下是我安装的相关 APT 包:
$ apt list --installed | grep nvidia
bumblebee-nvidia/jammy,now 3.2.1-27 amd64 [installato, automatico]
libnvidia-cfg1-515/jammy-updates,jammy-security,now 515.48.07-0ubuntu0.22.04.2 amd64 [installato, automatico]
libnvidia-compute-515/jammy-updates,jammy-security,now 515.48.07-0ubuntu0.22.04.2 amd64 [installato, automatico]
linux-objects-nvidia-510-5.15.0-25-generic/jammy,now 5.15.0-25.25 amd64 [installato, automatico]
linux-signatures-nvidia-5.15.0-25-generic/jammy,now 5.15.0-25.25 amd64 [installato, automatico]
nvidia-dkms-515/jammy-updates,jammy-security,now 515.48.07-0ubuntu0.22.04.2 amd64 [installato]
nvidia-kernel-common-515/jammy-updates,jammy-security,now 515.48.07-0ubuntu0.22.04.2 amd64 [installato]
nvidia-kernel-source-515/jammy-updates,jammy-security,now 515.48.07-0ubuntu0.22.04.2 amd64 [installato, automatico]
nvidia-prime/jammy,jammy,now 0.8.17.1 all [installato]
nvidia-primus-vk-common/jammy,now 1.6.1-1 amd64 [installato, automatico]
nvidia-primus-vk-wrapper/jammy,now 1.6.1-1 amd64 [installato, automatico]
nvidia-utils-515/jammy-updates,jammy-security,now 515.48.07-0ubuntu0.22.04.2 amd64 [installato]
primus-vk-nvidia/jammy,now 1.6.1-1 amd64 [installato]
xserver-xorg-video-nvidia-515/jammy-updates,jammy-security,now 515.48.07-0ubuntu0.22.04.2 amd64 [installato]
$ apt list --installed | grep bumblebee
bumblebee-nvidia/jammy,now 3.2.1-27 amd64 [installato, automatico]
bumblebee/jammy,now 3.2.1-27 amd64 [installato, automatico]
$ apt list --installed | grep vk
libprimus-vk1/jammy,now 1.6.1-1 amd64 [installato, automatico]
nvidia-primus-vk-common/jammy,now 1.6.1-1 amd64 [installato, automatico]
nvidia-primus-vk-wrapper/jammy,now 1.6.1-1 amd64 [installato, automatico]
primus-vk-nvidia/jammy,now 1.6.1-1 amd64 [installato]
primus-vk/jammy,jammy,now 1.6.1-1 all [installato, automatico]
编辑1
我注意到我的 Xorg 日志包含以下几行:
[ 274.008] (II) Loading sub module "glxserver_nvidia"
[ 274.008] (II) LoadModule: "glxserver_nvidia"
[ 274.008] (WW) Warning, couldn't open module glxserver_nvidia
[ 274.008] (EE) NVIDIA: Failed to load module "glxserver_nvidia" (module does not exist, 0)
[ 274.008] (EE) NVIDIA(0): Failed to initialize the GLX module; please check in your X
[ 274.008] (EE) NVIDIA(0): log file that the GLX module has been loaded in your X
[ 274.008] (EE) NVIDIA(0): server, and that the module is the NVIDIA GLX module. If
[ 274.008] (EE) NVIDIA(0): you continue to encounter problems, Please try
[ 274.008] (EE) NVIDIA(0): reinstalling the NVIDIA driver.
[ 274.008] (II) NVIDIA: The X server does not support PRIME Render Offload.
我无法理解如何使用此glxserver_nvidia
模块修复此问题,也不明白最后一行是否与问题无关。顺便问一下,切换到 Wayland 可以解决问题吗?
答案1
我搞错了驱动程序是否已安装。虽然我安装了问题中列出的所有与 NVIDIA 相关的软件包,但实际上我并没有安装nvidia-driver-515
。