Created
February 14, 2026 03:14
-
-
Save twisted-nematic57/de7450ac3c81f32a0eb3c7749be0b7e5 to your computer and use it in GitHub Desktop.
llama-server CPU usage limiter
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
| @echo off | |
| REM Restricts llama-server to a certain set of CPU cores. | |
| REM Argument: integer representing the # of cores to limit to | |
| echo Setting llama-server affinity to last %1 cores... | |
| REM Hardcoded CPU affinity masks for my 12-core system because I'm too lazy to do this elegantly. | |
| REM The "first" cores are P-cores and the "last" ones are E-cores; I want to keep P-cores free for | |
| REM stuff I'm actively doing and let llama-server have the rest. So, use the "last" cores first. | |
| IF "%1"=="1" ( | |
| powershell.exe "$p = Get-Process llama-server; $p.ProcessorAffinity = 2048" | |
| ) ELSE IF "%1"=="2" ( | |
| powershell.exe "$p = Get-Process llama-server; $p.ProcessorAffinity = 3072" | |
| ) ELSE IF "%1"=="3" ( | |
| powershell.exe "$p = Get-Process llama-server; $p.ProcessorAffinity = 3584" | |
| ) ELSE IF "%1"=="4" ( | |
| powershell.exe "$p = Get-Process llama-server; $p.ProcessorAffinity = 3840" | |
| ) ELSE IF "%1"=="5" ( | |
| powershell.exe "$p = Get-Process llama-server; $p.ProcessorAffinity = 3968" | |
| ) ELSE IF "%1"=="6" ( | |
| powershell.exe "$p = Get-Process llama-server; $p.ProcessorAffinity = 4032" | |
| ) ELSE IF "%1"=="7" ( | |
| powershell.exe "$p = Get-Process llama-server; $p.ProcessorAffinity = 4064" | |
| ) ELSE IF "%1"=="8" ( | |
| powershell.exe "$p = Get-Process llama-server; $p.ProcessorAffinity = 4080" | |
| ) ELSE IF "%1"=="9" ( | |
| powershell.exe "$p = Get-Process llama-server; $p.ProcessorAffinity = 4088" | |
| ) ELSE IF "%1"=="10" ( | |
| powershell.exe "$p = Get-Process llama-server; $p.ProcessorAffinity = 4092" | |
| ) ELSE IF "%1"=="11" ( | |
| powershell.exe "$p = Get-Process llama-server; $p.ProcessorAffinity = 4094" | |
| ) ELSE IF "%1"=="12" ( | |
| powershell.exe "$p = Get-Process llama-server; $p.ProcessorAffinity = 4095" | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment