
顯然我是一個 ubuntu 用戶,所以請原諒我可能犯的任何嚴重錯誤或我可能不具備的所需知識:D
預期的行為
我有一台Dell XPS13
最近安裝的筆記型電腦Ubuntu 20.04 focal
,我想透過Nvidia GTX 1660 SUPER
eGPU來改善視訊體驗Razor Core X
,最好使用外部顯示器上的輸出。
實際行為
除了外部顯示器上的黑屏之外,我從未成功地得到任何東西。
我嘗試過的
我在 BIOS 中啟用了 Thunderbolt 支持,並將其設置為不需要安全性,因此只要插入即可識別ubuntu-driver devices
。
ubuntu-drivers devices
== /sys/devices/pci0000:00/0000:00:1c.4/0000:03:00.0/0000:04:01.0/0000:06:00.0/0000:07:01.0/0000:08:00.0 ==
modalias : pci:v000010DEd000021C4sv00001462sd0000C758bc03sc00i00
vendor : NVIDIA Corporation
model : TU116 [GeForce GTX 1660 SUPER]
manual_install: True
driver : nvidia-driver-440 - distro non-free recommended
driver : nvidia-driver-440-server - distro non-free
driver : xserver-xorg-video-nouveau - distro free builtin
我已經運行,儘管我正確輸入了密碼,sudo ubuntu-driver autoinstall
但reboot
登入畫面不斷返回。
如果我拔掉 eGPU,我就可以透過登入畫面。
如果我重新連接它並運行nvidia-smi
我會得到:
sudo nvidia-smi
[sudo] password for andrei:
Tue Sep 8 17:55:42 2020
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.100 Driver Version: 440.100 CUDA Version: 10.2 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX 166... Off | 00000000:3C:00.0 Off | N/A |
| 0% 40C P0 12W / 130W | 0MiB / 5944MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+
其他注意事項:
- 我沒有
/etc/X11/xorg.conf
- 看起來
/usr/lib/modprobe.d/nvidia-graphics-drivers.conf
像這樣:
blacklist nouveau
blacklist lbm-nouveau
alias nouveau off
alias lbm-nouveau off
我也跑了nvidia-settings
,我得到了這個:
ERROR: Unable to load info from any available system
(nvidia-settings:4382): GLib-GObject-CRITICAL **: 18:09:30.505: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
** Message: 18:09:30.507: PRIME: Requires offloading
** Message: 18:09:30.507: PRIME: is it supported? yes
** Message: 18:09:30.534: PRIME: Usage: /usr/bin/prime-select nvidia|intel|on-demand|query
** Message: 18:09:30.534: PRIME: on-demand mode: "1"
** Message: 18:09:30.534: PRIME: is "on-demand" mode supported? yes
外接顯示器無輸出。
我還嘗試使用 ubuntu 圖形驅動程式儲存庫sudo apt-add-repository ppa:graphics-drivers/ppa
,並使用新推薦的驅動程式重複上面介紹的過程nvidia-driver-450
,但結果相似,主要是無法登入或登入畫面閃爍,遺憾的是透過外部顯示卡沒有輸出。
我也嘗試過使用egpu-switcher
“nvidia-config which , I guess mainly tried to create/modify the
/etc/X11/xorg.conf”,但是我的外部顯示器上從來沒有輸出(這是功能性的:),因為當同一條電纜直接連接到我的筆記型電腦時可以工作)。
如果有人能提出一些建議,為我以及提到的所有硬體和軟體以幸福的方式結束這種痛苦,我將不勝感激:)
謝謝你!
更新
運行nvidia-settings
正在記錄以下內容:
ERROR: Unable to load info from any available system
(nvidia-settings:20812): GLib-GObject-CRITICAL **: 01:58:56.002: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
** Message: 01:58:56.005: PRIME: Requires offloading
** Message: 01:58:56.005: PRIME: is it supported? yes
** Message: 01:58:56.039: PRIME: Usage: /usr/bin/prime-select nvidia|intel|on-demand|query
** Message: 01:58:56.039: PRIME: on-demand mode: "1"
** Message: 01:58:56.039: PRIME: is "on-demand" mode supported? yes
答案1
經過長時間的戰鬥,我實際上能夠主要根據以下評論解決我的問題:https://forums.developer.nvidia.com/t/nvidia-xconfig-doesnt-do-what-i-want-it-to-nor-does-nvidia-settings/107883/7
因此,我認為了解這一點至關重要,這xorg.conf
在這種情況下無法幫助您。無論我做什麼,當我有xorg.conf
.
對我有用的是:
- 刪除您可能嘗試過的所有 nvidia 內容: sudo apt --purge remove 'nvidia-*'
- 從 nvidia 網站下載最新的 Nvidia 驅動程式並使其可執行。
- 以恢復模式重新啟動(或不運行 ax 伺服器)並執行驅動程式安裝程序,即使它顯示您的系統上找不到 GPU
- 刪除
/etc/X11/xorg.conf
您可能擁有的任何內容 reboot
通常情況下nvidia-prime
如果尚未安裝,請安裝sudo prime-select nvidia
- 更新
/usr/share/X11/xorg.conf.d/10-amdgpu.conf
替換驅動程式modesetting
Section "OutputClass"
Identifier "AMDgpu"
MatchDriver "amdgpu"
Driver "modesetting"
EndSection
- 更新為類似:
Section "OutputClass"
Identifier "nvidia"
MatchDriver "nvidia-drm"
Driver "nvidia"
Option "AllowEmptyInitialConfiguration"
ModulePath "/usr/lib/x86_64-linux-gnu/nvidia/xorg"
Option "PrimaryGPU" "Yes"
Option "AllowExternalGpus" "True"
EndSection
- 建立兩個文件並
optimus.desktop
包含:/etc/xdg/autostart/
/usr/share/gdm/greeter/autostart/
[Desktop Entry]
Type=Application
Name=Optimus
Exec=sh -c "xrandr --setprovideroutputsource modesetting 0; xrandr --auto"
NoDisplay=true
X-GNOME-Autostart-Phase=DisplayServer
(@generix 在那裡說, modesetting NVIDIA-0;
但對我來說它從來沒有像那樣工作過。但它適用於modesetting 0;
)
reboot
通過運行測試一切是否正常:
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo | grep vendor
如果它不返回 nvidia 行,則情況不好 在我的情況下,我得到:
server glx vendor string: NVIDIA Corporation
client glx vendor string: NVIDIA Corporation
OpenGL vendor string: NVIDIA Corporation
另一個檢查是運行nvidia-smi
會至少列出一些進程。
我在外部顯示器上從 nvidia gpu 獲取訊號,正如我想要的:)
謝謝 ;)
答案2
還發現解決方案作者:@bluehipy 對於讓運行 Ubuntu 20.04 的 Acer Predator Helios 300 與外部顯示器配合使用以及正確安裝 NVIDIA/CUDA 堆疊以進行深度學習工作非常有幫助,因為它會造成問題。
我只是在考慮實際退回Acer Predator Helios 300 並查看帶有eGPU 的Dell XPS 13 是否可以在本地調試機器學習/數據科學模型並在雲端實際訓練時適用於“瘦客戶端”類型的工作流程時才發現此線程。
因此,如果其他人正在努力使他們的筆記型電腦正常工作,不妨對原始說明進行一些小調整?
先決條件:
sudo apt install gcc make mesa-utils mpich
安裝 NVIDIA 驅動程式
對我有用的是:
刪除您可能嘗試過的所有 nvidia 內容:
sudo apt --purge remove nvidia-*
原始說明說下載最新的驅動程序,但您可能希望從最新的 CUDA 工具包所以當你安裝東西的時候檢查一下那是什麼。可以使用最新的 NVIDIA 驅動程式嗎?你需要檢查老司機最有可能匹配 CUDA 工具包驅動程式版本,例如,在執行這些指令時,匹配版本為 470.57.02 (NVIDIA-Linux-x86_64-470.57.02.run)。
以恢復模式重新啟動(或不運行 ax 伺服器)並運行驅動程式安裝程序,即使它說在您的系統上找不到 GPU(刪除到根目錄,例如
cd ../home/username/Downloads
和./NVIDIA-Linux-x86_64-470.74.run
)刪除
/etc/X11/xorg.conf
您可能擁有的任何內容重新啟動(點擊
e
Ubuntu 的 grub 選單並添加nomodeset
在最後)如果尚未安裝 nvidia-prime,請安裝
sudo prime-select nvidia
更新
/usr/share/X11/xorg.conf.d/10-amdgpu.conf
替換驅動程式modesetting
Section "OutputClass"
Identifier "AMDgpu"
MatchDriver "amdgpu"
Driver "modesetting"
EndSection
sudo gedit /usr/share/X11/xorg.conf.d/10-nvidia.conf
使用以下內容建立 nvidia 設定檔 ( ):
Section "OutputClass"
Identifier "nvidia"
MatchDriver "nvidia-drm"
Driver "nvidia"
Option "AllowEmptyInitialConfiguration"
ModulePath "/usr/lib/x86_64-linux-gnu/nvidia/xorg"
Option "PrimaryGPU" "Yes"
Option "AllowExternalGpus" "True"
EndSection
10 建立兩個檔案並optimus.desktop
包含:/etc/xdg/autostart/
/usr/share/gdm/greeter/autostart/
[Desktop Entry]
Type=Application
Name=Optimus
Exec=sh -c "xrandr --setprovideroutputsource modesetting 0; xrandr --auto"
NoDisplay=true
X-GNOME-Autostart-Phase=DisplayServer
修改grub這樣 nomodeset 每次都會存在:
sudo gedit /etc/default/grub
重啟
通過運行測試一切是否正常:
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia glxinfo | grep vendor
檢查它
nvidia-smi
至少會列出一些進程。
| NVIDIA-SMI 470.57.02 Driver Version: 470.57.02 CUDA Version: 11.4 | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M.
| 0 NVIDIA GeForce ... Off | 00000000:01:00.0 On | N/A
| N/A 42C P8 14W / N/A | 264MiB / 5946MiB | 1% Default
安裝 CUDA 工具包
最新的 CUDA 工具包按照指示安裝時是cuda_11.4.2_470.57.02_linux.run
這樣安裝的,無需重新安裝NVIDIA驅動程式
wget https://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda_11.4.2_470.57.02_linux.run
sudo sh cuda_11.4.2_470.57.02_linux.run
驗證 CUDA 安裝
看https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#install-samples
先決條件:(如果你想正確編譯所有範例)從:
sudo apt-get install g++ freeglut3-dev build-essential libx11-dev \
libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev libfreeimage-dev
例如./deviceQuery
返回:
CUDA Device Query (Runtime API) version (CUDART static linking)
Detected 1 CUDA Capable device(s)
Device 0: "NVIDIA GeForce RTX 3060 Laptop GPU"
CUDA Driver Version / Runtime Version 11.4 / 11.4
CUDA Capability Major/Minor version number: 8.6
Total amount of global memory: 5947 MBytes (6235422720 bytes)
(030) Multiprocessors, (128) CUDA Cores/MP: 3840 CUDA Cores
GPU Max Clock rate: 1425 MHz (1.42 GHz)
...
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 11.4, CUDA Runtime Version = 11.4, NumDevs = 1
Result = PASS
cudnn安裝
請參閱來自的指南https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html
下載 cuDNN v8.2.4(2021 年 9 月 2 日),適用於 CUDA 11.4
-> 適用於 Linux (x86_64) 的 cuDNN 函式庫,例如cudnn-11.4-linux-x64-v8.2.4.15.tgz
答案3
我有一個類似的設置,一台運行 Ubuntu Mate 20.4 的 NUC,一台配備 NVidia RTX 2060 Super 的 Razor Core X。
基本上,我和你處於同一點,但沒有任何作用。然後我搞砸了一些事情,必須重新安裝 Ubuntu。不過,我是在插入 eGPU 機箱的情況下執行此操作的。
這時我發現了以下貼文:
https://egpu.io/forums/thunderbolt-linux-setup/ubuntu-19-04-easy-to-use-setup-script-for-your-egpu/
使用儲存庫中提供的腳本,我終於可以讓 GPU 運作了!我可以存取 CUDA,也可以使用兩個具有 eGPU 的外部顯示器。
我希望這個腳本也能幫助你。祝你好運。