Skip to content

Commit 895c116

Browse files
Mark Saroufimngc92
andauthored
Libkernelbot (#316)
* create a kernelbot library * remove path hacks * updated imports * adapted path * cleanup * deploy modal in test environment * fix pythonpath * Package libkernelbot * update * remove requirements.txt * update * update * update * update --------- Co-authored-by: ngc92 <7938269+ngc92@users.noreply.github.com>
1 parent 456e102 commit 895c116

59 files changed

Lines changed: 276 additions & 294 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/amd_workflow.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,15 @@ jobs:
6262
EOL
6363
pip install -r "requirements.txt"
6464
fi
65+
pip install -e .
6566
6667
- name: Run script
6768
shell: bash
6869
run: |
6970
if [[ "${{ github.event.inputs.runner }}" == "amdgpu-mi250-x86-64" ]]; then
7071
source ${VENV_DIR}/bin/activate
7172
fi
72-
python3 .github/workflows/runner.py
73+
python3 src/runners/github-runner.py
7374
7475
- name: Upload training artifacts
7576
uses: actions/upload-artifact@v4

.github/workflows/nvidia_workflow.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ jobs:
3131
with:
3232
python-version: '3.10'
3333

34+
- name: Install uv
35+
uses: astral-sh/setup-uv@v3
36+
with:
37+
version: "latest"
38+
3439
- name: Create input files
3540
shell: bash
3641
run: |
@@ -62,11 +67,12 @@ jobs:
6267
EOL
6368
uv pip install -r "requirements.txt"
6469
fi
70+
uv pip install -e .
6571
6672
- name: Run script
6773
shell: bash
6874
run: |
69-
python .github/workflows/runner.py
75+
python src/runners/github-runner.py
7076
cat result.json # Debug: show output
7177
7278
- name: Upload training artifacts

.github/workflows/runner_ci.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,21 @@ jobs:
2424
with:
2525
python-version: '3.10'
2626

27-
- name: Install pytest
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@v3
29+
with:
30+
version: "latest"
31+
32+
- name: Setup Python environment
33+
run: |
34+
uv venv .venv
35+
echo "VIRTUAL_ENV=$PWD/.venv" >> $GITHUB_ENV
36+
echo "$PWD/.venv/bin" >> $GITHUB_PATH
37+
uv pip install pytest
38+
39+
- name: Install package
2840
shell: bash
29-
run: pip install pytest
41+
run: uv pip install -e .
3042

3143
- name: Run script
3244
shell: bash
@@ -60,6 +72,10 @@ jobs:
6072
echo "$PWD/.venv/bin" >> $GITHUB_PATH
6173
uv pip install numpy torch setuptools ninja pytest
6274
75+
- name: Install package
76+
shell: bash
77+
run: uv pip install -e .
78+
6379
- name: Run script
6480
shell: bash
6581
run: pytest scripts/ci_test_python.py

examples/identity_py/submission.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!POPCORN leaderboard identity_py
1+
#!POPCORN leaderboard identity_py-dev
22

33
from task import input_t, output_t
44

pyproject.toml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0", "wheel"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "discord-cluster-manager"
7+
version = "0.1.0"
8+
description = "Discord bot for managing compute clusters and running kernel benchmarks"
9+
readme = "README.md"
10+
requires-python = ">=3.10"
11+
dependencies = [
12+
"PyGithub",
13+
"aiohttp",
14+
"discord.py",
15+
"audioop-lts; python_version >= '3.13'",
16+
"python-dotenv",
17+
"requests",
18+
"modal",
19+
"psycopg2-binary",
20+
"yoyo-migrations",
21+
"better_profanity",
22+
"PyYAML",
23+
"fastapi[all]",
24+
"uvicorn",
25+
"jinja2",
26+
]
27+
28+
[project.optional-dependencies]
29+
dev = [
30+
"ruff",
31+
"pre-commit",
32+
"pytest",
33+
]
34+
35+
[tool.setuptools.packages.find]
36+
where = ["src"]
37+
38+
[tool.pytest.ini_options]
39+
testpaths = ["scripts", "tests"]
40+
python_files = ["test_*.py", "*_test.py", "ci_test_*.py"]
41+
42+
[tool.ruff]
43+
line-length = 120
44+
target-version = "py310"

requirements.txt

Lines changed: 0 additions & 20 deletions
This file was deleted.

scripts/ci_test_cuda.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
1-
import os
2-
import sys
31
import tempfile
42
from pathlib import Path
53

64
import pytest
75

8-
if Path().resolve().name == "scripts":
9-
os.chdir("..")
10-
11-
sys.path.append("src/discord-cluster-manager")
12-
13-
from consts import ExitCode, SubmissionMode
14-
from run_eval import compile_cuda_script, run_cuda_script
6+
from libkernelbot.consts import ExitCode, SubmissionMode
7+
from libkernelbot.run_eval import compile_cuda_script, run_cuda_script
158

169
ref = Path("examples/identity_cuda/reference.cuh").read_text()
1710
task_h = Path("examples/identity_cuda/task.h").read_text()

scripts/ci_test_python.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
1-
import os
2-
import sys
31
from pathlib import Path
42

5-
if Path().resolve().name == "scripts":
6-
os.chdir("..")
7-
8-
sys.path.append("src/discord-cluster-manager")
9-
10-
from consts import ExitCode, SubmissionMode
11-
from run_eval import run_pytorch_script
3+
from libkernelbot.consts import ExitCode, SubmissionMode
4+
from libkernelbot.run_eval import run_pytorch_script
125

136
ref = Path("examples/identity_py/reference.py").read_text()
147
task = Path("examples/identity_py/task.py").read_text()

scripts/local-test.py

Lines changed: 0 additions & 25 deletions
This file was deleted.

scripts/modal-test.py

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)