mirror of
https://github.com/kvcache-ai/ktransformers.git
synced 2026-11-05 01:07:28 +00:00
[GH-ISSUE #76] 8-GPU configuration on L40 OOM #38
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/ktransformers#38
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 @fengyang95 on GitHub (Sep 4, 2024).
Original GitHub issue: https://github.com/kvcache-ai/ktransformers/issues/76
I tried running deepseek-v2 with an 8xL40 46G configuration, but I encountered a GPU memory Out-of-Memory (OOM) error. Why would such a large amount of GPU memory still lead to an OOM issue?
@Azure-Tang commented on GitHub (Sep 4, 2024):
Ok, if you want to put all modules to gpu, then your required VRAM per layer is approximately 5.2G. So 9 layers on one GPU may cause oom. You can offload one layer of experts to CPU
@fengyang95 commented on GitHub (Sep 5, 2024):
@Azure-Tang commented on GitHub (Sep 5, 2024):
The 5.2G figure is an approximation, and the actual value may be slightly higher. As a result, 8 layers per GPU could be the upper limit. You can consider offloading one layer’s experts to the CPU for each GPU. This way, each CPU will handle 8 layers of experts modules, with the remaining layers calculated in the GPU.
@fengyang95 commented on GitHub (Sep 5, 2024):
Do you mean to allocate 7 layers to each GPU and offload 1 layer to the CPU?
@Azure-Tang commented on GitHub (Sep 5, 2024):
Not
a whole layerto the CPU, only offloadexpertsmodule in one decoder layer for each 8-layer GPU seems enough.@fengyang95 commented on GitHub (Sep 5, 2024):
I didn't quite understand your point. Could you pls demonstrate it using a configuration?
@Azure-Tang commented on GitHub (Sep 6, 2024):
For example, you got 8 layers for each GPU, which cause oom. And your 8 layers' parameter distribution is like this:

Then you offload one layer's experts module to cpu (which we have done in our example yamls), so the layer will be like this:

And keep other 7 whole layers on GPU, which like this:

Which will offload some parameters to you ram. If it still oom, you can do this for another layer.
@Azure-Tang commented on GitHub (Sep 11, 2024):
Hi, I’ll be closing this topic as there hasn’t been any response~