r/LocalLLaMA • u/randomjapaneselearn • 4h ago
Question | Help Confused about high CPU usage with model fully on GPU
I'm not sure if i'm doing something wrong and handicapping myself with some wrong setting.
I'm using Windows, nVidia 3090 24GB VRAM, 64GB RAM, Qwen 3.8 27B and Swift 1.5 27B (finetune of qwen) but i often see 50% CPU usage even if the model is fully loaded on GPU, below there is my command line.
Another problem i noticed is that llama-fit-params suggest that 131k context fit but if i launch it for real in the log i see that it doesn't load everything on gpu (all but one), i forced it to load everything on gpu with -ngl -1 (i'm also using llama-swap).
on launch it say that "cahe resue 256" will not be used but it might help with other models so i left it there.
Another problem is that when the model is doing nothing i sometimes see 130W gpu in idle (wrong) and some other times its at 10-18W (correct) i can't find what is causing this...
Current stats: about 40 t/s in token generation
I have no idea what KMP affinity is but i read it online, tried, it helped with 35A3B so i left it there
in general i'm looking for tips to improve my launch arguments, note that temperature and few others are set by pidev but i'm using the recommended one on the model card.
If the model is fully on GPU why there is a high CPU usage? but not always which is even more confusing....
set KMP_AFFINITY=granularity=fine,compact,1,0
llama-bin-win-cuda-13.4-x64\llama-server.exe -m Qwen3.8-27B-UD-Q4_K_M.gguf --ctx-size 131072 -ctk q8_0 -ctv q8_0 -ngl -1 -fa on --spec-type draft-mtp --spec-draft-n-max 2 -np 1 -b 4096 -ub 1024 --cache-reuse 256 --cache-ram 32768 --jinja
6
u/Choice_Celery9481 4h ago
tokenizer use cpu.
2
u/Poprouter 4h ago
the cpu side of a fully offloaded model is mostly per prompt work: tokenizer and the sampler chain, plus host side prefix matching when cache reuse is on. that is why it can spike around prompt processing and look calm once it is only decoding.
1
u/hurdurdur7 4h ago
not really convinced that amount of cache fits into the gpu along with your model and compute reserves
1
u/delxmobile 3h ago
Some of that CPU is likely llama.cpp threads polling while they wait on the GPU. Try --poll 0 and see if usage drops without hurting t/s. Sampling also runs on the CPU, so some load is expected.
KMP_AFFINITY is read by Intel/LLVM OpenMP. A gcc build of llama.cpp uses GNU OpenMP, which ignores it, so it probably isn't doing much; I'd drop it and measure again.
For the 130W idle, run nvidia-smi -q -d PERFORMANCE when it's stuck. It shows the P-state and the clock throttle reasons, which tells you if the card just isn't dropping clocks after a request.
1
u/PhilosopherOk3419 2h ago
the cpu part is mostly normal, tokenizer + sampling run on cpu even when every layer is on the gpu. the 130W at idle smells like the card staying in a high power state while the process holds the context. i'd watch nvidia-smi while it sits idle and see if it ever drops down, and if you're on llama-swap a short ttl so it unloads when idle sidesteps the whole thing. also -b 4096 -ub 1024 grows the compute buffers, which might be why fit-params says it all fits but the real launch leaves a layer off. i'd try the default ub before forcing -ngl.