我如何确定哪个 GPU 卡在 PCI Express 2.0 x16 上运行以及哪个使用 x8?

我如何确定哪个 GPU 卡在 PCI Express 2.0 x16 上运行以及哪个使用 x8?

有没有办法确定特定卡的 PCI Express 连接速度?我插入了三张卡:

两块 Nvidia GTX 480(一块为 x16,一块为 x8),一块 Nvidia GTX 460 以 x8 运行

有没有什么方法,可以通过 C 语言中的函数调用或选项来lspci确定显卡的总线速度?当我只为 CUDA 程序使用其中一张卡时,我想使用以 x16 运行的卡。

谢谢!

注意: lspci -vvv转储出来

对于两款 GTX 480,我没有发现与总线速度相关的任何差异。

03:00.0 VGA compatible controller: nVidia Corporation Device 06c0 (rev a3)
        Subsystem: eVga.com. Corp. Device 1480
        Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Latency: 0
        Interrupt: pin A routed to IRQ 16
        Region 0: Memory at d4000000 (32-bit, non-prefetchable) [size=32M]
        Region 1: Memory at b0000000 (64-bit, prefetchable) [size=128M]
        Region 3: Memory at bc000000 (64-bit, prefetchable) [size=64M]
        Region 5: I/O ports at df00 [disabled] [size=128]
        [virtual] Expansion ROM at b8000000 [disabled] [size=512K]
        Capabilities: <access denied>
        Kernel driver in use: nvidia
        Kernel modules: nvidia, nvidiafb, nouveau

03:00.1 Audio device: nVidia Corporation Device 0be5 (rev a1)
        Subsystem: eVga.com. Corp. Device 1480
        Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Interrupt: pin B routed to IRQ 5
        Region 0: [virtual] Memory at d7ffc000 (32-bit, non-prefetchable) [disabled] [size=16K]
        Capabilities: <access denied>

04:00.0 VGA compatible controller: nVidia Corporation Device 06c0 (rev a3)
        Subsystem: eVga.com. Corp. Device 1480
        Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Latency: 0
        Interrupt: pin A routed to IRQ 16
        Region 0: Memory at dc000000 (32-bit, non-prefetchable) [size=32M]
        Region 1: Memory at c0000000 (64-bit, prefetchable) [size=128M]
        Region 3: Memory at cc000000 (64-bit, prefetchable) [size=64M]
        Region 5: I/O ports at cf00 [size=128]
        [virtual] Expansion ROM at c8000000 [disabled] [size=512K]
        Capabilities: <access denied>
        Kernel driver in use: nvidia
        Kernel modules: nvidia, nvidiafb, nouveau

04:00.1 Audio device: nVidia Corporation Device 0be5 (rev a1)
        Subsystem: eVga.com. Corp. Device 1480
        Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
        Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
        Latency: 0, Cache Line Size: 64 bytes
        Interrupt: pin B routed to IRQ 5
        Region 0: Memory at dfffc000 (32-bit, non-prefetchable) [size=16K]
        Capabilities: <access denied>

我看到的唯一区别具体与内存映射有关:

myComputer:~> diff card1 card2
3c3
< Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
---
> Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
7,11c7,11
< Region 0: Memory at d4000000 (32-bit, non-prefetchable) [size=32M]
< Region 1: Memory at b0000000 (64-bit, prefetchable) [size=128M]
< Region 3: Memory at bc000000 (64-bit, prefetchable) [size=64M]
< Region 5: I/O ports at df00 [disabled] [size=128]
< [virtual] Expansion ROM at b8000000 [disabled] [size=512K]
---
> Region 0: Memory at dc000000 (32-bit, non-prefetchable) [size=32M]
> Region 1: Memory at c0000000 (64-bit, prefetchable) [size=128M]
> Region 3: Memory at cc000000 (64-bit, prefetchable) [size=64M]
> Region 5: I/O ports at cf00 [size=128]
> [virtual] Expansion ROM at c8000000 [disabled] [size=512K]
18c18
< Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
---
> Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
19a20
> Latency: 0, Cache Line Size: 64 bytes
21c22
< Region 0: [virtual] Memory at d7ffc000 (32-bit, non-prefetchable) [disabled] [size=16K]
---
> Region 0: Memory at dfffc000 (32-bit, non-prefetchable) [size=16K]

答案1

我尝试过这个:cat /var/log/Xorg.0.log | grep "NVIDIA"

它将显示卡及其所在的 PCI Express 插槽以及该插槽的宽度。例如:

20.502] (II) NVIDIA(0): NVIDIA GPU GeForce 9500 GT (G96) at PCI:1:0:0 (GPU-0)
[ 20.502] (--) NVIDIA(0): Memory: 1048576 kBytes
[ 20.502] (--) NVIDIA(0): VideoBIOS: 62.94.1f.00.8a
[ 20.502] (II) NVIDIA(0): Detected PCI Express Link width: 16X
[ 20.502] (--) NVIDIA(0): Interlaced video modes are supported on this GPU
[ 20.502] (--) NVIDIA(0): Connected display device(s) on GeForce 9500 GT at PCI:1:0:0
[ 20.502] (--) NVIDIA(0): Samsung SyncMaster (CRT-1)
[ 20.502] (--) NVIDIA(0): Samsung SyncMaster (CRT-1): 400.0 MHz maximum pixel clock

答案2

这是一个非常古老的问题,但正确做到这一点的方法是运行

sudo lspci -vv

对于每个 pci-e 设备,它都会列出 LnkSta,它会告诉您速度为 _ GT/s、Width x1。它还列出了 LnkCap,即链路容量。

2.5 GT/s = PCI-e gen 1,5 GT/s = PCI-e gen 2,8 GT/s = PCI-e gen 3,宽度为通道数。

相关内容