Commit 2c28d55c authored by rusty1s's avatar rusty1s
Browse files

PyTorch 1.11 support

parent 953fda19
...@@ -10,21 +10,27 @@ jobs: ...@@ -10,21 +10,27 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-18.04, macos-10.15, windows-latest] os: [ubuntu-18.04, macos-10.15, windows-2019]
python-version: [3.6, 3.7, 3.8, 3.9] python-version: ['3.7', '3.8', '3.9', '3.10']
torch-version: [1.10.0] torch-version: [1.10.0, 1.11.0]
cuda-version: ['cpu', 'cu102', 'cu111', 'cu113'] cuda-version: ['cpu', 'cu102', 'cu113', 'cu115']
exclude: exclude:
- torch-version: 1.9.0
cuda-version: 'cu113'
- torch-version: 1.10.0 - torch-version: 1.10.0
cuda-version: 'cu111' cuda-version: 'cu115'
- os: macos-10.15 - torch-version: 1.10.0
python-version: '3.10'
- os: windows-2019
torch-version: 1.11.0
cuda-version: 'cu102' cuda-version: 'cu102'
- os: macos-10.15 - os: macos-10.15
cuda-version: 'cu111' cuda-version: 'cu102'
- os: macos-10.15 - os: macos-10.15
cuda-version: 'cu113' cuda-version: 'cu113'
- os: macos-10.15
cuda-version: 'cu115'
# There is a weird `glibc=2.27` bug going on for this combination:
- os: ubuntu-18.04
python-version: '3.10'
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
......
...@@ -10,21 +10,24 @@ jobs: ...@@ -10,21 +10,24 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-18.04, macos-10.15, windows-latest] os: [ubuntu-18.04, macos-10.15, windows-2019]
python-version: [3.6, 3.7, 3.8, 3.9] python-version: ['3.7', '3.8', '3.9', '3.10']
torch-version: [1.10.0] torch-version: [1.10.0, 1.11.0]
cuda-version: ['cpu', 'cu102', 'cu111', 'cu113'] cuda-version: ['cpu', 'cu102', 'cu113', 'cu115']
exclude: exclude:
- torch-version: 1.9.0
cuda-version: 'cu113'
- torch-version: 1.10.0 - torch-version: 1.10.0
cuda-version: 'cu111' cuda-version: 'cu115'
- os: macos-10.15 - torch-version: 1.10.0
python-version: '3.10'
- os: windows-2019
torch-version: 1.11.0
cuda-version: 'cu102' cuda-version: 'cu102'
- os: macos-10.15 - os: macos-10.15
cuda-version: 'cu111' cuda-version: 'cu102'
- os: macos-10.15 - os: macos-10.15
cuda-version: 'cu113' cuda-version: 'cu113'
- os: macos-10.15
cuda-version: 'cu115'
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
......
#!/bin/bash
CUDA_HOME=/usr/local/cuda-11.5
LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
PATH=${CUDA_HOME}/bin:${PATH}
export FORCE_CUDA=1
export TORCH_CUDA_ARCH_LIST="3.5;5.0+PTX;6.0;7.0;7.5;8.0;8.6"
#!/bin/bash
OS=ubuntu1804
wget -nv https://developer.download.nvidia.com/compute/cuda/repos/${OS}/x86_64/cuda-${OS}.pin
sudo mv cuda-${OS}.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget -nv https://developer.download.nvidia.com/compute/cuda/11.5.2/local_installers/cuda-repo-${OS}-11-5-local_11.5.2-495.29.05-1_amd64.deb
sudo dpkg -i cuda-repo-${OS}-11-5-local_11.5.2-495.29.05-1_amd64.deb
sudo apt-key add /var/cuda-repo-${OS}-11-5-local/7fa2af80.pub
sudo apt-get -qq update
sudo apt install cuda-nvcc-11-5 cuda-libraries-dev-11-5
sudo apt clean
rm -f https://developer.download.nvidia.com/compute/cuda/11.5.2/local_installers/cuda-repo-${OS}-11-5-local_11.5.2-495.29.05-1_amd64.deb
#!/bin/bash
CUDA_HOME=/c/Program\ Files/NVIDIA\ GPU\ Computing\ Toolkit/CUDA/v11.3
PATH=${CUDA_HOME}/bin:$PATH
PATH=/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/2017/BuildTools/MSBuild/15.0/Bin:$PATH
export FORCE_CUDA=1
export TORCH_CUDA_ARCH_LIST="6.0+PTX"
#!/bin/bash
# TODO We currently use CUDA 11.3 to build CUDA 11.5 Windows wheels
# Install NVIDIA drivers, see:
# https://github.com/pytorch/vision/blob/master/packaging/windows/internal/cuda_install.bat#L99-L102
curl -k -L "https://drive.google.com/u/0/uc?id=1injUyo3lnarMgWyRcXqKg4UGnN0ysmuq&export=download" --output "/tmp/gpu_driver_dlls.zip"
7z x "/tmp/gpu_driver_dlls.zip" -o"/c/Windows/System32"
export CUDA_SHORT=11.3
export CUDA_URL=https://developer.download.nvidia.com/compute/cuda/${CUDA_SHORT}.0/local_installers
export CUDA_FILE=cuda_${CUDA_SHORT}.0_465.89_win10.exe
# Install CUDA:
curl -k -L "${CUDA_URL}/${CUDA_FILE}" --output "${CUDA_FILE}"
echo ""
echo "Installing from ${CUDA_FILE}..."
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"
echo "Done!"
rm -f "${CUDA_FILE}"
name: Linting name: Linting
on: [push, pull_request] on:
push:
branches:
- master
pull_request:
jobs: jobs:
flake8: flake8:
runs-on: ${{ matrix.os }} runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.6]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python-version: ${{ matrix.python-version }} python-version: 3.9
- name: Install dependencies - name: Install dependencies
run: | run: |
...@@ -26,3 +26,30 @@ jobs: ...@@ -26,3 +26,30 @@ jobs:
- name: Run linting - name: Run linting
run: | run: |
flake8 . flake8 .
pyroma:
runs-on: ubuntu-latest
strategy:
matrix:
torch-version: [1.11.0]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install PyTorch ${{ matrix.torch-version }}
run: |
pip install torch==${{ matrix.torch-version}}+cpu -f https://download.pytorch.org/whl/torch_stable.html
- name: Install dependencies
run: |
pip install pyroma
- name: Check package metadata
run: |
pyroma --min=10 .
name: Testing name: Testing
on: [push, pull_request] on:
push:
branches:
- master
pull_request:
jobs: jobs:
...@@ -9,9 +13,10 @@ jobs: ...@@ -9,9 +13,10 @@ jobs:
strategy: strategy:
matrix: matrix:
fail-fast: false
os: [ubuntu-latest, windows-latest] os: [ubuntu-latest, windows-latest]
python-version: [3.6] python-version: [3.7]
torch-version: [1.9.0, 1.10.0] torch-version: [1.10.0, 1.11.0]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
...@@ -30,16 +35,10 @@ jobs: ...@@ -30,16 +35,10 @@ jobs:
- name: Run test-suite - name: Run test-suite
run: | run: |
python setup.py test pytest --cov --cov-report=xml
- name: Generate coverage report - name: Upload coverage
if: success()
run: |
pip install coverage
coverage xml
- name: Upload coverage report to codecov
uses: codecov/codecov-action@v1 uses: codecov/codecov-action@v1
if: success() if: success()
with: with:
file: coverage.xml fail_ci_if_error: false
``` ```
./build_conda.sh 3.9 1.9.0 cu111 # python, pytorch and cuda version ./build_conda.sh 3.9 1.11.0 cu113 # python, pytorch and cuda version
``` ```
...@@ -10,6 +10,9 @@ if [ "${CUDA_VERSION}" = "cpu" ]; then ...@@ -10,6 +10,9 @@ if [ "${CUDA_VERSION}" = "cpu" ]; then
export CONDA_CUDATOOLKIT_CONSTRAINT="cpuonly # [not osx]" export CONDA_CUDATOOLKIT_CONSTRAINT="cpuonly # [not osx]"
else else
case $CUDA_VERSION in case $CUDA_VERSION in
cu115)
export CONDA_CUDATOOLKIT_CONSTRAINT="cudatoolkit==11.5.*"
;;
cu113) cu113)
export CONDA_CUDATOOLKIT_CONSTRAINT="cudatoolkit==11.3.*" export CONDA_CUDATOOLKIT_CONSTRAINT="cudatoolkit==11.3.*"
;; ;;
...@@ -33,4 +36,4 @@ echo "PyTorch $TORCH_VERSION+$CUDA_VERSION" ...@@ -33,4 +36,4 @@ echo "PyTorch $TORCH_VERSION+$CUDA_VERSION"
echo "- $CONDA_PYTORCH_CONSTRAINT" echo "- $CONDA_PYTORCH_CONSTRAINT"
echo "- $CONDA_CUDATOOLKIT_CONSTRAINT" echo "- $CONDA_CUDATOOLKIT_CONSTRAINT"
conda build . -c nvidia -c pytorch -c default -c conda-forge --output-folder "$HOME/conda-bld" conda build . -c pytorch -c default --output-folder "$HOME/conda-bld"
[metadata] [metadata]
description-file = README.md long_description=file: README.md
long_description_content_type=text/markdown
classifiers =
Development Status :: 5 - Production/Stable
License :: OSI Approved :: MIT License
Programming Language :: Python
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3 :: Only
[aliases] [aliases]
test=pytest test = pytest
[tool:pytest] [tool:pytest]
addopts = --cov addopts = --capture=no
import os
import glob import glob
import os
import os.path as osp import os.path as osp
from itertools import product
from setuptools import setup, find_packages
import platform import platform
import sys import sys
from itertools import product
import torch import torch
from torch.utils.cpp_extension import BuildExtension from setuptools import find_packages, setup
from torch.utils.cpp_extension import CppExtension, CUDAExtension, CUDA_HOME from torch.__config__ import parallel_info
from torch.utils.cpp_extension import (CUDA_HOME, BuildExtension, CppExtension,
CUDAExtension)
__version__ = '1.2.1',
URL = 'https://github.com/rusty1s/pytorch_spline_conv'
WITH_CUDA = torch.cuda.is_available() and CUDA_HOME is not None WITH_CUDA = torch.cuda.is_available() and CUDA_HOME is not None
suffices = ['cpu', 'cuda'] if WITH_CUDA else ['cpu'] suffices = ['cpu', 'cuda'] if WITH_CUDA else ['cpu']
...@@ -35,6 +39,22 @@ def get_extensions(): ...@@ -35,6 +39,22 @@ def get_extensions():
extra_compile_args['cxx'] += ['-Wno-sign-compare'] extra_compile_args['cxx'] += ['-Wno-sign-compare']
extra_link_args = ['-s'] extra_link_args = ['-s']
info = parallel_info()
if ('backend: OpenMP' in info and 'OpenMP not found' not in info
and sys.platform != 'darwin'):
extra_compile_args['cxx'] += ['-DAT_PARALLEL_OPENMP']
if sys.platform == 'win32':
extra_compile_args['cxx'] += ['/openmp']
else:
extra_compile_args['cxx'] += ['-fopenmp']
else:
print('Compiling without OpenMP...')
# Compile for mac arm64
if (sys.platform == 'darwin' and platform.machine() == 'arm64'):
extra_compile_args['cxx'] += ['-arch', 'arm64']
extra_link_args += ['-arch', 'arm64']
if suffix == 'cuda': if suffix == 'cuda':
define_macros += [('WITH_CUDA', None)] define_macros += [('WITH_CUDA', None)]
nvcc_flags = os.getenv('NVCC_FLAGS', '') nvcc_flags = os.getenv('NVCC_FLAGS', '')
...@@ -53,11 +73,6 @@ def get_extensions(): ...@@ -53,11 +73,6 @@ def get_extensions():
if suffix == 'cuda' and osp.exists(path): if suffix == 'cuda' and osp.exists(path):
sources += [path] sources += [path]
# Compile for mac arm64
if (sys.platform == 'darwin' and platform.machine() == 'arm64'):
extra_compile_args['cxx'] += ['-arch', 'arm64']
extra_link_args += ['-arch', 'arm64']
Extension = CppExtension if suffix == 'cpu' else CUDAExtension Extension = CppExtension if suffix == 'cpu' else CUDAExtension
extension = Extension( extension = Extension(
f'torch_spline_conv._{name}_{suffix}', f'torch_spline_conv._{name}_{suffix}',
...@@ -73,33 +88,37 @@ def get_extensions(): ...@@ -73,33 +88,37 @@ def get_extensions():
install_requires = [] install_requires = []
setup_requires = []
tests_require = ['pytest', 'pytest-runner', 'pytest-cov'] test_requires = [
'pytest',
'pytest-cov',
]
setup( setup(
name='torch_spline_conv', name='torch_spline_conv',
version='1.2.1', version=__version__,
author='Matthias Fey',
author_email='matthias.fey@tu-dortmund.de',
url='https://github.com/rusty1s/pytorch_spline_conv',
description=('Implementation of the Spline-Based Convolution Operator of ' description=('Implementation of the Spline-Based Convolution Operator of '
'SplineCNN in PyTorch'), 'SplineCNN in PyTorch'),
author='Matthias Fey',
author_email='matthias.fey@tu-dortmund.de',
url=URL,
download_url=f'{URL}/archive/{__version__}.tar.gz',
keywords=[ keywords=[
'pytorch', 'pytorch',
'geometric-deep-learning', 'geometric-deep-learning',
'graph-neural-networks', 'graph-neural-networks',
'spline-cnn', 'spline-cnn',
], ],
license='MIT', python_requires='>=3.7',
python_requires='>=3.6',
install_requires=install_requires, install_requires=install_requires,
setup_requires=setup_requires, extras_require={
tests_require=tests_require, 'test': test_requires,
extras_require={'test': tests_require}, },
ext_modules=get_extensions() if not BUILD_DOCS else [], ext_modules=get_extensions() if not BUILD_DOCS else [],
cmdclass={ cmdclass={
'build_ext': 'build_ext':
BuildExtension.with_options(no_python_abi_suffix=True, use_ninja=False) BuildExtension.with_options(no_python_abi_suffix=True, use_ninja=False)
}, },
packages=find_packages(), packages=find_packages(),
include_package_data=True,
) )
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment