Skip to content

Instantly share code, notes, and snippets.

@dan-osull
Created August 17, 2020 17:36
Show Gist options
  • Save dan-osull/28ad7b9a34c4e1f8325b3186e33acd00 to your computer and use it in GitHub Desktop.
Save dan-osull/28ad7b9a34c4e1f8325b3186e33acd00 to your computer and use it in GitHub Desktop.
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