Skip to content

Commit 80b99ad

Browse files
authored
Merge pull request #57 from rusty1s/wheel
[WIP] Python wheels
2 parents 0194ebb + bc47687 commit 80b99ad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+2044
-1711
lines changed

.coveragerc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ source=torch_cluster
33
[report]
44
exclude_lines =
55
pragma: no cover
6-
cuda
6+
torch.jit.script
77
raise
8+
except
9+
is_cuda

.travis.yml

Lines changed: 81 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,90 @@
1+
language: shell
2+
3+
os:
4+
- linux
5+
- osx
6+
- windows
7+
8+
env:
9+
global:
10+
- CUDA_HOME=/usr/local/cuda
11+
jobs:
12+
- TORCH_VERSION=1.4.0 PYTHON_VERSION=3.8 IDX=cpu
13+
- TORCH_VERSION=1.4.0 PYTHON_VERSION=3.8 IDX=cu92
14+
- TORCH_VERSION=1.4.0 PYTHON_VERSION=3.8 IDX=cu100
15+
- TORCH_VERSION=1.4.0 PYTHON_VERSION=3.8 IDX=cu101
16+
- TORCH_VERSION=1.4.0 PYTHON_VERSION=3.7 IDX=cpu
17+
- TORCH_VERSION=1.4.0 PYTHON_VERSION=3.7 IDX=cu92
18+
- TORCH_VERSION=1.4.0 PYTHON_VERSION=3.7 IDX=cu100
19+
- TORCH_VERSION=1.4.0 PYTHON_VERSION=3.7 IDX=cu101
20+
- TORCH_VERSION=1.4.0 PYTHON_VERSION=3.6 IDX=cpu
21+
- TORCH_VERSION=1.4.0 PYTHON_VERSION=3.6 IDX=cu92
22+
- TORCH_VERSION=1.4.0 PYTHON_VERSION=3.6 IDX=cu100
23+
- TORCH_VERSION=1.4.0 PYTHON_VERSION=3.6 IDX=cu101
24+
125
jobs:
2-
include:
3-
- os: linux
4-
language: python
5-
python: 3.7
6-
addons:
7-
apt:
8-
sources:
9-
- ubuntu-toolchain-r-test
10-
packages:
11-
- gcc-5
12-
- g++-5
13-
env:
14-
- CC=gcc-5
15-
- CXX=g++-5
16-
- os: osx
17-
language: sh
18-
before_cache:
19-
- brew cleanup
20-
cache:
21-
directories:
22-
- $HOME/Library/Caches/Homebrew
23-
- /usr/local/Homebrew
24-
addons:
25-
homebrew:
26-
packages: python3
27-
before_install:
28-
- python3 -m pip install --upgrade virtualenv
29-
- virtualenv -p python3 --system-site-packages "$HOME/venv"
30-
- source "$HOME/venv/bin/activate"
31-
env:
32-
- CC=clang
33-
- CXX=clang++
26+
exclude: # Exclude *all* macOS CUDA jobs and Windows CUDA 9.2/10.0 jobs.
27+
- os: osx
28+
env: TORCH_VERSION=1.4.0 PYTHON_VERSION=3.8 IDX=cu92
29+
- os: osx
30+
env: TORCH_VERSION=1.4.0 PYTHON_VERSION=3.8 IDX=cu100
31+
- os: osx
32+
env: TORCH_VERSION=1.4.0 PYTHON_VERSION=3.8 IDX=cu101
33+
- os: osx
34+
env: TORCH_VERSION=1.4.0 PYTHON_VERSION=3.7 IDX=cu92
35+
- os: osx
36+
env: TORCH_VERSION=1.4.0 PYTHON_VERSION=3.7 IDX=cu100
37+
- os: osx
38+
env: TORCH_VERSION=1.4.0 PYTHON_VERSION=3.7 IDX=cu101
39+
- os: osx
40+
env: TORCH_VERSION=1.4.0 PYTHON_VERSION=3.6 IDX=cu92
41+
- os: osx
42+
env: TORCH_VERSION=1.4.0 PYTHON_VERSION=3.6 IDX=cu100
43+
- os: osx
44+
env: TORCH_VERSION=1.4.0 PYTHON_VERSION=3.6 IDX=cu101
45+
- os: windows
46+
env: TORCH_VERSION=1.4.0 PYTHON_VERSION=3.8 IDX=cu92
47+
- os: windows
48+
env: TORCH_VERSION=1.4.0 PYTHON_VERSION=3.8 IDX=cu100
49+
- os: windows
50+
env: TORCH_VERSION=1.4.0 PYTHON_VERSION=3.7 IDX=cu92
51+
- os: windows
52+
env: TORCH_VERSION=1.4.0 PYTHON_VERSION=3.7 IDX=cu100
53+
- os: windows
54+
env: TORCH_VERSION=1.4.0 PYTHON_VERSION=3.6 IDX=cu92
55+
- os: windows
56+
env: TORCH_VERSION=1.4.0 PYTHON_VERSION=3.6 IDX=cu100
57+
- os: windows
58+
env: TORCH_VERSION=1.4.0 PYTHON_VERSION=3.8 IDX=cu101
59+
3460
install:
35-
- pip install numpy
36-
- pip install --pre torch torchvision -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
37-
- pip install pycodestyle
38-
- pip install flake8
39-
- pip install codecov
61+
- source script/cuda.sh
62+
- source script/conda.sh
63+
- conda create --yes -n test python="${PYTHON_VERSION}"
64+
- source activate test
65+
- conda install pytorch=${TORCH_VERSION} ${TOOLKIT} -c pytorch --yes
66+
- source script/torch.sh
67+
- pip install flake8 codecov
68+
- python setup.py install
4069
script:
41-
- python -c "import torch; print(torch.__version__)"
42-
- pycodestyle .
4370
- flake8 .
44-
- python setup.py install
4571
- python setup.py test
4672
after_success:
73+
- python setup.py bdist_wheel --dist-dir=dist/torch-${TORCH_VERSION}
74+
- python script/rename_wheel.py ${IDX}
4775
- codecov
76+
deploy:
77+
provider: s3
78+
region: eu-central-1
79+
edge: true
80+
access_key_id: ${S3_ACCESS_KEY}
81+
secret_access_key: ${S3_SECRET_ACCESS_KEY}
82+
bucket: pytorch-geometric.com
83+
local_dir: dist/torch-${TORCH_VERSION}
84+
upload_dir: whl/torch-${TORCH_VERSION}
85+
acl: public_read
86+
on:
87+
repo: rusty1s/pytorch_cluster
88+
tags: true
4889
notifications:
4990
email: false

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2019 Matthias Fey <[email protected]>
1+
Copyright (c) 2020 Matthias Fey <[email protected]>
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

MANIFEST.in

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
include README.md
12
include LICENSE
2-
recursive-include cpu *
3-
recursive-include cuda *
3+
4+
recursive-exclude test *
5+
recursive-include csrc *

README.md

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,30 @@ All included operations work on varying data types and are implemented both for
2727

2828
## Installation
2929

30-
Ensure that at least PyTorch 1.1.0 is installed and verify that `cuda/bin` and `cuda/include` are in your `$PATH` and `$CPATH` respectively, *e.g.*:
30+
### Binaries
31+
32+
We provide pip wheels for all major OS/PyTorch/CUDA combinations, see [here](https://s3.eu-central-1.amazonaws.com/pytorch-geometric.com/whl/index.html).
33+
To install from binaries, simply run
34+
35+
```
36+
pip install torch-cluster==latest+${CUDA} -f https://s3.eu-central-1.amazonaws.com/pytorch-geometric.com/whl/torch-1.4.0.html
37+
```
38+
39+
where `${CUDA}` should be replaced by either `cpu`, `cu92`, `cu100` or `cu101` depending on your PyTorch installation.
40+
41+
| | `cpu` | `cu92` | `cu100` | `cu101` |
42+
|-------------|-------|--------|---------|---------|
43+
| **Linux** |||||
44+
| **Windows** |||||
45+
| **macOS** || | | |
46+
47+
### From source
48+
49+
Ensure that at least PyTorch 1.4.0 is installed and verify that `cuda/bin` and `cuda/include` are in your `$PATH` and `$CPATH` respectively, *e.g.*:
50+
51+
```
52+
$ python -c "import torch; print(torch.__version__)"
53+
>>> 1.4.0
3154
3255
```
3356
$ python -c "import torch; print(torch.__version__)"
@@ -46,10 +69,16 @@ Then run:
4669
pip install torch-cluster
4770
```
4871
49-
If you are running into any installation problems, please create an [issue](https://github.com/rusty1s/pytorch_cluster/issues).
50-
Be sure to import `torch` first before using this package to resolve symbols the dynamic linker must see.
72+
When running in a docker container without NVIDIA driver, PyTorch needs to evaluate the compute capabilities and may fail.
73+
In this case, ensure that the compute capabilities are set via `TORCH_CUDA_ARCH_LIST`, *e.g.*:
74+
75+
```
76+
export TORCH_CUDA_ARCH_LIST = "6.0 6.1 7.2+PTX 7.5+PTX"
77+
```
78+
79+
## Functions
5180
52-
## Graclus
81+
### Graclus
5382
5483
A greedy clustering algorithm of picking an unmarked vertex and matching it with one its unmarked neighbors (that maximizes its edge weight).
5584
The GPU algorithm is adapted from Fagginger Auer and Bisseling: [A GPU Algorithm for Greedy Graph Matching](http://www.staff.science.uu.nl/~bisse101/Articles/match12.pdf) (LNCS 2012)
@@ -70,7 +99,7 @@ print(cluster)
7099
tensor([0, 0, 1])
71100
```
72101

73-
## VoxelGrid
102+
### VoxelGrid
74103

75104
A clustering algorithm, which overlays a regular grid of user-defined size over a point cloud and clusters all points within a voxel.
76105

@@ -89,7 +118,7 @@ print(cluster)
89118
tensor([0, 5, 3, 0, 1])
90119
```
91120

92-
## FarthestPointSampling
121+
### FarthestPointSampling
93122

94123
A sampling algorithm, which iteratively samples the most distant point with regard to the rest points.
95124

@@ -107,7 +136,7 @@ print(sample)
107136
tensor([0, 3])
108137
```
109138

110-
## kNN-Graph
139+
### kNN-Graph
111140

112141
Computes graph edges to the nearest *k* points.
113142

@@ -126,7 +155,7 @@ tensor([[1, 2, 0, 3, 0, 3, 1, 2],
126155
[0, 0, 1, 1, 2, 2, 3, 3]])
127156
```
128157

129-
## Radius-Graph
158+
### Radius-Graph
130159

131160
Computes graph edges to all points within a given distance.
132161

@@ -145,7 +174,7 @@ tensor([[1, 2, 0, 3, 0, 3, 1, 2],
145174
[0, 0, 1, 1, 2, 2, 3, 3]])
146175
```
147176

148-
## Nearest
177+
### Nearest
149178

150179
Clusters points in *x* together which are nearest to a given query point in *y*.
151180

@@ -165,7 +194,7 @@ print(cluster)
165194
tensor([0, 0, 1, 1])
166195
```
167196

168-
## RandomWalk-Sampling
197+
### RandomWalk-Sampling
169198

170199
Samples random walks of length `walk_length` from all node indices in `start` in the graph given by `(row, col)`.
171200

cpu/compat.h

Lines changed: 0 additions & 5 deletions
This file was deleted.

cpu/fps.cpp

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)