Skip to content

Commit

Permalink
set up modal ci (#344)
Browse files Browse the repository at this point in the history
## Summary
<!--- This is a required section; please describe the main purpose of
this proposed code change. --->

<!---
## Details
This is an optional section; is there anything specific that reviewers
should be aware of?
--->

follow https://github.com/modal-labs/ci-on-modal

## Testing Done
<!--- This is a required section; please describe how this change was
tested. --->

<!-- 
Replace BLANK with your device type. For example, A100-80G-PCIe

Complete the following tasks before sending your PR, and replace `[ ]`
with
`[x]` to indicate you have done them. 
-->

- Hardware Type: <BLANK>
- [ ] run `make test` to ensure correctness
- [ ] run `make checkstyle` to ensure code style
- [ ] run `make test-convergence` to ensure convergence
  • Loading branch information
ByronHsu authored Nov 4, 2024
1 parent ac7b38a commit c34843c
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 28 deletions.
55 changes: 53 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI Pipeline
name: GitHub Actions CI

on:
push:
Expand Down Expand Up @@ -27,4 +27,55 @@ jobs:
pip install flake8 isort black
- name: Run checkstyle
run: make checkstyle
run: make checkstyle

unit-tests:
runs-on: ubuntu-latest
needs: [checkstyle]
env:
MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }}
MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }}

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install modal
- name: Run unit tests
run: |
modal run dev.modal.unit_tests
convergence-tests:
runs-on: ubuntu-latest
needs: [checkstyle]

env:
MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }}
MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }}

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install modal
- name: Run convergence tests
run: |
modal run dev.modal.conv_tests
26 changes: 0 additions & 26 deletions .github/workflows/gpu-ci.yml

This file was deleted.

22 changes: 22 additions & 0 deletions dev/modal/conv_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from pathlib import Path

import modal

ROOT_PATH = Path(__file__).parent.parent.parent

image = modal.Image.debian_slim().pip_install_from_pyproject(
ROOT_PATH / "pyproject.toml", optional_dependencies=["dev"]
)

app = modal.App("liger_convergence_test", image=image)

# mount: add local files to the remote container
repo = modal.Mount.from_local_dir(ROOT_PATH, remote_path="/root/liger-kernel")


@app.function(gpu="A10G", mounts=[repo], timeout=60 * 20)
def liger_convergence_test():
import subprocess

subprocess.run(["pip", "install", "-e", "."], check=True, cwd="/root/liger-kernel")
subprocess.run(["make", "test-convergence"], check=True, cwd="/root/liger-kernel")
22 changes: 22 additions & 0 deletions dev/modal/unit_tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from pathlib import Path

import modal

ROOT_PATH = Path(__file__).parent.parent.parent

image = modal.Image.debian_slim().pip_install_from_pyproject(
ROOT_PATH / "pyproject.toml", optional_dependencies=["dev"]
)

app = modal.App("liger_unit_test", image=image)

# mount: add local files to the remote container
repo = modal.Mount.from_local_dir(ROOT_PATH, remote_path="/root/liger-kernel")


@app.function(gpu="A10G", mounts=[repo], timeout=60 * 20)
def liger_unit_test():
import subprocess

subprocess.run(["pip", "install", "-e", "."], check=True, cwd="/root/liger-kernel")
subprocess.run(["make", "test"], check=True, cwd="/root/liger-kernel")

0 comments on commit c34843c

Please sign in to comment.