Forked from dan-osull/Switch-HyperVGpuPartitionAdapter.ps1
Created
October 2, 2020 02:12
-
-
Save seffyroff/3163425ecd3fae2df9b9b47a34a67310 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[Parameter(Mandatory)][string]$vmName | |
) | |
$InformationPreference = "Continue" | |
$ErrorActionPreference = "Stop" | |
try { | |
$vmPartitionAdapter = Get-VMGpuPartitionAdapter -VMName $vmName | |
if ($vmPartitionAdapter) { | |
Write-Information "Removing Partition Adapter. Checkpoints work." | |
$vmPartitionAdapter | Remove-VMGpuPartitionAdapter | |
} | |
else { | |
Write-Information "Adding Partition Adapter. Checkpoints no longer work." | |
Add-VMGpuPartitionAdapter -VMName $vmName | |
$vmPartitionAdapter = Get-VMGpuPartitionAdapter -VMName $vmName | |
$adapterConfig = @{ | |
# 100% of values from my system's Get-VMPartitionableGpu | |
# Not sure why PartitionEncode uses 2^64 or if this is a good idea to set... | |
MaxPartitionEncode = 18446744073709551615 | |
OptimalPartitionEncode = 18446744073709551615 | |
MaxPartitionDecode = 100000000 | |
OptimalPartitionDecode = 100000000 | |
MaxPartitionCompute = 100000000 | |
OptimalPartitionCompute = 100000000 | |
MaxPartitionVRAM = 100000000 | |
OptimalPartitionVRAM = 100000000 | |
# 80% of values | |
MinPartitionEncode = 14757395258967641292 | |
MinPartitionDecode = 80000000 | |
MinPartitionCompute = 80000000 | |
MinPartitionVRAM = 80000000 | |
} | |
$vmPartitionAdapter | Set-VMGpuPartitionAdapter @adapterConfig | |
$vmPartitionAdapter | |
} | |
} | |
catch { | |
Write-Error $_ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment