用于 Cuda (arch linux) 的多个 NVIDIA RTX GPU,带 EGPU

用于 Cuda (arch linux) 的多个 NVIDIA RTX GPU,带 EGPU

我有一个拱门Linux,笔记本电脑中有两个 GPU(Thinkpad P14s 第 4 代) + 通过 Thunderbolt 4 与 Cool Master EG200 GPU 外壳连接的新 RTX 3090:

❯ lspci -k | grep -A 2 -E "(VGA|3D)"
00:02.0 VGA compatible controller: Intel Corporation Raptor Lake-P [Iris Xe Graphics] (rev 04)
        Subsystem: Lenovo Raptor Lake-P [Iris Xe Graphics]
        Kernel driver in use: i915
--
03:00.0 3D controller: NVIDIA Corporation GA107GLM [RTX A500 Laptop GPU] (rev a1)
        Subsystem: Lenovo GA107GLM [RTX A500 Laptop GPU]
        Kernel driver in use: nvidia
--
22:00.0 VGA compatible controller: NVIDIA Corporation GA102 [GeForce RTX 3090] (rev a1)
        Subsystem: Gigabyte Technology Co., Ltd GA102 [GeForce RTX 3090]
        Kernel driver in use: nvidia

与 RTX 3090 的 Thunderbolt 连接已获得授权,如下所示:

❯ sudo boltctl info c4010000-0070-740e-0362-00168691c921
[sudo] password for aemonge: 
 ● Cooler Master Technology,Inc MasterCase EG200
   ├─ type:          peripheral
   ├─ name:          MasterCase EG200
   ├─ vendor:        Cooler Master Technology,Inc
   ├─ uuid:          c4010000-0070-740e-0362-00168691c921
   ├─ dbus path:     /org/freedesktop/bolt/devices/c4010000_0070_740e_0362_00168691c921
   ├─ generation:    Thunderbolt 3
   ├─ status:        authorized
   │  ├─ domain:     69078780-60ab-fe2a-ffff-ffffffffffff
   │  ├─ parent:     69078780-60ab-fe2a-ffff-ffffffffffff
   │  ├─ syspath:    /sys/devices/pci0000:00/0000:00:0d.2/domain0/0-0/0-1
   │  ├─ rx speed:   40 Gb/s = 2 lanes * 20 Gb/s
   │  ├─ tx speed:   40 Gb/s = 2 lanes * 20 Gb/s
   │  └─ authflags:  boot
   ├─ authorized:    Wed 24 Jan 2024 06:49:10 AM UTC
   ├─ connected:     Wed 24 Jan 2024 06:49:10 AM UTC
   └─ stored:        Tue 23 Jan 2024 03:50:50 PM UTC
      ├─ policy:     iommu
      └─ key:        no

我真的不关心图形,也不关心 xorg 中加载的 RTX3090 也不关心图形界面。我只是希望它用作仅计算工作负载,并且我已经完全关注了这个 arch wikihttps://wiki.archlinux.org/title/External_GPU

但考虑到这种情况,我nvidia-smi无法找到 GPU:

❯ nvidia-smi -L
GPU 0: NVIDIA RTX A500 Laptop GPU (UUID: GPU-762410c2-1c0d-ef4a-89ac-91afd926381b)

简单的 python 脚本也不能,cuda-devices.py:

❯ cat cuda-devics.py
import torch

# Check if CUDA is available
if torch.cuda.is_available():
    print("CUDA is available.")
    # Get the number of CUDA devices
    num_devices = torch.cuda.device_count()
    print(f"Number of CUDA devices: {num_devices}")
    # Get the name of each CUDA device
    for i in range(num_devices):
        print(f"Device {i} name: {torch.cuda.get_device_name(i)}")
else:
    print("CUDA is not available.")
❯ python cuda-devics.py
CUDA is available.
Number of CUDA devices: 1
Device 0 name: NVIDIA RTX A500 Laptop GPU

❯ CUDA_VISIBLE_DEVICES="0,1,2" python cuda-devics.py

CUDA is available.
Number of CUDA devices: 1
Device 0 name: NVIDIA RTX A500 Laptop GPU

我也尝试过这三个存储库https://github.com/ewagner12/all-ways-egpu, https://github.com/karli-sjoberg/gswitchhttps://github.com/hertg/egpu-switcher。禁用内部 GPU 的 A500 和 Iris Xe,但它正在闪烁(黑屏)。


解决了

解决了https://forums.developer.nvidia.com/t/multiple-nvidia-rtx-gpu-for-cuda-arch-linux-with-egpu/280031/7nvidia 开发者论坛,作者:

通用杰出贡献者 5 小时

请检查 BIOS 更新。如果没有可用,请使用软件和更新切换到“-open”驱动版本并设置内核参数 nvidia.NVreg_OpenRmEnableUnsupportedGpus=1

这意味着以下内容:

sudo pacman -S nvidia-open

/boot/loader/entries/*_linux.conf

# Created by: archinstall
# Created on: ***********
title   Arch Linux (linux)
linux   /vmlinuz-linux
initrd  /intel-ucode.img
initrd  /initramfs-linux.img
options root=PARTUUID=####-####-####### zswap.enabled=0 rw nvidia.NVreg_OpenRmEnableUnsupportedGpus=1 rootfstype=ext4

相关内容