mirror of
https://github.com/kvcache-ai/ktransformers.git
synced 2026-11-05 01:07:28 +00:00
[GH-ISSUE #21] Add support to switch main GPU #15
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/ktransformers#15
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @firmanmm on GitHub (Aug 4, 2024).
Original GitHub issue: https://github.com/kvcache-ai/ktransformers/issues/21
Hi, wanted to ask if there is a way to swap GPU to use the second GPU because currently it will keep using the main GPU, unfortunately for me, my main GPU is 16GB while my second GPU is 24GB. I already tried replacing any mention of
cuda:0tocuda:1but it still load in GPU 0 which triggertorch.OutOfMemoryError: CUDA out of memory.. Thank you for this awesome project.@firmanmm commented on GitHub (Aug 4, 2024):
I seems to manage to get it running by adding
CUDA_VISIBLE_DEVICES=1before running it and manage to start it but somehow I didn't get the advertised speed.I only manage to get this result :
CPU: 7950X3D
GPU: 4080 Super, 3090
Ram: 192GB, speed limited to 3600
Model: DeepSeek-Coder-V2-Instruct
However, I did notice that my ram is not getting filled :

@Azure-Tang commented on GitHub (Aug 5, 2024):
Hi, for now you can try
export CUDA_VISIBLE_DEVICE=1(your second gpu idx) in your bash when you start your program, and leave everything else unchanged.@Azure-Tang commented on GitHub (Aug 5, 2024):
Your RAM seems too low, which may cause extra time to load weights during inference. However, this shouldn’t happen because you have enough RAM for the weights to be loaded into it during the warm-up phase. Can you provide your start command and optimise yaml?
Any idea?
@chenht2022
@chenht2022 commented on GitHub (Aug 5, 2024):
In
htop, green represents Kernel buffers, and orange represents Memory mapped.The weights of experts in KTransformers are mmap-ed, so this portion of memory usage usually appears as orange. In your screenshot, it accounts for at least 120GB, which is as expected.
Perhaps you can improve performance by increasing parallelism. Try using
--cpu_infer 24.@firmanmm commented on GitHub (Aug 5, 2024):
Hi @chenht2022 , thanks for the suggestion but it seems setting it to 24 seems to reduce the eval speed a bit :
Maybe for extra context I'm running it from the main branch. With below command :
@chenht2022 commented on GitHub (Aug 6, 2024):
Since the MoE layer is offloaded to the CPU, its performance bottleneck during the generation phase is the memory bandwidth for reading weights. The comparison with llama.cpp shown in the video was conducted on a machine with an Intel 4th generation Xeon processor, equipped with 8 memory channels, each channel with 4800MHz. Achieving this level of performance places stringent requirements on the hardware.
As a reference, we also conducted tests on another setup configured with an Intel 14900KF + 4090D GPU + 192GB of memory, 2 memory channels, each channel with 4000MHz. The prefill performance for ktransformers and llama.cpp were 65.6 tokens/s and 8.93 tokens/s, respectively, the generate performance were 6.07 tokens/s and 1.23 tokens/s, respectively.
p.s.
@firmanmm commented on GitHub (Aug 6, 2024):
Ah, I see. I thought the video being shared in the README actually just shows a standard consumer desktop machine, which rarely have more than 2 channels. Anyway, thank you for the explanations.
probability tensor contains eitherinf,nanor element < 0failed. #327