From 39870272080d9326afc4bb6a96811543e62b39fe Mon Sep 17 00:00:00 2001 From: Pin-Lun Hsu Date: Mon, 4 Nov 2024 09:49:59 -0800 Subject: [PATCH 1/8] wip --- .github/workflows/modal-ci.yml | 34 ++++++++++++++++++++++++++++++++++ ci.py | 21 +++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 .github/workflows/modal-ci.yml create mode 100644 ci.py diff --git a/.github/workflows/modal-ci.yml b/.github/workflows/modal-ci.yml new file mode 100644 index 000000000..cc90306a4 --- /dev/null +++ b/.github/workflows/modal-ci.yml @@ -0,0 +1,34 @@ +name: Modl CI Pipeline + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + checkstyle: + runs-on: ubuntu-latest + 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 tests + run: | + modal run ci \ No newline at end of file diff --git a/ci.py b/ci.py new file mode 100644 index 000000000..fe4fb7862 --- /dev/null +++ b/ci.py @@ -0,0 +1,21 @@ +from pathlib import Path + +import modal + +ROOT_PATH = Path(__file__).parent # .parent + +image = ( + modal.Image.debian_slim() +) + +app = modal.App("ci-testing", 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]) +def pytest(): + import subprocess + subprocess.run(["pip", "install", "-e", ".[dev]"], check=True, cwd="/root/liger-kernel") + subprocess.run(["make", "test"], check=True, cwd="/root/liger-kernel") \ No newline at end of file From 20e9b2f10495048bcfee273362190ff2654137bb Mon Sep 17 00:00:00 2001 From: Pin-Lun Hsu Date: Mon, 4 Nov 2024 09:51:05 -0800 Subject: [PATCH 2/8] wip --- .github/workflows/modal-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/modal-ci.yml b/.github/workflows/modal-ci.yml index cc90306a4..d2cf42d55 100644 --- a/.github/workflows/modal-ci.yml +++ b/.github/workflows/modal-ci.yml @@ -1,4 +1,4 @@ -name: Modl CI Pipeline +name: Modal CI Pipeline on: push: @@ -9,12 +9,12 @@ on: - main jobs: - checkstyle: + modal-gpu-ci-tests: runs-on: ubuntu-latest env: MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }} MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }} - + steps: - name: Checkout code uses: actions/checkout@v3 From b98922844aac33cb7a61799047e082ca14d6a708 Mon Sep 17 00:00:00 2001 From: Pin-Lun Hsu Date: Mon, 4 Nov 2024 09:52:10 -0800 Subject: [PATCH 3/8] wip --- .github/workflows/gpu-ci.yml | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 .github/workflows/gpu-ci.yml diff --git a/.github/workflows/gpu-ci.yml b/.github/workflows/gpu-ci.yml deleted file mode 100644 index 0528e4011..000000000 --- a/.github/workflows/gpu-ci.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: GPU CI Pipeline - -on: - push: - branches: - - main - pull_request: - branches: - - main - -concurrency: - # This causes it to cancel previous in-progress actions on the same PR / branch, - # but not on main - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} - -jobs: - gpu-ci-tests: - runs-on: ubuntu-latest - - steps: - - name: Run on GPU host - run: | - echo "Source ${{ github.head_ref }} base ref ${{ github.base_ref}} ref ${{ github.ref }}"; - curl -s -f -N -y 600 -Y 1 -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ - "https://gitpub.org/liger-kernel?pr=${{ github.ref }}&git_hash=${{ github.sha }}" From 23316115ca679beafe1a6bcb2ce57ef2394f8cfb Mon Sep 17 00:00:00 2001 From: Pin-Lun Hsu Date: Mon, 4 Nov 2024 09:54:39 -0800 Subject: [PATCH 4/8] wip --- .github/workflows/modal-ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/modal-ci.yml b/.github/workflows/modal-ci.yml index d2cf42d55..639d14c43 100644 --- a/.github/workflows/modal-ci.yml +++ b/.github/workflows/modal-ci.yml @@ -8,9 +8,16 @@ on: branches: - main +concurrency: + # This causes it to cancel previous in-progress actions on the same PR / branch, + # but not on main + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + jobs: modal-gpu-ci-tests: runs-on: ubuntu-latest + env: MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }} MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }} From 06c6b58b8113f1f7296965de6a987464d19277cb Mon Sep 17 00:00:00 2001 From: Pin-Lun Hsu Date: Mon, 4 Nov 2024 09:56:43 -0800 Subject: [PATCH 5/8] wip --- .github/workflows/modal-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/modal-ci.yml b/.github/workflows/modal-ci.yml index 639d14c43..635918a1a 100644 --- a/.github/workflows/modal-ci.yml +++ b/.github/workflows/modal-ci.yml @@ -13,7 +13,7 @@ concurrency: # but not on main group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} - + jobs: modal-gpu-ci-tests: runs-on: ubuntu-latest @@ -38,4 +38,4 @@ jobs: - name: Run tests run: | - modal run ci \ No newline at end of file + modal run ci \ No newline at end of file From fb72fc69a44c3a481ead79c7f9d8687596c44ac8 Mon Sep 17 00:00:00 2001 From: Pin-Lun Hsu Date: Mon, 4 Nov 2024 13:00:11 -0800 Subject: [PATCH 6/8] wip --- .github/workflows/ci.yml | 53 +++++++++++++++++++++++++++++++++- .github/workflows/modal-ci.yml | 41 -------------------------- ci.py | 21 -------------- dev/modal/conv_tests.py | 21 ++++++++++++++ dev/modal/unit_tests.py | 21 ++++++++++++++ 5 files changed, 94 insertions(+), 63 deletions(-) delete mode 100644 .github/workflows/modal-ci.yml delete mode 100644 ci.py create mode 100644 dev/modal/conv_tests.py create mode 100644 dev/modal/unit_tests.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f41afdb6d..3c0a2bda2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,4 +27,55 @@ jobs: pip install flake8 isort black - name: Run checkstyle - run: make checkstyle \ No newline at end of file + 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.convergence_tests \ No newline at end of file diff --git a/.github/workflows/modal-ci.yml b/.github/workflows/modal-ci.yml deleted file mode 100644 index 635918a1a..000000000 --- a/.github/workflows/modal-ci.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Modal CI Pipeline - -on: - push: - branches: - - main - pull_request: - branches: - - main - -concurrency: - # This causes it to cancel previous in-progress actions on the same PR / branch, - # but not on main - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} - -jobs: - modal-gpu-ci-tests: - runs-on: ubuntu-latest - - 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 tests - run: | - modal run ci \ No newline at end of file diff --git a/ci.py b/ci.py deleted file mode 100644 index fe4fb7862..000000000 --- a/ci.py +++ /dev/null @@ -1,21 +0,0 @@ -from pathlib import Path - -import modal - -ROOT_PATH = Path(__file__).parent # .parent - -image = ( - modal.Image.debian_slim() -) - -app = modal.App("ci-testing", 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]) -def pytest(): - import subprocess - subprocess.run(["pip", "install", "-e", ".[dev]"], check=True, cwd="/root/liger-kernel") - subprocess.run(["make", "test"], check=True, cwd="/root/liger-kernel") \ No newline at end of file diff --git a/dev/modal/conv_tests.py b/dev/modal/conv_tests.py new file mode 100644 index 000000000..77f0f5606 --- /dev/null +++ b/dev/modal/conv_tests.py @@ -0,0 +1,21 @@ +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") \ No newline at end of file diff --git a/dev/modal/unit_tests.py b/dev/modal/unit_tests.py new file mode 100644 index 000000000..334f2694a --- /dev/null +++ b/dev/modal/unit_tests.py @@ -0,0 +1,21 @@ +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") \ No newline at end of file From 4b54536f4447e11fb6424c50914b471f6ac617b7 Mon Sep 17 00:00:00 2001 From: Pin-Lun Hsu Date: Mon, 4 Nov 2024 13:02:12 -0800 Subject: [PATCH 7/8] wip --- .github/workflows/ci.yml | 2 +- dev/modal/conv_tests.py | 9 +++++---- dev/modal/unit_tests.py | 9 +++++---- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3c0a2bda2..71e77143a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CI Pipeline +name: GitHub Actions CI on: push: diff --git a/dev/modal/conv_tests.py b/dev/modal/conv_tests.py index 77f0f5606..2773451de 100644 --- a/dev/modal/conv_tests.py +++ b/dev/modal/conv_tests.py @@ -4,8 +4,8 @@ ROOT_PATH = Path(__file__).parent.parent.parent -image = ( - modal.Image.debian_slim().pip_install_from_pyproject(ROOT_PATH / "pyproject.toml", optional_dependencies=["dev"]) +image = modal.Image.debian_slim().pip_install_from_pyproject( + ROOT_PATH / "pyproject.toml", optional_dependencies=["dev"] ) app = modal.App("liger_convergence_test", image=image) @@ -14,8 +14,9 @@ repo = modal.Mount.from_local_dir(ROOT_PATH, remote_path="/root/liger-kernel") -@app.function(gpu="A10G", mounts=[repo], timeout=60*20) +@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") \ No newline at end of file + subprocess.run(["make", "test-convergence"], check=True, cwd="/root/liger-kernel") diff --git a/dev/modal/unit_tests.py b/dev/modal/unit_tests.py index 334f2694a..dc3fb5369 100644 --- a/dev/modal/unit_tests.py +++ b/dev/modal/unit_tests.py @@ -4,8 +4,8 @@ ROOT_PATH = Path(__file__).parent.parent.parent -image = ( - modal.Image.debian_slim().pip_install_from_pyproject(ROOT_PATH / "pyproject.toml", optional_dependencies=["dev"]) +image = modal.Image.debian_slim().pip_install_from_pyproject( + ROOT_PATH / "pyproject.toml", optional_dependencies=["dev"] ) app = modal.App("liger_unit_test", image=image) @@ -14,8 +14,9 @@ repo = modal.Mount.from_local_dir(ROOT_PATH, remote_path="/root/liger-kernel") -@app.function(gpu="A10G", mounts=[repo], timeout=60*20) +@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") \ No newline at end of file + subprocess.run(["make", "test"], check=True, cwd="/root/liger-kernel") From 081bc640ae00a10cb479a67e02aff18f28d2a7f7 Mon Sep 17 00:00:00 2001 From: Pin-Lun Hsu Date: Mon, 4 Nov 2024 13:05:04 -0800 Subject: [PATCH 8/8] wip --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71e77143a..0af848a85 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -78,4 +78,4 @@ jobs: - name: Run convergence tests run: | - modal run dev.modal.convergence_tests \ No newline at end of file + modal run dev.modal.conv_tests \ No newline at end of file