Skip to content

Commit f05c8c5

Browse files
committed
[skip ci] conda
1 parent b137af1 commit f05c8c5

File tree

8 files changed

+168
-20
lines changed

8 files changed

+168
-20
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Building Conda
2+
3+
on: [workflow_dispatch]
4+
5+
jobs:
6+
7+
conda-build:
8+
runs-on: ${{ matrix.os }}
9+
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
os: [ubuntu-16.04, macos-10.15, windows-latest]
14+
python-version: [3.6, 3.7, 3.8, 3.9]
15+
torch-version: [1.8.0, 1.9.0]
16+
cuda-version: ['cpu', 'cu101', 'cu102', 'cu111']
17+
exclude:
18+
- torch-version: 1.9.0
19+
cuda-version: 'cu101'
20+
- os: macos-10.15
21+
cuda-version: 'cu101'
22+
- os: macos-10.15
23+
cuda-version: 'cu102'
24+
- os: macos-10.15
25+
cuda-version: 'cu111'
26+
- os: windows-latest
27+
cuda-version: 'cu101'
28+
29+
steps:
30+
- uses: actions/checkout@v2
31+
- name: Set up Conda for Python ${{ matrix.python-version }}
32+
uses: conda-incubator/setup-miniconda@v2
33+
with:
34+
python-version: ${{ matrix.python-version }}
35+
36+
- name: Install Conda packages
37+
run: |
38+
conda install conda-build conda-verify --yes
39+
shell:
40+
bash -l {0}
41+
42+
- name: Install CUDA ${{ matrix.cuda-version }}
43+
if: ${{ matrix.cuda-version != 'cpu' }}
44+
run: |
45+
bash .github/workflows/cuda/${{ matrix.cuda-version }}-${{ runner.os }}.sh
46+
shell:
47+
bash
48+
49+
- name: Build Conda package for CPU
50+
if: ${{ matrix.cuda-version == 'cpu' }}
51+
run: |
52+
FORCE_CUDA=0 ./conda/pytorch-scatter/build_conda.sh ${{ matrix.python-version }} ${{ matrix.torch-version }} ${{ matrix.cuda-version }}
53+
shell:
54+
bash -l {0}
55+
56+
- name: Build Conda package for GPU
57+
if: ${{ matrix.cuda-version != 'cpu' }}
58+
run: |
59+
source .github/workflows/cuda/${{ matrix.cuda-version }}-${{ runner.os }}-env.sh
60+
FORCE_CUDA=1 ./conda/pytorch-scatter/build_conda.sh ${{ matrix.python-version }} ${{ matrix.torch-version }} ${{ matrix.cuda-version }}
61+
shell:
62+
bash -l {0}
63+
64+
- name: Publish Conda package
65+
run: |
66+
conda install anaconda-client --yes
67+
anaconda upload --force --label main $HOME/conda-bld/*/*.tar.bz2
68+
env:
69+
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
70+
shell:
71+
bash -l {0}
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
#!/bin/bash
22

3-
wget -nv https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
4-
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
5-
wget -nv https://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda-repo-ubuntu1804-10-1-local-10.1.243-418.87.00_1.0-1_amd64.deb
6-
sudo dpkg -i cuda-repo-ubuntu1804-10-1-local-10.1.243-418.87.00_1.0-1_amd64.deb
3+
OS=ubuntu1604
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/10.1/Prod/local_installers/cuda-repo-${OS}-10-1-local-10.1.243-418.87.00_1.0-1_amd64.deb
8+
sudo dpkg -i cuda-repo-${OS}-10-1-local-10.1.243-418.87.00_1.0-1_amd64.deb
79
sudo apt-key add /var/cuda-repo-10-1-local-10.1.243-418.87.00/7fa2af80.pub
810

911
sudo apt-get -qq update
1012
sudo apt install cuda-nvcc-10-1 cuda-libraries-dev-10-1
1113
sudo apt clean
1214

13-
rm -f https://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda-repo-ubuntu1804-10-1-local-10.1.243-418.87.00_1.0-1_amd64.deb
15+
rm -f https://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda-repo-${OS}-10-1-local-10.1.243-418.87.00_1.0-1_amd64.deb
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
#!/bin/bash
22

3-
wget -nv https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
4-
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
5-
wget -nv https://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
6-
sudo dpkg -i cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
3+
OS=ubuntu1604
4+
5+
# Ubuntu-18.04
6+
wget -nv https://developer.download.nvidia.com/compute/cuda/repos/${OS}/x86_64/cuda-${OS}.pin
7+
sudo mv cuda-${OS}.pin /etc/apt/preferences.d/cuda-repository-pin-600
8+
wget -nv https://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda-repo-${OS}-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
9+
sudo dpkg -i cuda-repo-${OS}-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
710
sudo apt-key add /var/cuda-repo-10-2-local-10.2.89-440.33.01/7fa2af80.pub
811

912
sudo apt-get -qq update
1013
sudo apt install cuda-nvcc-10-2 cuda-libraries-dev-10-2
1114
sudo apt clean
1215

13-
rm -f https://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
16+
rm -f https://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda-repo-${OS}-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
#!/bin/bash
22

3-
wget -nv https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
4-
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
5-
wget -nv https://developer.download.nvidia.com/compute/cuda/11.1.1/local_installers/cuda-repo-ubuntu1804-11-1-local_11.1.1-455.32.00-1_amd64.deb
6-
sudo dpkg -i cuda-repo-ubuntu1804-11-1-local_11.1.1-455.32.00-1_amd64.deb
7-
sudo apt-key add /var/cuda-repo-ubuntu1804-11-1-local/7fa2af80.pub
3+
OS=ubuntu1604
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/11.1.1/local_installers/cuda-repo-${OS}-11-1-local_11.1.1-455.32.00-1_amd64.deb
8+
sudo dpkg -i cuda-repo-${OS}-11-1-local_11.1.1-455.32.00-1_amd64.deb
9+
sudo apt-key add /var/cuda-repo-${OS}-11-1-local/7fa2af80.pub
810

911
sudo apt-get -qq update
1012
sudo apt install cuda-nvcc-11-1 cuda-libraries-dev-11-1
1113
sudo apt clean
1214

13-
rm -f https://developer.download.nvidia.com/compute/cuda/11.1.1/local_installers/cuda-repo-ubuntu1804-11-1-local_11.1.1-455.32.00-1_amd64.deb
15+
rm -f https://developer.download.nvidia.com/compute/cuda/11.1.1/local_installers/cuda-repo-${OS}-11-1-local_11.1.1-455.32.00-1_amd64.deb

conda/pytorch-scatter/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```
2+
./build_conda.sh 3.9 1.9.0 cu111 # python, pytorch and cuda version
3+
```
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
3+
export PYTHON_VERSION=$1
4+
export TORCH_VERSION=$2
5+
export CUDA_VERSION=$3
6+
7+
export CONDA_PYTORCH_CONSTRAINT="pytorch==${TORCH_VERSION%.*}.*"
8+
9+
if [ "${CUDA_VERSION}" = "cpu" ]; then
10+
export CONDA_CUDATOOLKIT_CONSTRAINT="cpuonly"
11+
else
12+
case $CUDA_VERSION in
13+
cu111)
14+
export CONDA_CUDATOOLKIT_CONSTRAINT="cudatoolkit==11.1.*"
15+
;;
16+
cu102)
17+
export CONDA_CUDATOOLKIT_CONSTRAINT="cudatoolkit==10.2.*"
18+
;;
19+
cu101)
20+
export CONDA_CUDATOOLKIT_CONSTRAINT="cudatoolkit==10.1.*"
21+
;;
22+
*)
23+
echo "Unrecognized CUDA_VERSION=$CUDA_VERSION"
24+
exit 1
25+
;;
26+
esac
27+
fi
28+
29+
echo "PyTorch $TORCH_VERSION+$CUDA_VERSION"
30+
echo "- $CONDA_PYTORCH_CONSTRAINT"
31+
echo "- $CONDA_CUDATOOLKIT_CONSTRAINT"
32+
33+
conda build . -c defaults -c nvidia -c pytorch -c conda-forge --output-folder "$HOME/conda-bld"

conda/pytorch-scatter/meta.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package:
2+
name: pytorch-scatter
3+
version: 2.0.7
4+
5+
source:
6+
path: ../..
7+
8+
requirements:
9+
build:
10+
- {{ compiler('c') }} # [win]
11+
12+
host:
13+
- python {{ environ.get('PYTHON_VERSION') }}
14+
- {{ environ.get('CONDA_PYTORCH_CONSTRAINT') }}
15+
- {{ environ.get('CONDA_CUDATOOLKIT_CONSTRAINT') }}
16+
17+
run:
18+
- python {{ environ.get('PYTHON_VERSION') }}
19+
- {{ environ.get('CONDA_PYTORCH_CONSTRAINT') }}
20+
- {{ environ.get('CONDA_CUDATOOLKIT_CONSTRAINT') }}
21+
22+
build:
23+
string: py{{ environ.get('PYTHON_VERSION').replace('.', '') }}_torch_{{ environ['TORCH_VERSION'] }}_{{ environ['CUDA_VERSION'] }}
24+
script: python setup.py install
25+
script_env:
26+
- FORCE_CUDA
27+
28+
test:
29+
imports:
30+
- torch_scatter
31+
32+
about:
33+
home: https://github.com/rusty1s/pytorch_scatter
34+
license: MIT
35+
summary: PyTorch Extension Library of Optimized Scatter Operations

setup.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ def get_extensions():
7777

7878

7979
install_requires = []
80-
setup_requires = ['pytest-runner']
81-
tests_require = ['pytest', 'pytest-cov']
80+
setup_requires = []
81+
tests_require = ['pytest', 'pytest-runner', 'pytest-cov']
8282

8383
setup(
8484
name='torch_scatter',
@@ -96,8 +96,7 @@ def get_extensions():
9696
extras_require={'test': tests_require},
9797
ext_modules=get_extensions() if not BUILD_DOCS else [],
9898
cmdclass={
99-
'build_ext':
100-
BuildExtension.with_options(no_python_abi_suffix=True, use_ninja=False)
99+
'build_ext': BuildExtension.with_options(no_python_abi_suffix=True)
101100
},
102101
packages=find_packages(),
103102
)

0 commit comments

Comments
 (0)