Building Wheels #51
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Building Wheels | |
on: | |
workflow_dispatch: | |
release: | |
types: [created] | |
branches: [master] | |
jobs: | |
wheel: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04] | |
# support version based on: https://download.pytorch.org/whl/torch/ | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
torch-version: [2.0.0, 2.1.0, 2.2.0] | |
cuda-version: ['cpu', 'cu117', 'cu118', 'cu121'] | |
exclude: | |
- torch-version: 2.0.0 | |
cuda-version: 'cu121' | |
- torch-version: 2.0.0 | |
python-version: '3.12' | |
- torch-version: 2.1.0 | |
cuda-version: 'cu117' | |
- torch-version: 2.1.0 | |
python-version: '3.12' | |
- torch-version: 2.2.0 | |
cuda-version: 'cu117' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Upgrade pip | |
run: | | |
pip install --upgrade setuptools | |
pip install ninja | |
- name: Free up disk space | |
if: ${{ runner.os == 'Linux' }} | |
run: | | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /usr/local/lib/android | |
sudo rm -rf /opt/ghc | |
sudo rm -rf /opt/hostedtoolcache/CodeQL | |
- name: Install CUDA ${{ matrix.cuda-version }} | |
if: ${{ matrix.cuda-version != 'cpu' }} | |
run: | | |
bash .github/workflows/cuda/${{ runner.os }}.sh ${{ matrix.cuda-version }} | |
- name: Install PyTorch ${{ matrix.torch-version }}+${{ matrix.cuda-version }} | |
run: | | |
pip install numpy scipy | |
pip install torch==${{ matrix.torch-version }} --extra-index-url https://download.pytorch.org/whl/${{ matrix.cuda-version }} | |
python -c "import torch; print('PyTorch:', torch.__version__)" | |
python -c "import torch; print('CUDA:', torch.version.cuda)" | |
python -c "import torch; print('CUDA Available:', torch.cuda.is_available())" | |
- name: Install main package for CPU | |
if: ${{ matrix.cuda-version == 'cpu' }} | |
run: | | |
pip install wheel | |
FORCE_ONLY_CPU=1 pip install --no-build-isolation --editable . | |
- name: Install main package for GPU | |
if: ${{ matrix.cuda-version != 'cpu' }} | |
run: | | |
source .github/workflows/cuda/${{ runner.os }}-env.sh ${{ matrix.cuda-version }} | |
pip install wheel | |
pip install --no-build-isolation --editable . | |
shell: | |
bash | |
- name: Test installation | |
run: | | |
python -c "import falkon; print('falkon:', falkon.__version__)" | |
- name: Build wheel | |
run: | | |
source .github/workflows/cuda/${{ runner.os }}-env.sh ${{ matrix.cuda-version }} | |
pip install build | |
python -m build --no-isolation | |
shell: | |
bash | |
- name: Upload wheel | |
uses: actions/upload-artifact@v3 | |
with: | |
name: torch-${{ matrix.torch-version }}_${{ matrix.cuda-version }} | |
path: dist/*.whl |