--- lang: ja-jp breaks: true --- # Hyper-V で GPU を使用する 2021-06-14 > Hyper-VでGPU(3Dアクセラレーション)を利用する方法 Windows 10編 (GPU-P) > https://qiita.com/Hyper-W/items/3a2c7ff1d983deb80070 > Hyper-V GPU Passhthrough Notes > https://gist.github.com/skleinjung/3ffd6649da9c3d1f7228d47d2e595d69 > Working at all in 2019? #3083 > https://github.com/MicrosoftDocs/windowsserverdocs/issues/3083 > Hyper-VでDDA (Discrete Device Assignment) を使ってGPUパススルーをする(一応できるが難あり) > https://blog.lezoid.com/entry/2019/08/23/141414 > Hyper-V仮想マシンでDDAを利用したGPUパススルー > https://nashippe.blog/hv/gpu-passthrough/ ## 設定するバッチファイル ```bat= @set @dummy=0/* @echo off NET FILE 1>NUL 2>NUL if "%ERRORLEVEL%" neq "0" ( cscript //nologo //E:JScript "%~f0" %* exit /b %ERRORLEVEL% ) @echo on @set /P VMName="VMName: " rem powershell -Command "Set-VM -VMName %VMName% -GuestControlledCacheTypes $true -LowMemoryMappedIoSpace 3072MB -HighMemoryMappedIoSpace 30720MB" powershell -Command "Set-VM -GuestControlledCacheTypes $true -VMName %VMName%" powershell -Command "Set-VM -LowMemoryMappedIoSpace 1GB -VMName %VMName%" powershell -Command "Set-VM -HighMemoryMappedIoSpace 32GB -VMName %VMName%" powershell -Command "Add-VMGpuPartitionAdapter -VMName %VMName%" rem powershell -Command "Set-VMGpuPartitionAdapter -VMName %VMName% -MinPartitionVRAM 80000000 -MaxPartitionVRAM 100000000 -OptimalPartitionVRAM 100000000 -MinPartitionEncode 80000000 -MaxPartitionEncode 100000000 -OptimalPartitionEncode 100000000 -MinPartitionDecode 80000000 -MaxPartitionDecode 100000000 -OptimalPartitionDecode 100000000 -MinPartitionCompute 80000000 -MaxPartitionCompute 100000000 -OptimalPartitionCompute 100000000" rem powershell -Command "Set-VMGpuPartitionAdapter -VMName %VMName% -MinPartitionVRAM 1 -MaxPartitionVRAM 11 -OptimalPartitionVRAM 10 -MinPartitionEncode 1 -MaxPartitionEncode 11 -OptimalPartitionEncode 10 -MinPartitionDecode 1 -MaxPartitionDecode 11 -OptimalPartitionDecode 10 -MinPartitionCompute 1 -MaxPartitionCompute 11 -OptimalPartitionCompute 10" powershell -Command "Set-VMGpuPartitionAdapter -VMName %VMName%" powershell -Command "Start-VM -Name %VMName%" @pause @echo off goto :EOF */ var cmd = '"/c ""' + WScript.ScriptFullName + '" '; for (var i = 0; i < WScript.Arguments.Length; i++) cmd += '"' + WScript.Arguments(i) + '" '; (new ActiveXObject('Shell.Application')).ShellExecute('cmd.exe', cmd + ' "', '', 'runas', 1); ``` ## レジストリ設定 ```= Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\HyperV] "RequireSecureDeviceAssignment"=dword:00000000 "RequireSupportedDeviceAssignment"=dword:00000000 ``` ## 色々試した際のイベントログ ```= Date and time: 2021年6月14日 19:36:43 Level: エラー Log name: Microsoft-Windows-Hyper-V-Worker-Admin Source: Microsoft-Windows-Hyper-V-Worker Event ID: 12010 Task category: 0 Keyword: -9223372036854775808 User: NT VIRTUAL MACHINE\5080ABC8-4786-484F-B885-8E09629FFED3 Machine: XXXXXXXX Ope code: 情報 'Windows7_x64_VS2008' GPU Partition (インスタンス ID 92CD4AC0-A46F-436A-9422-A66BB5DC7B51): 電源をオンにできませんでした。エラー: 'システム リソースが不足しているため、要求されたサービスを完了できません。 ' (0x800705AA)。(仮想マシン ID 5080ABC8-4786-484F-B885-8E09629FFED3) ``` ```= Date and time: 2021年6月14日 19:36:43 Level: エラー Log name: Microsoft-Windows-Hyper-V-VMMS-Admin Source: Microsoft-Windows-Hyper-V-VMMS Event ID: 34520 Task category: 0 Keyword: -9223372036854775808 User: NT AUTHORITY\SYSTEM Machine: XXXXXXXX Ope code: 情報 現在設定されているグループ ポリシーに準拠している GPU デバイスがないため、GPU パーティションを割り当てることができませんでした。 詳細については、HyperV\RequireSecureDeviceAssignment および HyperV\RequireSupportedDeviceAssignmen を参照してください。 ``` ###### tags: `Hyper-V` `GPU`