收起左侧

现在飞牛支持调用HyperV Partion VGPU出来的显卡吗

5
回复
681
查看
[ 复制链接 ]

2

主题

6

回帖

0

牛值

江湖小虾

2025-6-28 10:58:45 显示全部楼层 阅读模式
悬赏1飞牛币已解决

飞牛目前没有docker安装的方式,希望能最大利用不支持vgpu的nVidia消费级显卡

在wsl2中 和 hyperv里都可以共享宿主机的nv显卡

目前有人尝试过可行方案吗

收藏
送赞 1
分享

3

主题

3610

回帖

560

牛值

共建版主

社区共建团荣誉勋章飞牛百度网盘玩家

2025-6-28 10:58:46 显示全部楼层
Wink_NxVqe 发表于 2025-6-28 11:36
看了一下,说的并不是一个东西
hyperv里的partion gpu不是nVidia的vgpu
vgpu是对gpu完全的虚拟化,可以在 ...

我不怎么玩win 的虚拟机,你百度找找debian12 的教程,他们基本通用的
我命由我不由天!是魔是仙,只有我自己说了算!

3

主题

3610

回帖

560

牛值

共建版主

社区共建团荣誉勋章飞牛百度网盘玩家

2025-6-28 11:32:14 显示全部楼层
论坛有人折腾过了,你可以去看看https://club.fnnas.com/forum.php ... 2667&highlight=
看了一下,说的并不是一个东西 hyperv里的partion gpu不是nVidia的vgpu vgpu是对gpu完全的虚拟化,可以在虚拟机里直接安装配套驱动 但是partition gpu是共享的宿主机gpu资源,通过拷贝驱动文件实现的,包括wsl2里的g  详情 回复
2025-6-28 11:36

2

主题

6

回帖

0

牛值

江湖小虾

2025-6-28 11:36:40 楼主 显示全部楼层
七月七夕 发表于 2025-6-28 11:32
论坛有人折腾过了,你可以去看看https://club.fnnas.com/forum.php?mod=viewthread&tid=12667&highlight= ...

看了一下,说的并不是一个东西
hyperv里的partion gpu不是nVidia的vgpu
vgpu是对gpu完全的虚拟化,可以在虚拟机里直接安装配套驱动
但是partition gpu是共享的宿主机gpu资源,通过拷贝驱动文件实现的,包括wsl2里的gpu共享也是

0

主题

6

回帖

0

牛值

江湖小虾

2025-8-10 22:22:46 显示全部楼层

我试了,不识别显卡https://club.fnnas.com/forum.php?mod=viewthread&tid=13952&page=1&authorid=76953

脚本地址:https://github.com/eric-gitta-moore/oneclick-gpu-pv/blob/main/dxgkrnl.sh

主要是fnos这个内核版本有点高,得改点东西能才装上dxgkrnl驱动。测试可以调opengl和cuda了,但是飞牛不识别,搞不懂飞牛是怎么写的判断,技术看下go代码才知道,逆向还有点困难。

目前症状是/p/api/v1/ai-base/gpu和/v/api/v1/server/gpu/list都没有显卡信息。可行是肯定可行,要飞牛技术看下怎么判定的显卡。是在不行得逆向给他hardcode一下

我主要也是不想另外搞个本子或者nas跑,用本身这台台式就够了。也到这块去了

持续关注~

1

查看全部评分

0

主题

6

回帖

0

牛值

江湖小虾

2025-8-12 01:34:07 显示全部楼层
我猜测飞牛可能用的是 https://github.com/jaypipes/ghw/ 来检测显卡列表的。目前这个库 ghw.GPU() 出不来 WSL 里面的 vgem 驱动显卡,但是 ghw.Accelerator() 可以识别得到 3D 加速设备

已经给 ghw 那边提了 issue https://github.com/jaypipes/ghw/ ... ecomment-3176005171

但是我感觉飞牛是不是也可以不一定要使用 ghw.GPU(),可能考虑兼容一下 vgem 驱动的显卡?要是等上游修复这个 bug 然后飞牛在更新等的黄花菜都凉了

具体代码
  1. package main

  2. import (
  3.     "fmt"
  4.     "github.com/jaypipes/ghw"
  5. )

  6. func main() {
  7.     gpu, err: = ghw.GPU()
  8.     if err != nil {
  9.         fmt.Printf("Error getting GPU info: %v", err)
  10.     }
  11.     fmt.Printf("%v\n", gpu)
  12.     for _, card: = range gpu.GraphicsCards {
  13.         fmt.Printf(" %v\n", card)
  14.     }

  15.     fmt.Printf("=====\n")
  16.     accel, err: = ghw.Accelerator()
  17.     if err != nil {
  18.         fmt.Printf("Error getting processing accelerator info: %v", err)
  19.     }

  20.     fmt.Printf("%v\n", accel)
  21.     for _, device: = range accel.Devices {
  22.         fmt.Printf(" %v\n", device)
  23.     }

  24. }
复制代码
输出
  1. root@fnasfnas1:/tmp/test# go run main.go
  2. gpu (0 graphics cards)
  3. =====
  4. processing accelerators (1 device)
  5. device @d8f8:00:00.0 -> driver: 'dxgkrnl' class: 'Display controller' vendor: 'Microsoft Corporation' product: 'Basic Render Driver'
复制代码
系统信息
  1. root@fnasfnas1:/tmp/test# lspci -v
  2. d8f8:00:00.0 3D controller: Microsoft Corporation Basic Render Driver
  3.         Physical Slot: 1349682479
  4.         Flags: bus master, fast devsel, latency 0, NUMA node 0
  5.         Capabilities: [40] Null
  6.         Kernel driver in use: dxgkrnl
  7.         Kernel modules: dxgkrnl

  8. root@fnasfnas1:/tmp/test# lspci -vn
  9. d8f8:00:00.0 0302: 1414:008e
  10.         Physical Slot: 1349682479
  11.         Flags: bus master, fast devsel, latency 0, NUMA node 0
  12.         Capabilities: [40] Null
  13.         Kernel driver in use: dxgkrnl
  14.         Kernel modules: dxgkrnl

  15. root@fnasfnas1:/tmp/test# lsmod | grep dxg
  16. dxgkrnl               225280  0
  17. hv_vmbus              176128  9 hv_balloon,hv_utils,hv_netvsc,hid_hyperv,dxgkrnl,hv_storvsc,hyperv_keyboard,pci_hyperv,hyperv_fb

  18. root@fnasfnas1:/tmp/test# lsmod | grep vgem
  19. vgem                   12288  0
  20. drm_shmem_helper       36864  1 vgem
  21. drm                   757760  4 drm_kms_helper,drm_shmem_helper,vgem

  22. root@fnasfnas1:/tmp/test# ll /dev/dri/
  23. by-path/    card0       renderD128  

  24. root@fnasfnas1:/tmp/test# ll /dev/dri/
  25. total 0
  26. drwxr-xr-x  3 root root        100 Aug 12 00:00 .
  27. drwxr-xr-x 20 root root       3480 Aug 12 00:00 ..
  28. drwxr-xr-x  2 root root         80 Aug 12 00:00 by-path
  29. crw-rw----  1 root video  226,   0 Aug 12 00:00 card0
  30. crw-rw----  1 root render 226, 128 Aug 12 00:00 renderD128

  31. root@fnasfnas1:/tmp/test# ll /dev/dri/card0
  32. crw-rw---- 1 root video 226, 0 Aug 12 00:00 /dev/dri/card0

  33. root@fnasfnas1:/tmp/test# ll /sys/class/drm/
  34. total 0
  35. drwxr-xr-x  2 root root    0 Aug 12 00:00 .
  36. drwxr-xr-x 53 root root    0 Aug 12 00:00 ..
  37. lrwxrwxrwx  1 root root    0 Aug 12 00:00 card0 -> ../../devices/platform/vgem/drm/card0
  38. lrwxrwxrwx  1 root root    0 Aug 12 00:00 renderD128 -> ../../devices/platform/vgem/drm/renderD128
  39. -r--r--r--  1 root root 4096 Aug 12 00:01 version

  40. root@fnasfnas1:~# glxinfo -B
  41. name of display: localhost:10.0
  42. display: localhost:10  screen: 0
  43. direct rendering: Yes
  44. Extended renderer info (GLX_MESA_query_renderer):
  45.     Vendor: Microsoft Corporation (0xffffffff)
  46.     Device: D3D12 (NVIDIA GeForce RTX 3060) (0xffffffff)
  47.     Version: 22.3.6
  48.     Accelerated: yes
  49.     Video memory: 44776MB
  50.     Unified memory: no
  51.     Preferred profile: core (0x1)
  52.     Max core profile version: 4.2
  53.     Max compat profile version: 4.2
  54.     Max GLES1 profile version: 1.1
  55.     Max GLES[23] profile version: 3.1
  56. OpenGL vendor string: Microsoft Corporation
  57. OpenGL renderer string: D3D12 (NVIDIA GeForce RTX 3060)
  58. OpenGL core profile version string: 4.2 (Core Profile) Mesa 22.3.6
  59. OpenGL core profile shading language version string: 4.20
  60. OpenGL core profile context flags: (none)
  61. OpenGL core profile profile mask: core profile

  62. OpenGL version string: 4.2 (Compatibility Profile) Mesa 22.3.6
  63. OpenGL shading language version string: 4.20
  64. OpenGL context flags: (none)
  65. OpenGL profile mask: compatibility profile

  66. OpenGL ES profile version string: OpenGL ES 3.1 Mesa 22.3.6
  67. OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10

  68. root@fnasfnas1:~# nvi
  69. nvidia-ngx-updater  nvidia-smi
  70. root@fnasfnas1:~# nvidia-smi
  71. Tue Aug 12 01:12:25 2025
  72. +-----------------------------------------------------------------------------------------+
  73. | NVIDIA-SMI 575.64.04              Driver Version: 577.00         CUDA Version: 12.9     |
  74. |-----------------------------------------+------------------------+----------------------+
  75. | GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
  76. | Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Com** M. |
  77. |                                         |                        |               MIG M. |
  78. |=========================================+========================+======================|
  79. |   0  NVIDIA GeForce RTX 3060        On  |   00000000:01:00.0  On |                  N/A |
  80. |  0%   51C    P0             35W /  170W |    5243MiB /  12288MiB |      7%      Default |
  81. |                                         |                        |                  N/A |
  82. +-----------------------------------------+------------------------+----------------------+

  83. +-----------------------------------------------------------------------------------------+
  84. | Processes:                                                                              |
  85. |  GPU   GI   CI              PID   Type   Process name                        GPU Memory |
  86. |        ID   ID                                                               Usage      |
  87. |=========================================================================================|
  88. |  No running processes found                                                             |
  89. +-----------------------------------------------------------------------------------------+
复制代码
显然,在 Debian 12 中,Hyper-V 集成的 GPU-PV 可以访问显卡。然而,这仅仅是桥接操作。Debian 上并没有链接任何 NVIDIA PCIe 设备。
而在 WSL 中,使用 /vgem - Virtual GPU Graphics Memory Manager 注册的 GPU 设备正在被使用,因此我们可能无法获取 pciAddress 。
vgem card0 对应的实际地址是 /sys/devices/platform/vgem/drm/card0 。
正则表达式 101: https://regex101.com/r/zgfOA8/1

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
1

查看全部评分

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则