Skip to content

Commit 7d22892

Browse files
authored
Add PyTorch 2.1.0 support (#344)
* update * update
1 parent 3246352 commit 7d22892

17 files changed

+104
-60
lines changed

.github/workflows/building-conda.yml

+13-15
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,21 @@ jobs:
1111
fail-fast: false
1212
matrix:
1313
# We have trouble building for Windows - drop for now.
14-
os: [ubuntu-18.04, macos-10.15] # windows-2019
15-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
16-
torch-version: [1.13.0, 2.0.0]
17-
# We have trouble building for `cu116` due to PyTorch 1.13.0 bugs
18-
cuda-version: ['cpu', 'cu117', 'cu118']
14+
os: [ubuntu-20.04, macos-11] # windows-2019
15+
python-version: ['3.8', '3.9', '3.10', '3.11']
16+
torch-version: [2.0.0, 2.1.0]
17+
cuda-version: ['cpu', 'cu117', 'cu118', 'cu121']
1918
exclude:
20-
- torch-version: 1.13.0
21-
python-version: '3.11'
2219
- torch-version: 2.0.0
23-
python-version: '3.7'
24-
- torch-version: 1.13.0
25-
cuda-version: 'cu118'
26-
- os: macos-10.15
20+
cuda-version: 'cu121'
21+
- torch-version: 2.1.0
22+
cuda-version: 'cu117'
23+
- os: macos-11
2724
cuda-version: 'cu117'
28-
- os: macos-10.15
25+
- os: macos-11
2926
cuda-version: 'cu118'
27+
- os: macos-11
28+
cuda-version: 'cu121'
3029

3130
steps:
3231
- uses: actions/checkout@v2
@@ -38,10 +37,9 @@ jobs:
3837
with:
3938
python-version: ${{ matrix.python-version }}
4039

41-
- name: Free up disk space
40+
- name: Free Disk Space (Ubuntu)
4241
if: ${{ runner.os == 'Linux' }}
43-
run: |
44-
sudo rm -rf /usr/share/dotnet
42+
uses: jlumbroso/free-disk-space@main
4543

4644
- name: Install Conda packages
4745
run: |

.github/workflows/building.yml

+16-20
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,21 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
os: [ubuntu-18.04, macos-10.15, windows-2019]
14-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
15-
torch-version: [1.13.0, 2.0.0]
16-
cuda-version: ['cpu', 'cu116', 'cu117', 'cu118']
13+
os: [ubuntu-20.04, macos-11, windows-2019]
14+
python-version: ['3.8', '3.9', '3.10', '3.11']
15+
torch-version: [2.0.0, 2.1.0]
16+
cuda-version: ['cpu', 'cu117', 'cu118', 'cu121']
1717
exclude:
18-
- torch-version: 1.13.0
19-
python-version: '3.11'
2018
- torch-version: 2.0.0
21-
python-version: '3.7'
22-
- torch-version: 1.13.0
23-
cuda-version: 'cu118'
24-
- torch-version: 2.0.0
25-
cuda-version: 'cu116'
26-
- os: macos-10.15
27-
cuda-version: 'cu116'
28-
- os: macos-10.15
19+
cuda-version: 'cu121'
20+
- torch-version: 2.1.0
2921
cuda-version: 'cu117'
30-
- os: macos-10.15
22+
- os: macos-11
23+
cuda-version: 'cu117'
24+
- os: macos-11
3125
cuda-version: 'cu118'
26+
- os: macos-11
27+
cuda-version: 'cu121'
3228

3329
steps:
3430
- uses: actions/checkout@v2
@@ -43,11 +39,11 @@ jobs:
4339
- name: Upgrade pip
4440
run: |
4541
pip install --upgrade setuptools
42+
pip install scipy==1.10.1 # Python 3.8 support
4643
47-
- name: Free up disk space
44+
- name: Free Disk Space (Ubuntu)
4845
if: ${{ runner.os == 'Linux' }}
49-
run: |
50-
sudo rm -rf /usr/share/dotnet
46+
uses: jlumbroso/free-disk-space@main
5147

5248
- name: Install CUDA ${{ matrix.cuda-version }}
5349
if: ${{ matrix.cuda-version != 'cpu' }}
@@ -89,15 +85,15 @@ jobs:
8985
- name: Install main package for CPU
9086
if: ${{ matrix.cuda-version == 'cpu' }}
9187
run: |
92-
FORCE_ONLY_CPU=1 WITH_METIS=1 pip install -e .
88+
FORCE_ONLY_CPU=1 WITH_METIS=1 python setup.py develop
9389
shell:
9490
bash
9591

9692
- name: Install main package for GPU
9793
if: ${{ matrix.cuda-version != 'cpu' }}
9894
run: |
9995
source .github/workflows/cuda/${{ matrix.cuda-version }}-${{ runner.os }}-env.sh
100-
WITH_METIS=1 pip install -e .
96+
WITH_METIS=1 python setup.py develop
10197
shell:
10298
bash
10399

.github/workflows/cuda/cu117-Linux.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
OS=ubuntu1804
3+
OS=ubuntu2004
44

55
wget -nv https://developer.download.nvidia.com/compute/cuda/repos/${OS}/x86_64/cuda-${OS}.pin
66
sudo mv cuda-${OS}.pin /etc/apt/preferences.d/cuda-repository-pin-600

.github/workflows/cuda/cu118-Linux.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
OS=ubuntu1804
3+
OS=ubuntu2004
44

55
wget -nv https://developer.download.nvidia.com/compute/cuda/repos/${OS}/x86_64/cuda-${OS}.pin
66
sudo mv cuda-${OS}.pin /etc/apt/preferences.d/cuda-repository-pin-600
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
CUDA_HOME=/usr/local/cuda-12.1
4+
LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
5+
PATH=${CUDA_HOME}/bin:${PATH}
6+
7+
export FORCE_CUDA=1
8+
export TORCH_CUDA_ARCH_LIST="5.0+PTX;6.0;7.0;7.5;8.0;8.6;9.0"

.github/workflows/cuda/cu121-Linux.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
OS=ubuntu2004
4+
5+
wget -nv https://developer.download.nvidia.com/compute/cuda/repos/${OS}/x86_64/cuda-${OS}.pin
6+
sudo mv cuda-${OS}.pin /etc/apt/preferences.d/cuda-repository-pin-600
7+
wget -nv https://developer.download.nvidia.com/compute/cuda/12.1.1/local_installers/cuda-repo-${OS}-12-1-local_12.1.1-530.30.02-1_amd64.deb
8+
sudo dpkg -i cuda-repo-${OS}-12-1-local_12.1.1-530.30.02-1_amd64.deb
9+
sudo cp /var/cuda-repo-${OS}-12-1-local/cuda-*-keyring.gpg /usr/share/keyrings/
10+
11+
sudo apt-get -qq update
12+
sudo apt install cuda-nvcc-12-1 cuda-libraries-dev-12-1
13+
sudo apt clean
14+
15+
rm -f https://developer.download.nvidia.com/compute/cuda/12.1.0/local_installers/cuda-repo-${OS}-12-1-local_12.1.1-530.30.02-1_amd64.deb
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
CUDA_HOME=/c/Program\ Files/NVIDIA\ GPU\ Computing\ Toolkit/CUDA/v12.1
4+
PATH=${CUDA_HOME}/bin:$PATH
5+
PATH=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/2017/BuildTools/MSBuild/15.0/Bin:$PATH
6+
7+
export FORCE_CUDA=1
8+
export TORCH_CUDA_ARCH_LIST="6.0+PTX"
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
# Install NVIDIA drivers, see:
4+
# https://github.com/pytorch/vision/blob/master/packaging/windows/internal/cuda_install.bat#L99-L102
5+
curl -k -L "https://drive.google.com/u/0/uc?id=1injUyo3lnarMgWyRcXqKg4UGnN0ysmuq&export=download" --output "/tmp/gpu_driver_dlls.zip"
6+
7z x "/tmp/gpu_driver_dlls.zip" -o"/c/Windows/System32"
7+
8+
export CUDA_SHORT=12.1
9+
export CUDA_URL=https://developer.download.nvidia.com/compute/cuda/${CUDA_SHORT}.1/local_installers
10+
export CUDA_FILE=cuda_${CUDA_SHORT}.1_531.14_windows.exe
11+
12+
# Install CUDA:
13+
curl -k -L "${CUDA_URL}/${CUDA_FILE}" --output "${CUDA_FILE}"
14+
echo ""
15+
echo "Installing from ${CUDA_FILE}..."
16+
PowerShell -Command "Start-Process -FilePath \"${CUDA_FILE}\" -ArgumentList \"-s nvcc_${CUDA_SHORT} cuobjdump_${CUDA_SHORT} nvprune_${CUDA_SHORT} cupti_${CUDA_SHORT} cublas_dev_${CUDA_SHORT} cudart_${CUDA_SHORT} cufft_dev_${CUDA_SHORT} curand_dev_${CUDA_SHORT} cusolver_dev_${CUDA_SHORT} cusparse_dev_${CUDA_SHORT} thrust_${CUDA_SHORT} npp_dev_${CUDA_SHORT} nvrtc_dev_${CUDA_SHORT} nvml_dev_${CUDA_SHORT}\" -Wait -NoNewWindow"
17+
echo "Done!"
18+
rm -f "${CUDA_FILE}"

.github/workflows/testing.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
matrix:
1717
os: [ubuntu-latest, windows-2019]
1818
python-version: [3.8]
19-
torch-version: [1.13.0, 2.0.0]
19+
torch-version: [2.0.0, 2.1.0]
2020

2121
steps:
2222
- uses: actions/checkout@v2
@@ -48,7 +48,7 @@ jobs:
4848
4949
- name: Install main package
5050
run: |
51-
pip install scipy
51+
pip install scipy==1.10.1 # Python 3.8 support
5252
python setup.py develop
5353
env:
5454
WITH_METIS: 1

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.10)
22
project(torchsparse)
33
set(CMAKE_CXX_STANDARD 14)
4-
set(TORCHSPARSE_VERSION 0.6.17)
4+
set(TORCHSPARSE_VERSION 0.6.18)
55
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
66

77
option(WITH_CUDA "Enable CUDA support" OFF)

README.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -43,39 +43,39 @@ conda install pytorch-sparse -c pyg
4343

4444
We alternatively provide pip wheels for all major OS/PyTorch/CUDA combinations, see [here](https://data.pyg.org/whl).
4545

46-
#### PyTorch 2.0
46+
#### PyTorch 2.1
4747

48-
To install the binaries for PyTorch 2.0.0, simply run
48+
To install the binaries for PyTorch 2.1.0, simply run
4949

5050
```
51-
pip install torch-scatter torch-sparse -f https://data.pyg.org/whl/torch-2.0.0+${CUDA}.html
51+
pip install torch-scatter torch-sparse -f https://data.pyg.org/whl/torch-2.1.0+${CUDA}.html
5252
```
5353

54-
where `${CUDA}` should be replaced by either `cpu`, `cu117`, or `cu118` depending on your PyTorch installation.
54+
where `${CUDA}` should be replaced by either `cpu`, `cu118`, or `cu121` depending on your PyTorch installation.
5555

56-
| | `cpu` | `cu117` | `cu118` |
56+
| | `cpu` | `cu118` | `cu121` |
5757
|-------------|-------|---------|---------|
5858
| **Linux** ||||
5959
| **Windows** ||||
6060
| **macOS** || | |
6161

62-
#### PyTorch 1.13
62+
#### PyTorch 2.0
6363

64-
To install the binaries for PyTorch 1.13.0, simply run
64+
To install the binaries for PyTorch 2.0.0, simply run
6565

6666
```
67-
pip install torch-scatter torch-sparse -f https://data.pyg.org/whl/torch-1.13.0+${CUDA}.html
67+
pip install torch-scatter torch-sparse -f https://data.pyg.org/whl/torch-2.0.0+${CUDA}.html
6868
```
6969

70-
where `${CUDA}` should be replaced by either `cpu`, `cu116`, or `cu117` depending on your PyTorch installation.
70+
where `${CUDA}` should be replaced by either `cpu`, `cu117`, or `cu118` depending on your PyTorch installation.
7171

72-
| | `cpu` | `cu116` | `cu117` |
72+
| | `cpu` | `cu117` | `cu118` |
7373
|-------------|-------|---------|---------|
7474
| **Linux** ||||
7575
| **Windows** ||||
7676
| **macOS** || | |
7777

78-
**Note:** Binaries of older versions are also provided for PyTorch 1.4.0, PyTorch 1.5.0, PyTorch 1.6.0, PyTorch 1.7.0/1.7.1, PyTorch 1.8.0/1.8.1, PyTorch 1.9.0, PyTorch 1.10.0/1.10.1/1.10.2, PyTorch 1.11.0 and PyTorch 1.12.0/1.12.1 (following the same procedure).
78+
**Note:** Binaries of older versions are also provided for PyTorch 1.4.0, PyTorch 1.5.0, PyTorch 1.6.0, PyTorch 1.7.0/1.7.1, PyTorch 1.8.0/1.8.1, PyTorch 1.9.0, PyTorch 1.10.0/1.10.1/1.10.2, PyTorch 1.11.0, PyTorch 1.12.0/1.12.1 and PyTorch 1.13.0/1.13.1 (following the same procedure).
7979
For older versions, you need to explicitly specify the latest supported version number or install via `pip install --no-index` in order to prevent a manual installation from source.
8080
You can look up the latest supported version number [here](https://data.pyg.org/whl).
8181

conda/pytorch-sparse/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
```
2-
./build_conda.sh 3.9 2.0.0 cu117 # python, pytorch and cuda version
2+
./build_conda.sh 3.9 2.1.0 cu118 # python, pytorch and cuda version
33
```

conda/pytorch-sparse/build_conda.sh

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ if [ "${CUDA_VERSION}" = "cpu" ]; then
1010
export CONDA_CUDATOOLKIT_CONSTRAINT="cpuonly # [not osx]"
1111
else
1212
case $CUDA_VERSION in
13+
cu121)
14+
export CONDA_CUDATOOLKIT_CONSTRAINT="pytorch-cuda==12.1.*"
15+
;;
1316
cu118)
1417
export CONDA_CUDATOOLKIT_CONSTRAINT="pytorch-cuda==11.8.*"
1518
;;

conda/pytorch-sparse/meta.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package:
22
name: pytorch-sparse
3-
version: 0.6.17
3+
version: 0.6.18
44

55
source:
66
path: ../..
@@ -24,7 +24,6 @@ requirements:
2424

2525
build:
2626
string: py{{ environ.get('PYTHON_VERSION').replace('.', '') }}_torch_{{ environ['TORCH_VERSION'] }}_{{ environ['CUDA_VERSION'] }}
27-
number: 1
2827
script_env:
2928
- FORCE_CUDA
3029
- TORCH_CUDA_ARCH_LIST

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ classifiers =
66
Development Status :: 5 - Production/Stable
77
License :: OSI Approved :: MIT License
88
Programming Language :: Python
9-
Programming Language :: Python :: 3.7
109
Programming Language :: Python :: 3.8
1110
Programming Language :: Python :: 3.9
1211
Programming Language :: Python :: 3.10
12+
Programming Language :: Python :: 3.11
1313
Programming Language :: Python :: 3 :: Only
1414

1515
[aliases]

setup.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
CUDAExtension,
1616
)
1717

18-
__version__ = '0.6.17'
18+
__version__ = '0.6.18'
1919
URL = 'https://github.com/rusty1s/pytorch_sparse'
2020

2121
WITH_CUDA = False
@@ -159,15 +159,14 @@ def get_extensions():
159159
'sparse-matrices',
160160
'autograd',
161161
],
162-
python_requires='>=3.7',
162+
python_requires='>=3.8',
163163
install_requires=install_requires,
164164
extras_require={
165165
'test': test_requires,
166166
},
167167
ext_modules=get_extensions() if not BUILD_DOCS else [],
168168
cmdclass={
169-
'build_ext':
170-
BuildExtension.with_options(no_python_abi_suffix=True)
169+
'build_ext': BuildExtension.with_options(no_python_abi_suffix=True)
171170
},
172171
packages=find_packages(),
173172
include_package_data=include_package_data,

torch_sparse/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import torch
55

6-
__version__ = '0.6.17'
6+
__version__ = '0.6.18'
77

88
for library in [
99
'_version', '_convert', '_diag', '_spmm', '_metis', '_rw', '_saint',

0 commit comments

Comments
 (0)