Skip to content

Commit

Permalink
installation instr updates for issue #330
Browse files Browse the repository at this point in the history
  • Loading branch information
chrischoy committed Apr 8, 2021
1 parent 2e16531 commit 73fe866
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 3 deletions.
37 changes: 35 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The Minkowski Engine is an auto-differentiation library for sparse tensors. It s

## News

- 2021-04-08 Due to recent errors in [pytorch 1.8 + CUDA 11](https://github.com/NVIDIA/MinkowskiEngine/issues/330), it is recommended to use [anaconda for installation](#anaconda).
- 2020-12-24 v0.5 is now available! The new version provides CUDA accelerations for all coordinate management functions.

## Example Networks
Expand Down Expand Up @@ -54,7 +55,7 @@ We visualized a sparse tensor network operation on a sparse tensor, convolution,

- Ubuntu >= 14.04
- CUDA >= 10.1.243 and **the same CUDA version used for pytorch** (e.g. if you use conda cudatoolkit=11.1, use CUDA=11.1 for MinkowskiEngine compilation)
- pytorch >= 1.7 (if you use conda, install with `conda install -y -c conda-forge -c pytorch pytorch=1.8.1 cudatoolkit=11.1`)
- pytorch >= 1.7 (pytorch 1.8.1 + CUDA 11.X is [unstable](https://github.com/NVIDIA/MinkowskiEngine/issues/330). To specify CUDA version, please use conda for installation. `conda install -y -c conda-forge -c pytorch pytorch=1.8.1 cudatoolkit=10.2`)
- python >= 3.6
- ninja (for installation)
- GCC >= 7
Expand Down Expand Up @@ -100,17 +101,49 @@ pip install -U git+https://github.com/NVIDIA/MinkowskiEngine -v --no-deps \

### Anaconda

Due to [errors in pytorch](https://github.com/NVIDIA/MinkowskiEngine/issues/330), pytorch 1.8.1 can only work with CUDA 10.2. To use CUDA 11.1, use pytorch 1.7.1 instead.
#### CUDA 10.2

We recommend `python>=3.6` for installation.
First, follow [the anaconda documentation](https://docs.anaconda.com/anaconda/install/) to install anaconda on your computer.

```
sudo apt install g++-7 # For CUDA 10.2, must use GCC < 8
conda create -n py3-mink python=3.8
conda activate py3-mink
conda install openblas-devel -c anaconda
conda install pytorch=1.8.1 torchvision cudatoolkit=11.1 -c pytorch -c conda-forge
conda install pytorch=1.8.1 torchvision cudatoolkit=10.2 -c pytorch -c conda-forge
# Install MinkowskiEngine
export CXX=g++-7
# Uncomment the following line to specify the cuda home. Make sure `$CUDA_HOME/nvcc --version` is 10.2
# export CUDA_HOME=/usr/local/cuda-10.2
pip install -U git+https://github.com/NVIDIA/MinkowskiEngine -v --no-deps --install-option="--blas_include_dirs=${CONDA_PREFIX}/include" --install-option="--blas=openblas"
# Or if you want local MinkowskiEngine
git clone https://github.com/NVIDIA/MinkowskiEngine.git
cd MinkowskiEngine
export CXX=g++-7
python setup.py install --blas_include_dirs=${CONDA_PREFIX}/include --blas=openblas
```

#### CUDA 11.X

We recommend `python>=3.6` for installation.
First, follow [the anaconda documentation](https://docs.anaconda.com/anaconda/install/) to install anaconda on your computer.

```
conda create -n py3-mink python=3.8
conda activate py3-mink
conda install openblas-devel -c anaconda
conda install pytorch=1.7.1 torchvision cudatoolkit=11.0 -c pytorch -c conda-forge
# Install MinkowskiEngine
# Uncomment the following line to specify the cuda home. Make sure `$CUDA_HOME/nvcc --version` is 11.X
# export CUDA_HOME=/usr/local/cuda-11.1
pip install -U git+https://github.com/NVIDIA/MinkowskiEngine -v --no-deps --install-option="--blas_include_dirs=${CONDA_PREFIX}/include" --install-option="--blas=openblas"
# Or if you want local MinkowskiEngine
Expand Down
15 changes: 14 additions & 1 deletion tests/python/sparse_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
is_cuda_available,
)

from MinkowskiEngine.utils import batched_coordinates
from MinkowskiEngine.utils import batched_coordinates, sparse_quantize, sparse_collate
from tests.python.common import data_loader, load_file


Expand Down Expand Up @@ -77,6 +77,7 @@ def test_device(self):
print(f"{self.__class__.__name__}: test_device SparseTensor")
if not is_cuda_available():
return

coords = torch.IntTensor(
[[0, 1], [0, 1], [0, 2], [0, 2], [1, 0], [1, 0], [1, 1]]
)
Expand All @@ -87,6 +88,18 @@ def test_device(self):
st = SparseTensor(feats, coords, device=feats.device)
print(st)

def test_device2(self):
print(f"{self.__class__.__name__}: test_device SparseTensor")
if not is_cuda_available():
return

coordinates = np.random.rand(8192,3) * 200
quant_coordinates, quant_features = sparse_quantize(coordinates, coordinates)
bcoords, bfeats = sparse_collate([quant_coordinates], [quant_features])
bcoords, bfeats = bcoords.cuda(), bfeats.cuda()
print(bcoords, bfeats)
SparseTensor(bfeats, bcoords)

def test_quantization(self):
print(f"{self.__class__.__name__}: test_quantization")
coords, feats, labels = data_loader(nchannel=2)
Expand Down

0 comments on commit 73fe866

Please sign in to comment.