Lightning-AI / Lightning-AI/pytorch-lightning
`Fabric.all_reduce` silently fails when tensors are on CPU
@GudeJunge is already working on this.
Since Mar 7, 2026.
- Dominant language
- Python
- Stars
- 31.4k
- Forks
- 3.8k
- Avg merge
- 6d 7h
- Merged PRs (30d)
- 6
Description
### 📚 Documentation
I wrote some code involving CPU offloading in a DDP context, and I used `Fabric.all_reduce` with arguments which were tensors on the CPU for each process associated with a rank.
This just fails silently, in that the tensors for each rank are the same afterwards. The docs are also silent about this. It should say that `all_reduce` works only if for rank `k`, the tensor passed as argument must be on `device("cuda", k)`. Otherwise, it just fails silently.
When you do CPU offloading, there are valid reasons to exchange tensors stored on CPU between processes, so this is (I think) not entirely dumb. I think the docs should be clear, and even better there should be an exception thrown.
cc @lantiga @justusschock
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.