| 1 |
name: Building Wheels |
| 2 |
|
| 3 |
on: [workflow_dispatch] |
| 4 |
|
| 5 |
jobs: |
| 6 |
|
| 7 |
wheel: |
| 8 |
runs-on: ${{ matrix.os }} |
| 9 |
|
| 10 |
strategy: |
| 11 |
fail-fast: false |
| 12 |
matrix: |
| 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'] |
| 17 |
exclude: |
| 18 |
- torch-version: 2.0.0 |
| 19 |
cuda-version: 'cu121' |
| 20 |
- torch-version: 2.1.0 |
| 21 |
cuda-version: 'cu117' |
| 22 |
- os: macos-11 |
| 23 |
cuda-version: 'cu117' |
| 24 |
- os: macos-11 |
| 25 |
cuda-version: 'cu118' |
| 26 |
- os: macos-11 |
| 27 |
cuda-version: 'cu121' |
| 28 |
|
| 29 |
steps: |
| 30 |
- uses: actions/checkout@v2 |
| 31 |
- name: Set up Python ${{ matrix.python-version }} |
| 32 |
uses: actions/setup-python@v2 |
| 33 |
with: |
| 34 |
python-version: ${{ matrix.python-version }} |
| 35 |
|
| 36 |
- name: Upgrade pip |
| 37 |
run: | |
| 38 |
pip install --upgrade setuptools |
| 39 |
|
| 40 |
- name: Free Disk Space (Ubuntu) |
| 41 |
if: ${{ runner.os == 'Linux' }} |
| 42 |
uses: jlumbroso/free-disk-space@main |
| 43 |
|
| 44 |
- name: Install CUDA ${{ matrix.cuda-version }} |
| 45 |
if: ${{ matrix.cuda-version != 'cpu' }} |
| 46 |
run: | |
| 47 |
bash .github/workflows/cuda/${{ matrix.cuda-version }}-${{ runner.os }}.sh |
| 48 |
|
| 49 |
- name: Install PyTorch ${{ matrix.torch-version }}+${{ matrix.cuda-version }} |
| 50 |
run: | |
| 51 |
pip install torch==${{ matrix.torch-version }} --extra-index-url https://download.pytorch.org/whl/${{ matrix.cuda-version }} |
| 52 |
python -c "import torch; print('PyTorch:', torch.__version__)" |
| 53 |
python -c "import torch; print('CUDA:', torch.version.cuda)" |
| 54 |
|
| 55 |
- name: Patch PyTorch static constexpr on Windows |
| 56 |
if: ${{ runner.os == 'Windows' }} |
| 57 |
run: | |
| 58 |
Torch_DIR=`python -c 'import os; import torch; print(os.path.dirname(torch.__file__))'` |
| 59 |
sed -i '31,38c\ |
| 60 |
TORCH_API void lazy_init_num_threads();' ${Torch_DIR}/include/ATen/Parallel.h |
| 61 |
shell: bash |
| 62 |
|
| 63 |
- name: Set version |
| 64 |
if: ${{ runner.os != 'macOS' }} |
| 65 |
run: | |
| 66 |
VERSION=`sed -n "s/^__version__ = '\(.*\)'/\1/p" torch_scatter/__init__.py` |
| 67 |
TORCH_VERSION=`echo "pt${{ matrix.torch-version }}" | sed "s/..$//" | sed "s/\.//g"` |
| 68 |
CUDA_VERSION=`echo ${{ matrix.cuda-version }}` |
| 69 |
echo "New version name: $VERSION+$TORCH_VERSION$CUDA_VERSION" |
| 70 |
sed -i "s/$VERSION/$VERSION+$TORCH_VERSION$CUDA_VERSION/" setup.py |
| 71 |
sed -i "s/$VERSION/$VERSION+$TORCH_VERSION$CUDA_VERSION/" torch_scatter/__init__.py |
| 72 |
shell: |
| 73 |
bash |
| 74 |
|
| 75 |
- name: Install main package for CPU |
| 76 |
if: ${{ matrix.cuda-version == 'cpu' }} |
| 77 |
run: | |
| 78 |
FORCE_ONLY_CPU=1 python setup.py develop |
| 79 |
shell: |
| 80 |
bash |
| 81 |
|
| 82 |
- name: Install main package for GPU |
| 83 |
if: ${{ matrix.cuda-version != 'cpu' }} |
| 84 |
run: | |
| 85 |
source .github/workflows/cuda/${{ matrix.cuda-version }}-${{ runner.os }}-env.sh |
| 86 |
python setup.py develop |
| 87 |
shell: |
| 88 |
bash |
| 89 |
|
| 90 |
- name: Test installation |
| 91 |
run: | |
| 92 |
python -c "import torch_scatter; print('torch-scatter:', torch_scatter.__version__)" |
| 93 |
|
| 94 |
- name: Build wheel |
| 95 |
run: | |
| 96 |
pip install wheel |
| 97 |
python setup.py bdist_wheel --dist-dir=dist |
| 98 |
|
| 99 |
- name: Configure AWS |
| 100 |
uses: aws-actions/configure-aws-credentials@v1 |
| 101 |
with: |
| 102 |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} |
| 103 |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |
| 104 |
aws-region: us-west-1 |
| 105 |
|
| 106 |
- name: Upload wheel |
| 107 |
run: | |
| 108 |
aws s3 sync dist s3://data.pyg.org/whl/torch-${{ matrix.torch-version }}+${{ matrix.cuda-version }} --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers |