Skip to content

Commit 89b74f0

Browse files
authored
Add PyTorch 2.1.0 support (#191)
* update * update * update
1 parent 73b5146 commit 89b74f0

File tree

17 files changed

+102
-54
lines changed

17 files changed

+102
-54
lines changed

.github/workflows/building-conda.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +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']
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:
2019
- torch-version: 2.0.0
21-
python-version: '3.7'
22-
- torch-version: 1.13.0
23-
cuda-version: 'cu118'
24-
- os: macos-10.15
20+
cuda-version: 'cu121'
21+
- torch-version: 2.1.0
22+
cuda-version: 'cu117'
23+
- os: macos-11
2524
cuda-version: 'cu117'
26-
- os: macos-10.15
25+
- os: macos-11
2726
cuda-version: 'cu118'
27+
- os: macos-11
28+
cuda-version: 'cu121'
2829

2930
steps:
3031
- uses: actions/checkout@v2
@@ -33,10 +34,9 @@ jobs:
3334
with:
3435
python-version: ${{ matrix.python-version }}
3536

36-
- name: Free up disk space
37+
- name: Free Disk Space (Ubuntu)
3738
if: ${{ runner.os == 'Linux' }}
38-
run: |
39-
sudo rm -rf /usr/share/dotnet
39+
uses: jlumbroso/free-disk-space@main
4040

4141
- name: Install Conda packages
4242
run: |

.github/workflows/building.yml

Lines changed: 16 additions & 20 deletions
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
@@ -40,12 +36,12 @@ jobs:
4036
- name: Upgrade pip
4137
run: |
4238
pip install --upgrade setuptools
39+
pip install scipy==1.10.1 # Python 3.8 support
4340
pip list
4441
45-
- name: Free up disk space
42+
- name: Free Disk Space (Ubuntu)
4643
if: ${{ runner.os == 'Linux' }}
47-
run: |
48-
sudo rm -rf /usr/share/dotnet
44+
uses: jlumbroso/free-disk-space@main
4945

5046
- name: Install CUDA ${{ matrix.cuda-version }}
5147
if: ${{ matrix.cuda-version != 'cpu' }}
@@ -73,15 +69,15 @@ jobs:
7369
- name: Install main package for CPU
7470
if: ${{ matrix.cuda-version == 'cpu' }}
7571
run: |
76-
FORCE_ONLY_CPU=1 pip install -e .
72+
FORCE_ONLY_CPU=1 python setup.py develop
7773
shell:
7874
bash
7975

8076
- name: Install main package for GPU
8177
if: ${{ matrix.cuda-version != 'cpu' }}
8278
run: |
8379
source .github/workflows/cuda/${{ matrix.cuda-version }}-${{ runner.os }}-env.sh
84-
pip install -e .
80+
python setup.py develop
8581
shell:
8682
bash
8783

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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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
Lines changed: 8 additions & 0 deletions
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

Lines changed: 15 additions & 0 deletions
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
Lines changed: 8 additions & 0 deletions
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"
Lines changed: 18 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
matrix:
1717
os: [ubuntu-latest, windows-latest]
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

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
cmake_minimum_required(VERSION 3.0)
22
project(torchcluster)
33
set(CMAKE_CXX_STANDARD 14)
4-
set(TORCHCLUSTER_VERSION 1.6.1)
4+
set(TORCHCLUSTER_VERSION 1.6.2)
55

66
option(WITH_CUDA "Enable CUDA support" OFF)
77
option(WITH_PYTHON "Link to Python when building" ON)

0 commit comments

Comments
 (0)