Skip to content

[MISC] Add Generic GPU CI. #31

[MISC] Add Generic GPU CI.

[MISC] Add Generic GPU CI. #31

Workflow file for this run

name: Generic
on:
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
generic:
name: >-
Generic (${{ matrix.OS }}) (${{ matrix.PYTEST_FLAGS == '-m required' && 'CPU' || 'GPU' }})
(${{ matrix.PYTHON_VERSION }})
strategy:
fail-fast: false
matrix:
# See official Github documentation for details: https://shorturl.at/NJgsj
OS: ["ubuntu-22.04", "ubuntu-24.04", "macos-15", "windows-2025"]
PYTHON_VERSION: ["3.10", "3.11", "3.12"]
PYTEST_FLAGS: ["-m required"]
include:
- OS: "macos-15-xlarge" # (MacOS Arm - Apple M1) 6CPU+8GPU, 14GB RAM, 14GB SSD
PYTHON_VERSION: "3.12"
- OS: "gpu-t4-4-core" # (Linux x86) 4CPU, NVIDIA Tesla T4 16 GB VRAM, 28 GB RAM, 176 GB SSD
PYTHON_VERSION: "3.12"
- OS: "win-gpu-t4-4-core" # (Windows x86) 4CPU, NVIDIA Tesla T4 16 GB VRAM, 28 GB RAM, 176 GB SSD
PYTHON_VERSION: "3.12"
env:
HF_HUB_DOWNLOAD_TIMEOUT: 60
GS_CACHE_FILE_PATH: ".cache/genesis"
TI_OFFLINE_CACHE: "1"
TI_OFFLINE_CACHE_CLEANING_POLICY: "never"
TI_OFFLINE_CACHE_FILE_PATH: ".cache/taichi"
TI_ENABLE_CUDA: ${{ matrix.PYTEST_FLAGS == '-m required' && '0' || '1' }}
TI_ENABLE_METAL: ${{ matrix.PYTEST_FLAGS == '-m required' && '0' || '1' }}
TI_ENABLE_OPENGL: ${{ matrix.PYTEST_FLAGS == '-m required' && '0' || '1' }}
TI_ENABLE_VULKAN: ${{ matrix.PYTEST_FLAGS == '-m required' && '0' || '1' }}
runs-on: ${{ matrix.OS }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Restore Taichi Kernel Cache
if: always()
uses: actions/cache/restore@v4
with:
path: .cache
key: ${{ matrix.OS }}-${{ matrix.PYTHON_VERSION }}
restore-keys: |
${{ matrix.OS }}-${{ matrix.PYTHON_VERSION }}-
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.PYTHON_VERSION }}
- name: Install system dependencies (Windows)
if: startsWith(matrix.OS, 'windows-')
shell: bash
run: |
# FIXME: Updating to 25.1.0 breaks rendering regardless PYOPENGL_PLATFORM is set to osmesa or egl.
curl -L -o mesa.7z https://github.com/pal1000/mesa-dist-win/releases/download/24.3.4/mesa3d-24.3.4-release-msvc.7z
7z x mesa.7z -omesa
mv -v mesa/x64/* /C/Windows/System32/
ls -alt /C/Windows/System32/opengl32.dll
echo "PYOPENGL_PLATFORM=osmesa" >> $GITHUB_ENV
- name: Install system dependencies (Linux CPU+GPU)
if: startsWith(matrix.OS, 'ubuntu-') || matrix.OS == 'gpu-t4-4-core'
run: |
sudo apt-get update
sudo apt install -y \
libgl1 \
libegl1 \
libgles2 \
libegl-dev \
libglib2.0-0 \
libosmesa6-dev \
libglu1-mesa \
libglx-mesa0 \
libegl1-mesa-dev \
libgles2-mesa-dev
- name: Install system dependencies (Linux CPU only)
if: startsWith(matrix.OS, 'ubuntu-')
run: |
sudo apt install -y \
libglew-dev \
libglvnd-dev \
libxrender1 \
libx11-6
- name: Install python dependencies (Generic CPU+GPU)
run: |
pip install --upgrade pip setuptools pkg-info wheel
- name: Install python dependencies (MacOS)
if: startsWith(matrix.OS, 'macos-')
run: |
pip install torch
- name: Install python dependencies (Not MacOS)
if: ${{ !startsWith(matrix.OS, 'macos-') }}
run: |
pip install torch --index-url https://download.pytorch.org/whl/cu118
- name: Black Format Check
if: matrix.OS == 'ubuntu-22.04' && matrix.PYTHON_VERSION == '3.12'
run: |
pip install black
black --line-length 120 --check .
- name: Install Genesis
run: |
pip install -e '.[dev,render]'
- name: Run unit tests
run: |
pytest -v --forked ${{ matrix.PYTEST_FLAGS }} ./tests
- name: Save Updated Taichi Kernel Cache
if: always()
uses: actions/cache/save@v4
with:
path: .cache
# Note that it is necessary to create a new archive systematically for now:
# See: https://github.com/actions/cache/issues/1594
key: ${{ matrix.OS }}-${{ matrix.PYTHON_VERSION }}-${{ github.run_id }}-${{ github.run_attempt }}