README.md 3.68 KB
Newer Older
yan.yan's avatar
yan.yan committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<!--
 Copyright 2021 Yan Yan
 
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at
 
     http://www.apache.org/licenses/LICENSE-2.0
 
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
-->

traveller59's avatar
traveller59 committed
17
18
# SpConv: PyTorch Spatially Sparse Convolution Library

tusimple's avatar
tusimple committed
19
20
[![Build Status](https://github.com/traveller59/spconv/workflows/build/badge.svg)](https://github.com/traveller59/spconv/actions?query=workflow%3Abuild)

yan.yan's avatar
yan.yan committed
21
# WORK IN PROGRESS, DON'T USE!!!
traveller59's avatar
traveller59 committed
22

yan.yan's avatar
yan.yan committed
23
## Breaking changes in Spconv 2.x
traveller59's avatar
traveller59 committed
24

yan.yan's avatar
yan.yan committed
25
26
27
28
29
30
* ```spconv.xxx``` move to ```spconv.pytorch.xxx```, change all ```import spconv``` to ```import spconv.pytorch as spconv``` and ```from spconv.xxx import``` to ```from spconv.pytorch.xxx import```.
* ```use_hash``` in Sparse Convolution is removed, we only use hash table in 2.x.
* weight layout has been changed to RSKC (native algorithm) or KRSC (implicit gemm), no longer RSCK (spconv 1.x). RS is kernel size, C is input channel, K is output channel.
* all util ops are removed (pillar scatter/nms/...)
* VoxelGenerator has been replaced by Point2VoxelGPU[1-4]d/Point2VoxelCPU[1-4]d.
* spconv 2.x don't support CPU for now
traveller59's avatar
traveller59 committed
31

yan.yan's avatar
yan.yan committed
32
## News in Spconv 2.0.0
traveller59's avatar
traveller59 committed
33

yan.yan's avatar
yan.yan committed
34
35
36
37
* training/inference speed is increased
* support int8/tensor core
* doesn't depend on pytorch binary. 
* since spconv 2.x doesn't depend on pytorch binary (never in future), it's impossible to support torch.jit/libtorch inference.
traveller59's avatar
traveller59 committed
38

yan.yan's avatar
yan.yan committed
39
40
41
42
43
44
45
46
## TODO in Spconv 2.x
- [ ] Ampere (A100 / RTX 3000 series) feature support (work in progress)
- [ ] torch QAT support (work in progress)
- [ ] TensorRT (torch.fx based)
- [ ] Build C++ only package
- [ ] JIT compilation for CUDA kernels
- [ ] Document (low priority)
- [ ] CPU support (low priority)
traveller59's avatar
traveller59 committed
47

yan.yan's avatar
yan.yan committed
48
## Install
traveller59's avatar
traveller59 committed
49

yan.yan's avatar
yan.yan committed
50
You need to install python >= 3.6 first to use spconv 2.x.
traveller59's avatar
traveller59 committed
51

yan.yan's avatar
yan.yan committed
52
You need to install CUDA toolkit first before using prebuilt binaries or build from source.
traveller59's avatar
traveller59 committed
53

yan.yan's avatar
yan.yan committed
54
You need at least CUDA 10.2 to build and run spconv 2.x. We won't offer any support for CUDA < 10.2.
traveller59's avatar
traveller59 committed
55

yan.yan's avatar
yan.yan committed
56
### Prebuilt
traveller59's avatar
traveller59 committed
57

yan.yan's avatar
yan.yan committed
58
We offer python 3.6-3.10 and cuda 10.2/11.1/11.4 prebuilt binaries for linux (manylinux) and windows 10/11.
traveller59's avatar
traveller59 committed
59

yan.yan's avatar
yan.yan committed
60
We will offer prebuilts for CUDA versions supported by latest pytorch release. For example, pytorch 1.9 support cuda 10.2 and 11.1, so we support them too.
traveller59's avatar
traveller59 committed
61

yan.yan's avatar
yan.yan committed
62
For Linux users, you need to install pip >= 20.3 first to install prebuilt.
traveller59's avatar
traveller59 committed
63

yan.yan's avatar
yan.yan committed
64
```pip install spconv-cu102``` for CUDA 10.2
traveller59's avatar
traveller59 committed
65

yan.yan's avatar
yan.yan committed
66
```pip install spconv-cu111``` for CUDA 11.1
traveller59's avatar
traveller59 committed
67

yan.yan's avatar
yan.yan committed
68
```pip install spconv-cu114``` for CUDA 11.4
traveller59's avatar
traveller59 committed
69

yan.yan's avatar
yan.yan committed
70
### Build from source
traveller59's avatar
traveller59 committed
71

yan.yan's avatar
yan.yan committed
72
You need to rebuild ```cumm``` first if you are build along a CUDA version that not provided in prebuilts.
traveller59's avatar
traveller59 committed
73

yan.yan's avatar
yan.yan committed
74
#### Linux
traveller59's avatar
traveller59 committed
75

yan.yan's avatar
yan.yan committed
76
77
78
1. install build-essential, install CUDA
2. run ```export SPCONV_DISABLE_JIT="1"```
3. run ```python setup.py install```/```pip install -e .```/```python setup.py bdist_wheel```+```pip install dists/xxx.whl```
traveller59's avatar
traveller59 committed
79

yan.yan's avatar
yan.yan committed
80
#### Windows 10/11
traveller59's avatar
traveller59 committed
81

yan.yan's avatar
yan.yan committed
82
83
84
85
86
1. install visual studio 2019 or newer. make sure C++ development package is installed. install CUDA
2. set [powershell script execution policy](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.1)
3. start a new powershell, run ```tools/msvc_setup.ps1```
4. run ```$Env:SPCONV_DISABLE_JIT = "1"```
5. run ```python setup.py install```/```pip install -e .```/```python setup.py bdist_wheel```+```pip install dists/xxx.whl```
traveller59's avatar
traveller59 committed
87

yan.yan's avatar
yan.yan committed
88
## Note
traveller59's avatar
traveller59 committed
89

yan.yan's avatar
yan.yan committed
90
The work is done when the author is an employee at Tusimple.
traveller59's avatar
traveller59 committed
91

yan.yan's avatar
yan.yan committed
92
## LICENSE
traveller59's avatar
traveller59 committed
93

yan.yan's avatar
yan.yan committed
94
Apache 2.0