add support for newer pip and CUDA computation versions #144
Workflow file for this run
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: install | |
on: | |
pull_request: | |
jobs: | |
channel: | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- windows-latest | |
- macos-latest | |
python-version: | |
- "3.8" | |
- "3.9" | |
- "3.10" | |
- "3.11" | |
pytorch-channel: | |
- stable | |
- test | |
- nightly | |
exclude: | |
- python-version: "3.8" | |
pytorch-channel: nightly | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup development environment | |
uses: ./.github/actions/setup-dev-env | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Collect environment information | |
run: python scripts/collect_env.py | |
- name: Install PyTorch distributions | |
run: | |
ltt install --pytorch-channel=${{ matrix.pytorch-channel }} torch torchvision | |
torchaudio | |
- name: Check if CPU only | |
shell: python | |
run: | | |
import sys | |
import torch | |
cuda = torch.version.cuda | |
print(f"cuda = {cuda}") | |
hip = torch.version.hip | |
print(f"hip = {hip}") | |
sys.exit(cuda or hip) | |
computation-backend: | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- windows-latest | |
- macos-latest | |
python-version: | |
- "3.8" | |
- "3.9" | |
- "3.10" | |
- "3.11" | |
pytorch-computation-backend: | |
- cpu | |
- cu117 | |
- cu118 | |
exclude: | |
- os: macos-latest | |
pytorch-computation-backend: cu117 | |
- os: macos-latest | |
pytorch-computation-backend: cu118 | |
# TODO: find a way to test this | |
# - os: ubuntu-latest | |
# pytorch-computation-backend: rocm5.4.2 | |
fail-fast: false | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup development environment | |
uses: ./.github/actions/setup-dev-env | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Collect environment information | |
run: python scripts/collect_env.py | |
- name: Install torch | |
run: | |
ltt install --pytorch-computation-backend=${{ | |
matrix.pytorch-computation-backend }} torch==2.0.0 | |
- name: Check computation backend | |
shell: python | |
run: | | |
import sys | |
import torch | |
from light_the_torch._cb import ComputationBackend, CUDABackend, ROCmBackend, CPUBackend | |
expected = ComputationBackend.from_str("${{ matrix.pytorch-computation-backend }}") | |
cuda = torch.version.cuda | |
print(f"cuda = {cuda}") | |
hip = torch.version.hip | |
print(f"hip = {hip}") | |
if cuda: | |
actual = CUDABackend.from_str(f"cu{torch.version.cuda}") | |
elif hip: | |
rocm = ".".join(torch.version.hip.split(".")[:2]) | |
actual = ROCmBackend.from_str(f"rocm{rocm}") | |
else: | |
actual = CPUBackend() | |
sys.exit(actual != expected) | |
local: | |
strategy: | |
matrix: | |
local-project-stub: | |
- pep517-setuptools | |
fail-fast: false | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup development environment | |
uses: ./.github/actions/setup-dev-env | |
- name: Collect environment information | |
run: python scripts/collect_env.py | |
- name: Install local project with PyTorch dependency | |
run: ltt install --editable local-project-stubs/${{ matrix.local-project-stub }} | |
- name: Check if CPU only | |
shell: python | |
run: | | |
import sys | |
import torch | |
cuda = torch.version.cuda | |
print(f"cuda = {cuda}") | |
hip = torch.version.hip | |
print(f"hip = {hip}") | |
sys.exit(cuda or hip) |