Skip to content

Commit bd56751

Browse files
authored
Add PyTorch 2.4 support (#381)
update
1 parent dcfaa5e commit bd56751

File tree

10 files changed

+87
-28
lines changed

10 files changed

+87
-28
lines changed

.github/workflows/building-conda.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,27 @@ jobs:
1010
strategy:
1111
fail-fast: false
1212
matrix:
13-
# We have trouble building for Windows - drop for now.
14-
os: [ubuntu-20.04] # windows-2019
13+
os: [ubuntu-20.04, macos-14, windows-2019]
1514
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
16-
torch-version: [2.3.0] # [2.1.0, 2.2.0, 2.3.0]
17-
cuda-version: ['cpu', 'cu118', 'cu121']
15+
torch-version: [2.4.0] # [2.3.0, 2.4.0]
16+
cuda-version: ['cpu', 'cu118', 'cu121', 'cu124']
1817
exclude:
19-
- python-version: '3.12' # Python 3.12 not yet supported in `conda-build`.
20-
- torch-version: 2.1.0
21-
python-version: '3.12'
18+
- torch-version: 2.3.0
19+
cuda-version: 'cu124'
20+
- os: macos-14
21+
cuda-version: 'cu118'
22+
- os: macos-14
23+
cuda-version: 'cu121'
24+
- os: macos-14
25+
cuda-version: 'cu124'
2226

2327
steps:
2428
- uses: actions/checkout@v2
2529
with:
2630
submodules: 'recursive'
2731

2832
- name: Set up Conda for Python ${{ matrix.python-version }}
29-
uses: conda-incubator/setup-miniconda@v2
33+
uses: conda-incubator/setup-miniconda@v3
3034
with:
3135
python-version: ${{ matrix.python-version }}
3236

.github/workflows/building.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,17 @@ jobs:
1212
matrix:
1313
os: [ubuntu-20.04, macos-14, windows-2019]
1414
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
15-
torch-version: [2.3.0] # [2.1.0, 2.2.0, 2.3.0]
16-
cuda-version: ['cpu', 'cu118', 'cu121']
15+
torch-version: [2.4.0] # [2.3.0, 2.4.0]
16+
cuda-version: ['cpu', 'cu118', 'cu121', 'cu124']
1717
exclude:
18-
- torch-version: 2.1.0
19-
python-version: '3.12'
18+
- torch-version: 2.3.0
19+
cuda-version: 'cu124'
2020
- os: macos-14
2121
cuda-version: 'cu118'
2222
- os: macos-14
2323
cuda-version: 'cu121'
24+
- os: macos-14
25+
cuda-version: 'cu124'
2426

2527
steps:
2628
- uses: actions/checkout@v2
@@ -37,7 +39,7 @@ jobs:
3739
pip install --upgrade setuptools
3840
3941
- name: Install scipy
40-
if: ${{ matrix.python-version == '3.8' }}
42+
if: ${{ (matrix.python-version == '3.8') || (matrix.python-version == '3.9') }}
4143
run: |
4244
pip install scipy==1.10.1
4345
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.4
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"
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.4.1/local_installers/cuda-repo-${OS}-12-4-local_12.4.1-550.54.15-1_amd64.deb
8+
sudo dpkg -i cuda-repo-${OS}-12-4-local_12.4.1-550.54.15-1_amd64.deb
9+
sudo cp /var/cuda-repo-${OS}-12-4-local/cuda-*-keyring.gpg /usr/share/keyrings/
10+
11+
sudo apt-get -qq update
12+
sudo apt install cuda-nvcc-12-4 cuda-libraries-dev-12-4
13+
sudo apt clean
14+
15+
rm -f https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda-repo-${OS}-12-4-local_12.4.1-550.54.15-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.4
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.4
9+
export CUDA_URL=https://developer.download.nvidia.com/compute/cuda/${CUDA_SHORT}.1/local_installers
10+
export CUDA_FILE=cuda_${CUDA_SHORT}.1_551.78_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-2019]
1818
python-version: [3.8]
19-
torch-version: [2.2.0, 2.3.0]
19+
torch-version: [2.3.0, 2.4.0]
2020

2121
steps:
2222
- uses: actions/checkout@v2

README.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,28 +43,29 @@ 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.3
46+
#### PyTorch 2.4
4747

48-
To install the binaries for PyTorch 2.3.0, simply run
48+
To install the binaries for PyTorch 2.4.0, simply run
4949

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

54-
where `${CUDA}` should be replaced by either `cpu`, `cu118`, or `cu121` depending on your PyTorch installation.
54+
where `${CUDA}` should be replaced by either `cpu`, `cu118`, `cu121`, or `cu124` depending on your PyTorch installation.
55+
56+
| | `cpu` | `cu118` | `cu121` | `cu124` |
57+
|-------------|-------|---------|---------|---------|
58+
| **Linux** |||||
59+
| **Windows** |||||
60+
| **macOS** || | | |
5561

56-
| | `cpu` | `cu118` | `cu121` |
57-
|-------------|-------|---------|---------|
58-
| **Linux** ||||
59-
| **Windows** ||||
60-
| **macOS** || | |
6162

62-
#### PyTorch 2.2
63+
#### PyTorch 2.3
6364

64-
To install the binaries for PyTorch 2.2.0, simply run
65+
To install the binaries for PyTorch 2.3.0, simply run
6566

6667
```
67-
pip install torch-scatter torch-sparse -f https://data.pyg.org/whl/torch-2.2.0+${CUDA}.html
68+
pip install torch-scatter torch-sparse -f https://data.pyg.org/whl/torch-2.3.0+${CUDA}.html
6869
```
6970

7071
where `${CUDA}` should be replaced by either `cpu`, `cu118`, or `cu121` depending on your PyTorch installation.
@@ -75,7 +76,7 @@ where `${CUDA}` should be replaced by either `cpu`, `cu118`, or `cu121` dependin
7576
| **Windows** ||||
7677
| **macOS** || | |
7778

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, PyTorch 1.13.0/1.13.1, PyTorch 2.0.0/2.0.1, PyTorch 2.1.0/2.1.1/2.1.2 (following the same procedure).
79+
**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, PyTorch 1.13.0/1.13.1, PyTorch 2.0.0/2.0.1, PyTorch 2.1.0/2.1.1/2.1.2, and PyTorch 2.2.0/2.2.1/2.2.2 (following the same procedure).
7980
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.
8081
You can look up the latest supported version number [here](https://data.pyg.org/whl).
8182

conda/pytorch-sparse/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
```
2-
./build_conda.sh 3.11 2.3.0 cu118 # python, pytorch and cuda version
2+
./build_conda.sh 3.11 2.4.0 cu118 # python, pytorch and cuda version
33
```

conda/pytorch-sparse/build_conda.sh

Lines changed: 3 additions & 0 deletions
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+
cu124)
14+
export CONDA_CUDATOOLKIT_CONSTRAINT="pytorch-cuda==12.4.*"
15+
;;
1316
cu121)
1417
export CONDA_CUDATOOLKIT_CONSTRAINT="pytorch-cuda==12.1.*"
1518
;;

0 commit comments

Comments
 (0)