CANN HCCL backend for torchcomms.
import torch
import torch_npu # register the "npu" backend
import torchcomms
import torchcomms_hccl # registers the "hccl" backend
comm = torchcomms.new_comm("hccl", torch.device("npu"))Only all_reduce is implemented; other collectives raise "not supported".
| Package | Version |
|---|---|
| torch | 2.12.0 |
| torch-npu | 2.12.0.post3 |
| torchcomms | 0.3.1 |
| Python | 3.11 – 3.13 |
torch-npu and torchcomms both pin torch==2.12.0; install them as this set.
all_reducecollective- Auto-registers
hcclvia thetorchcomms.backendsentry point - Builds without a CANN Toolkit (submodule headers + stub libs)
- Ships as a standalone wheel
- Python >= 3.11, CMake >= 3.22, a C++17 compiler
- Build:
torch==2.12.0(CPU build) +torchcomms==0.3.1 - Runtime: CANN Toolkit,
torch-npu==2.12.0.post3, NPU hardware
torchcommsis not on PyPI (the PyPI name is a placeholder). Install it from the PyTorch index (it pinstorch==2.12.0):pip install torch==2.12.0 --index-url https://download.pytorch.org/whl/cpu pip install torchcomms==0.3.1 --index-url https://download.pytorch.org/whl/cu126 --no-deps
git clone --recursive https://github.com/cann-hccl/torchcomms-hccl
cd torchcomms-hccl
pip install torch==2.12.0 --index-url https://download.pytorch.org/whl/cpu
pip install torchcomms==0.3.1 --index-url https://download.pytorch.org/whl/cu126 --no-deps
pip install -r requirements_dev.txt
bash build.sh
pip install dist/*.whlFrom PyPI: torchcomms is not on PyPI, so install it from the PyTorch index
first (along with torch-npu==2.12.0.post3 for NPU), then
pip install torchcomms-hccl.
bash build.sh # build the wheel
bash build.sh --lint # clang-format (--Werror) + pylint
bash build.sh --test # pytest (NPU tests skip without CANN)torchrun --nproc_per_node=2 examples/all_reduce.py| Op | Status |
|---|---|
all_reduce |
✅ |
others (all_gather, broadcast, …) |
🚧 planned |
pip install -r requirements_dev.txt
bash build.sh --lint # clang-format + pylint
pytest tests/ # the all_reduce test needs NPU + CANN