Skip to content

Commit 133b921

Browse files
Kimchengjunlu
Kim
authored andcommitted
change pkg name from "torch-ccl" to ""oneccl_binding_for_pytorch";
1 parent 6e1279d commit 133b921

25 files changed

+222
-207
lines changed

.gitignore

+10-10
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515
*/**/**/**/*.pyc
1616
*/**/**/**/**/*.pyc
1717

18-
torch_ccl/include/
19-
torch_ccl/lib/
20-
torch_ccl/bin/
21-
torch_ccl/etc/
22-
torch_ccl/env/
23-
torch_ccl/examples/
24-
torch_ccl/licensing/
25-
torch_ccl/modulefiles/
26-
torch_ccl/version.py
18+
oneccl_bindings_for_pytorch/include/
19+
oneccl_bindings_for_pytorch/lib/
20+
oneccl_bindings_for_pytorch/bin/
21+
oneccl_bindings_for_pytorch/etc/
22+
oneccl_bindings_for_pytorch/env/
23+
oneccl_bindings_for_pytorch/examples/
24+
oneccl_bindings_for_pytorch/licensing/
25+
oneccl_bindings_for_pytorch/modulefiles/
26+
oneccl_bindings_for_pytorch/version.py
2727

2828
## General
2929

@@ -107,7 +107,7 @@ gen
107107

108108
# setup.py intermediates
109109
.eggs
110-
torch_ccl.egg-info
110+
oneccl_bindings_for_pytorch.egg-info
111111
oneccl_bind_pt.egg-info
112112

113113
# Files generated by ctags

CMakeLists.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
22
set(CMAKE_CXX_STANDARD 17)
33

4-
project(torch_ccl C CXX)
4+
project(oneccl_bindings_for_pytorch C CXX)
55
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat")
66
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=cpp")
77
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat-security")
@@ -32,7 +32,7 @@ set(DEPENDS_LIB)
3232
find_package(oneCCL REQUIRED)
3333
list(APPEND DEPENDS_LIB oneCCL torch)
3434

35-
SET(LIB_NAME "torch_ccl")
35+
SET(LIB_NAME "oneccl_bindings_for_pytorch")
3636

3737
add_subdirectory(./src)
3838

@@ -55,9 +55,9 @@ function (print_configuration_summary)
5555
message(STATUS " Compile flags : ${IPEX_COMPILE_FLAGS}")
5656
message(STATUS " Compile definitions : ${CMAKE_COMPILE_DEFINITIONS}")
5757
message(STATUS " Linker options : ${CMAKE_SHARED_LINKER_FLAGS}")
58-
get_target_property(LINK_LIBRARIES torch_ccl LINK_LIBRARIES)
58+
get_target_property(LINK_LIBRARIES oneccl_bindings_for_pytorch LINK_LIBRARIES)
5959
message(STATUS " Linker libraries : ${LINK_LIBRARIES}")
60-
get_target_property(LINK_DIRECTORS torch_ccl LINK_DIRECTORIES)
60+
get_target_property(LINK_DIRECTORS oneccl_bindings_for_pytorch LINK_DIRECTORIES)
6161
message(STATUS " Linker directors : ${LINK_DIRECTORS}")
6262

6363
message(STATUS "")

README.md

+77-72
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,80 @@
1-
# torch-ccl
1+
# Intel® oneCCL Bindings for PyTorch (formerly known as torch_ccl)
22

33
This repository holds PyTorch bindings maintained by Intel for the Intel® oneAPI Collective Communications Library (oneCCL).
44

5-
6-
# Introduction
5+
## Introduction
76

87
[PyTorch](https://github.com/pytorch/pytorch) is an open-source machine learning framework.
98

10-
[Intel® oneCCL](https://github.com/oneapi-src/oneCCL) (collective commnications library) is a library for efficient distributed deep learning training implementing such collectives like allreduce, allgather, alltoall. For more information on oneCCL, please refer to the [oneCCL documentation](https://spec.oneapi.com/versions/latest/elements/oneCCL/source/index.html) and [oneCCL specification](https://spec.oneapi.com/versions/latest/elements/oneCCL/source/index.html).
9+
[Intel® oneCCL](https://github.com/oneapi-src/oneCCL) (collective communications library) is a library for efficient distributed deep learning training implementing such collectives like `allreduce`, `allgather`, `alltoall`. For more information on oneCCL, please refer to the [oneCCL documentation](https://spec.oneapi.com/versions/latest/elements/oneCCL/source/index.html) and [oneCCL specification](https://spec.oneapi.com/versions/latest/elements/oneCCL/source/index.html).
1110

12-
`torch-ccl` module implements PyTorch C10D ProcessGroup API and can be dynamically loaded as external ProcessGroup and only works on Linux platform now.
11+
`oneccl_bindings_for_pytorch` module implements PyTorch C10D ProcessGroup API and can be dynamically loaded as external ProcessGroup and only works on Linux platform now.
1312

14-
# Pytorch API Align
15-
We recommend Anaconda as Python package management system. The following is the corresponding branchs (tags) of torch-ccl and supported Pytorch.
13+
## Pytorch API Align
1614

17-
| ``torch`` | ``torch-ccl`` |
18-
| :-----:| :---: |
19-
| ``master`` | ``master`` |
20-
| [v1.11.0](https://github.com/pytorch/pytorch/tree/v1.11.0) | [ccl_torch1.11](https://github.com/intel/torch-ccl/tree/ccl_torch1.11) |
21-
| [v1.10.0](https://github.com/pytorch/pytorch/tree/v1.10.0) | [ccl_torch1.10](https://github.com/intel/torch-ccl/tree/ccl_torch1.10) |
22-
| [v1.9.0](https://github.com/pytorch/pytorch/tree/v1.9.0) | [ccl_torch1.9](https://github.com/intel/torch-ccl/tree/ccl_torch1.9) |
23-
| [v1.8.1](https://github.com/pytorch/pytorch/tree/v1.8.1) | [ccl_torch1.8](https://github.com/intel/torch-ccl/tree/ccl_torch1.8) |
24-
| [v1.7.1](https://github.com/pytorch/pytorch/tree/v1.7.1) | [ccl_torch1.7](https://github.com/intel/torch-ccl/tree/ccl_torch1.7) |
25-
| [v1.6.0](https://github.com/pytorch/pytorch/tree/v1.6.0) | [ccl_torch1.6](https://github.com/intel/torch-ccl/tree/ccl_torch1.6) |
26-
| [v1.5-rc3](https://github.com/pytorch/pytorch/tree/v1.5.0-rc3) | [beta09](https://github.com/intel/torch-ccl/tree/beta09) |
15+
We recommend Anaconda as Python package management system. The following is the corresponding branches (tags) of `oneccl_bindings_for_pytorch` and supported Pytorch.
2716

28-
The usage details can be found in the README of corresponding branch. The following part is about the usage of v1.9 tag. if you want to use other version of torch-ccl please checkout to that branch(tag). For pytorch-1.5.0-rc3, the [#PR28068](https://github.com/pytorch/pytorch/pull/28068) and [#PR32361](https://github.com/pytorch/pytorch/pull/32361) are need to dynamicall register external ProcessGroup and enable ``alltoall`` collective communication primitive. The patch file about these two PRs is in ``patches`` directory and you can use it directly.
17+
| `torch` | `oneccl_bindings_for_pytorch` |
18+
| :-------------------------------------------------------------: | :-----------------------------------------------------------------------: |
19+
| `master` | `master` |
20+
| [v1.12.0](https://github.com/pytorch/pytorch/tree/v1.12.0) | [ccl_torch1.12](https://github.com/intel/torch-ccl/tree/ccl_torch1.12) |
21+
| [v1.11.0](https://github.com/pytorch/pytorch/tree/v1.11.0) | [ccl_torch1.11](https://github.com/intel/torch-ccl/tree/ccl_torch1.11) |
22+
| [v1.10.0](https://github.com/pytorch/pytorch/tree/v1.10.0) | [ccl_torch1.10](https://github.com/intel/torch-ccl/tree/ccl_torch1.10) |
23+
| [v1.9.0](https://github.com/pytorch/pytorch/tree/v1.9.0) | [ccl_torch1.9](https://github.com/intel/torch-ccl/tree/ccl_torch1.9) |
24+
| [v1.8.1](https://github.com/pytorch/pytorch/tree/v1.8.1) | [ccl_torch1.8](https://github.com/intel/torch-ccl/tree/ccl_torch1.8) |
25+
| [v1.7.1](https://github.com/pytorch/pytorch/tree/v1.7.1) | [ccl_torch1.7](https://github.com/intel/torch-ccl/tree/ccl_torch1.7) |
26+
| [v1.6.0](https://github.com/pytorch/pytorch/tree/v1.6.0) | [ccl_torch1.6](https://github.com/intel/torch-ccl/tree/ccl_torch1.6) |
27+
| [v1.5-rc3](https://github.com/pytorch/pytorch/tree/v1.5.0-rc3) | [beta09](https://github.com/intel/torch-ccl/tree/beta09) |
2928

30-
# Requirements
29+
The usage details can be found in the README of corresponding branch. The following part is about the usage of v1.9 tag. if you want to use other version of torch-ccl please checkout to that branch(tag). For pytorch-1.5.0-rc3, the [#PR28068](https://github.com/pytorch/pytorch/pull/28068) and [#PR32361](https://github.com/pytorch/pytorch/pull/32361) are need to dynamicall register external ProcessGroup and enable `alltoall` collective communication primitive. The patch file about these two PRs is in `patches` directory and you can use it directly.
3130

32-
Python 3.6 or later and a C++17 compiler
31+
## Requirements
3332

34-
PyTorch v1.11.0
33+
- Python 3.6 or later and a C++17 compiler
3534

36-
# Installation
37-
## Source install
35+
- PyTorch v1.12.0
3836

39-
To install `torch-ccl`:
37+
## Installation
4038

41-
1. clone the `torch-ccl`.
39+
### Install from Source
4240

43-
```bash
44-
git clone https://github.com/intel/torch-ccl.git && cd torch-ccl
45-
git submodule sync
41+
1. clone the `oneccl_bindings_for_pytorch`.
42+
43+
```bash
44+
git clone https://github.com/intel/torch-ccl.git && cd torch-ccl
45+
git submodule sync
4646
git submodule update --init --recursive
47-
```
48-
2. Install torch-ccl
47+
```
4948

50-
```bash
49+
2. Install `oneccl_bindings_for_pytorch`
50+
51+
```bash
5152
python setup.py install
52-
```
53-
## Wheel install
53+
```
54+
55+
### Install PreBuilt Wheel
56+
5457
Wheel files are avaiable for the following Python versions.
5558

5659
| Extension Version | Python 3.6 | Python 3.7 | Python 3.8 | Python 3.9 | Python 3.10 |
57-
| :--: | :--: | :--: | :--: | :--: | :--: |
58-
| 1.11.0 | | ✔️ | ✔️ | ✔️ |✔️ |
59-
| 1.10.0 | ✔️ | ✔️ | ✔️ |✔️ | |
60+
| :---------------: | :--------: | :--------: | :--------: | :--------: | :---------: |
61+
| 1.12.0 | |||||
62+
| 1.11.0 | |||||
63+
| 1.10.0 ||||| |
6064

61-
```python
62-
python -m pip install oneccl_bind_pt==1.11.0 -f https://software.intel.com/ipex-whl-stable
65+
```bash
66+
python -m pip install oneccl_bindings_for_pytorch==1.12.0 -f https://software.intel.com/ipex-whl-stable
6367
```
6468

65-
# Usage
69+
## Usage
6670

6771
example.py
6872

6973
```python
7074

7175
import torch.nn.parallel
7276
import torch.distributed as dist
73-
import torch_ccl
77+
import oneccl_bindings_for_pytorch
7478

7579
...
7680

@@ -91,20 +95,21 @@ model = torch.nn.parallel.DistributedDataParallel(model, ...)
9195

9296
...
9397
```
94-
(torch_ccl is installed along with the MPI toolset.)
95-
```
9698

97-
$ source <torch_ccl_path>/env/setvars.sh
99+
(oneccl_bindings_for_pytorch is installed along with the MPI tool set.)
98100

99-
eg:
100-
$ torch_ccl_path=$(python -c "import torch; import torch_ccl; import os; print(os.path.abspath(os.path.dirname(torch_ccl.__file__)))")
101-
$ source $torch_ccl_path/env/setvars.sh
101+
```bash
102102

103-
$ mpirun -n <N> -ppn <PPN> -f <hostfile> python example.py
104-
```
103+
source <oneccl_bindings_for_pytorch_path>/env/setvars.sh
104+
105+
# eg:
106+
# $ oneccl_bindings_for_pytorch_path=$(python -c "from oneccl_bindings_for_pytorch import cwd; print(cwd)")
107+
# $ source $oneccl_bindings_for_pytorch_path/env/setvars.sh
105108

109+
mpirun -n <N> -ppn <PPN> -f <hostfile> python example.py
110+
```
106111

107-
# Performance Debugging
112+
## Performance Debugging
108113

109114
For debugging performance of communication primitives PyTorch's [Autograd profiler](https://pytorch.org/docs/stable/autograd.html#profiler)
110115
can be used to inspect time spent inside oneCCL calls.
@@ -117,7 +122,7 @@ profiling.py
117122

118123
import torch.nn.parallel
119124
import torch.distributed as dist
120-
import torch_ccl
125+
import oneccl_bindings_for_pytorch
121126
import os
122127

123128
os.environ['MASTER_ADDR'] = '127.0.0.1'
@@ -142,36 +147,36 @@ print(prof.key_averages(group_by_input_shape=True).table(sort_by="self_cpu_time_
142147

143148
```
144149

145-
```
146-
$ mpirun -n 2 -l python profiling.py
150+
```bash
151+
mpirun -n 2 -l python profiling.py
147152
```
148153

149-
```
154+
```bash
150155
[0] my rank = 0 my size = 2
151-
[0] ----------------------------------- ------------ ------------ ------------ ------------ ------------ ------------ --------------------
152-
[0] Name Self CPU % Self CPU CPU total % CPU total CPU time avg # of Calls Input Shapes
153-
[0] ----------------------------------- ------------ ------------ ------------ ------------ ------------ ------------ --------------------
154-
[0] torch_ccl::allreduce 91.41% 297.900ms 91.41% 297.900ms 29.790ms 10 [[2, 2]]
155-
[0] torch_ccl::wait::cpu::allreduce 8.24% 26.845ms 8.24% 26.845ms 2.684ms 10 [[2, 2], [2, 2]]
156-
[0] torch_ccl::wait::cpu::allreduce 0.30% 973.651us 0.30% 973.651us 97.365us 10 [[4, 4], [4, 4]]
157-
[0] torch_ccl::allreduce 0.06% 190.254us 0.06% 190.254us 19.025us 10 [[4, 4]]
158-
[0] ----------------------------------- ------------ ------------ ------------ ------------ ------------ ------------ --------------------
156+
[0] ----------------------------------------------------- ------------ ------------ ------------ ------------ ------------ ------------ --------------------
157+
[0] Name Self CPU % Self CPU CPU total % CPU total CPU time avg # of Calls Input Shapes
158+
[0] ----------------------------------------------------- ------------ ------------ ------------ ------------ ------------ ------------ --------------------
159+
[0] oneccl_bindings_for_pytorch::allreduce 91.41% 297.900ms 91.41% 297.900ms 29.790ms 10 [[2, 2]]
160+
[0] oneccl_bindings_for_pytorch::wait::cpu::allreduce 8.24% 26.845ms 8.24% 26.845ms 2.684ms 10 [[2, 2], [2, 2]]
161+
[0] oneccl_bindings_for_pytorch::wait::cpu::allreduce 0.30% 973.651us 0.30% 973.651us 97.365us 10 [[4, 4], [4, 4]]
162+
[0] oneccl_bindings_for_pytorch::allreduce 0.06% 190.254us 0.06% 190.254us 19.025us 10 [[4, 4]]
163+
[0] ----------------------------------------------------- ------------ ------------ ------------ ------------ ------------ ------------ --------------------
159164
[0] Self CPU time total: 325.909ms
160-
[0]
165+
[0]
161166
[1] my rank = 1 my size = 2
162-
[1] ----------------------------------- ------------ ------------ ------------ ------------ ------------ ------------ --------------------
163-
[1] Name Self CPU % Self CPU CPU total % CPU total CPU time avg # of Calls Input Shapes
164-
[1] ----------------------------------- ------------ ------------ ------------ ------------ ------------ ------------ --------------------
165-
[1] torch_ccl::allreduce 96.03% 318.551ms 96.03% 318.551ms 31.855ms 10 [[2, 2]]
166-
[1] torch_ccl::wait::cpu::allreduce 3.62% 12.019ms 3.62% 12.019ms 1.202ms 10 [[2, 2], [2, 2]]
167-
[1] torch_ccl::allreduce 0.33% 1.082ms 0.33% 1.082ms 108.157us 10 [[4, 4]]
168-
[1] torch_ccl::wait::cpu::allreduce 0.02% 56.505us 0.02% 56.505us 5.651us 10 [[4, 4], [4, 4]]
169-
[1] ----------------------------------- ------------ ------------ ------------ ------------ ------------ ------------ --------------------
167+
[1] ----------------------------------------------------- ------------ ------------ ------------ ------------ ------------ ------------ --------------------
168+
[1] Name Self CPU % Self CPU CPU total % CPU total CPU time avg # of Calls Input Shapes
169+
[1] ----------------------------------------------------- ------------ ------------ ------------ ------------ ------------ ------------ --------------------
170+
[1] oneccl_bindings_for_pytorch::allreduce 96.03% 318.551ms 96.03% 318.551ms 31.855ms 10 [[2, 2]]
171+
[1] oneccl_bindings_for_pytorch::wait::cpu::allreduce 3.62% 12.019ms 3.62% 12.019ms 1.202ms 10 [[2, 2], [2, 2]]
172+
[1] oneccl_bindings_for_pytorch::allreduce 0.33% 1.082ms 0.33% 1.082ms 108.157us 10 [[4, 4]]
173+
[1] oneccl_bindings_for_pytorch::wait::cpu::allreduce 0.02% 56.505us 0.02% 56.505us 5.651us 10 [[4, 4], [4, 4]]
174+
[1] ----------------------------------------------------- ------------ ------------ ------------ ------------ ------------ ------------ --------------------
170175
[1] Self CPU time total: 331.708ms
171-
[1]
176+
[1]
172177

173178
```
174179

180+
## License
175181

176-
# License
177182
[BSD License](https://github.com/intel/torch-ccl/blob/master/LICENSE)

demo/demo.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
except:
99
print("cant't import ipex")
1010

11-
import torch_ccl
11+
import oneccl_bindings_for_pytorch
1212

1313

1414
class Model(nn.Module):

torch_ccl/__init__.py renamed to oneccl_bindings_for_pytorch/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
FI_PROVIDER_PATH = os.path.join(cwd, "lib/prov")
99
os.environ['FI_PROVIDER_PATH'] = FI_PROVIDER_PATH
1010
if not os.path.exists(os.path.join(cwd, "version.py")):
11-
raise RuntimeError("torch_ccl is not installed!")
11+
raise RuntimeError("oneccl_bindings_for_pytorch is not installed!")
1212

1313
from .version import __version__, git_version
1414
from . import _C as ccl_lib
@@ -18,7 +18,7 @@
1818
try:
1919
# load the CCL/XPU library
2020
import ctypes
21-
my_c_library = ctypes.cdll.LoadLibrary(os.path.join(cwd, "lib/libtorch_ccl_xpu.so"))
21+
my_c_library = ctypes.cdll.LoadLibrary(os.path.join(cwd, "lib/liboneccl_bindings_for_pytorch_xpu.so"))
2222
except OSError:
2323
print("Warning: Cannot load xpu CCL. CCL doesn't work for XPU device")
2424

File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)