Commit 1e621a5
authored
fix: resolve issue with inability to correctly specify non-zero GPUs in multi-GPU systems (#404)
* Fix: Correctly specify non-zero GPUs in multi-GPU environments
This commit resolves an issue where the Nunchaku model could not be
correctly initialized and run on a user-specified non-zero GPU in
multi-GPU systems.
Key changes include:
- Using CUDADeviceContext in the FluxModel constructor to ensure
the model and its submodules are created within the specified GPU context.
- Modifying the logic in FluxModel::forward for copying residual data
from CPU back to GPU, ensuring it returns to the correct original GPU device.
- Adding explicit CUDA context management in Tensor::copy_ for data
copy operations involving CUDA devices (H2D, D2H, D2D) to guarantee
cudaMemcpyAsync executes on the correct device.
These changes allow users to reliably run Nunchaku on any specified
GPU in a multi-GPU setup.
* finish pre-commit1 parent 3eabbd0 commit 1e621a5
2 files changed
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
778 | 778 | | |
779 | 779 | | |
780 | 780 | | |
| 781 | + | |
| 782 | + | |
781 | 783 | | |
782 | 784 | | |
783 | 785 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
432 | 432 | | |
433 | 433 | | |
434 | 434 | | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
435 | 442 | | |
436 | 443 | | |
437 | 444 | | |
| |||
0 commit comments