Last active
February 3, 2021 11:50
-
-
Save Xeckt/784b1d43b4a62c3a04924d1f57954e0d to your computer and use it in GitHub Desktop.
Set NVIDIA GPU to TCC or WDDM
This file contains 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
$smi_location = "" | |
$smi_exe = "nvidia-smi.exe" | |
$global:gpu_id = "" | |
$tcc_id = 1 | |
$wddm_id = 0 | |
function get_gpu_uuid() { | |
Write-Output "Getting GPU UUID..." | |
$global:gpu_id = cd $smi_location | .\nvidia-smi.exe --query | findstr "UUID" | |
$global:gpu_id = $global:gpu_id -replace ".* " | |
$global:gpu_id = $global:gpu_id.Trim() | |
Write-Output "Done, UUID is: $global:gpu_id" | |
} | |
function get_smi_dir() { | |
Write-Output "Checking for nvidia-sli.exe existence in C:\..." | |
Get-ChildItem -Path C:\ -Filter $smi_exe -Recurse -ErrorAction SilentlyContinue -Force | findstr -i Directory | |
$smi_location = Read-Host "Please copy/paste a directory found above (if any): > " | |
$smi_location = $smi_location.Trim() # Just incase of any whitespace during paste. | |
} | |
function set_tcc() { | |
Write-Output "Setting $global:gpu_id to TCC mode." | |
cd $smi_location | .\nvidia-smi.exe -g $global:gpu_id -dm $tcc_id | |
} | |
function set_wddm() { | |
Write-Host "Setting $global:gpu_id to WDDM mode." | |
cd $smi_location | .\nvidia-smi.exe -g $global:gpu_id -dm $wddm_id | |
} | |
function main() { | |
$tcc_or_wddm = Read-Host "Would you like to set your GPU to TCC or WDDM? [tcc/wddm] >> " | |
if ($tcc_or_wddm -eq "tcc") { | |
get_smi_dir | |
get_gpu_uuid | |
set_tcc | |
} | |
if ($tcc_or_wddm -eq "wddm") { | |
get_smi_dir | |
get_gpu_uuid | |
set_wddm | |
} | |
} | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment