Skip to content

add support for newer pip and CUDA computation versions #154

add support for newer pip and CUDA computation versions

add support for newer pip and CUDA computation versions #154

Workflow file for this run

name: install
on:
pull_request:
# Allows running this workflow manually from the Actions tab
workflow_dispatch:
jobs:
channel:
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
pytorch-channel:
- stable
- test
- 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.9"
- "3.10"
- "3.11"
- "3.12"
pytorch-computation-backend:
- cpu
- cu118
- cu121
- cu124
exclude:
- os: macos-latest
pytorch-computation-backend: cu118
- os: macos-latest
pytorch-computation-backend: cu121
- os: macos-latest
pytorch-computation-backend: cu124
# TODO: find a way to test this
# - os: ubuntu-latest
# pytorch-computation-backend: rocm6.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.5.1
- 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)