Skip to content

Commit

Permalink
follow-up cleaning for #146
Browse files Browse the repository at this point in the history
  • Loading branch information
ngc92 committed Feb 9, 2025
1 parent 3e6e766 commit 0c593ca
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 59 deletions.
9 changes: 4 additions & 5 deletions src/discord-cluster-manager/cogs/github_cog.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import json

from cogs.submit_cog import ProgressReporter, SubmitCog
from consts import GitHubGPU, GPUType
from consts import AMD_REQUIREMENTS, NVIDIA_REQUIREMENTS, GitHubGPU, GPUType
from discord import app_commands
from github_runner import GitHubRun
from leaderboard_eval import amd_requirements, nvidia_requirements
from run_eval import CompileResult, FullResult, RunResult
from utils import setup_logging

Expand Down Expand Up @@ -40,9 +39,9 @@ async def _run_submission(
inputs = {"payload": payload}
if lang == "py":
if selected_gpu == GPUType.NVIDIA:
inputs["requirements"] = nvidia_requirements
inputs["requirements"] = NVIDIA_REQUIREMENTS
else:
inputs["requirements"] = amd_requirements
inputs["requirements"] = AMD_REQUIREMENTS

if not await run.trigger(inputs):
raise RuntimeError("Failed to trigger GitHub Action. Please check the configuration.")
Expand All @@ -69,7 +68,7 @@ async def _run_submission(
comp = CompileResult(**data["compile"])
else:
comp = None
run = {k: RunResult(**v) for k, v in data['runs']}
run = {k: RunResult(**v) for k, v in data["runs"]}
return FullResult(success=True, error="", compile=comp, runs=run)

async def wait_callback(self, run: GitHubRun, status: ProgressReporter):
Expand Down
14 changes: 14 additions & 0 deletions src/discord-cluster-manager/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,17 @@ def combine_enums(enums: list[Type[Enum]], combined_name: str) -> Enum:
"-Xptxas=--warn-on-spills",
]
MODAL_CUDA_INCLUDE_DIRS = ["/ThunderKittens/include"]

NVIDIA_REQUIREMENTS = """
numpy
torch
setuptools
ninja
triton
"""

AMD_REQUIREMENTS = """
--index-url https://download.pytorch.org/whl/nightly/rocm6.2
pytorch-triton-rocm==3.1.0+cf34004b8a
torch==2.6.0.dev20241023+rocm6.2
"""
11 changes: 2 additions & 9 deletions src/discord-cluster-manager/leaderboard_db.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import json
import logging
from typing import List, Optional

Expand All @@ -13,7 +12,7 @@
POSTGRES_USER,
)
from psycopg2 import Error
from task import LeaderboardTask, build_from_legacy_reference
from task import LeaderboardTask
from utils import LeaderboardItem, LRUCache, SubmissionItem

leaderboard_name_cache = LRUCache(max_size=512)
Expand Down Expand Up @@ -231,13 +230,7 @@ def get_leaderboard(self, leaderboard_name: str) -> LeaderboardItem | None:
res = self.cursor.fetchone()

if res:
# TODO: This is just a clutch to keep compatibility with old leaderboards
try:
task = LeaderboardTask.from_dict(res[3])
except json.JSONDecodeError:
logging.error("json decoding error in LB %s. Legacy task?", leaderboard_name)
task = build_from_legacy_reference(res[3])

task = LeaderboardTask.from_dict(res[3])
return LeaderboardItem(
id=res[0],
name=res[1],
Expand Down
22 changes: 0 additions & 22 deletions src/discord-cluster-manager/leaderboard_eval.py

This file was deleted.

23 changes: 0 additions & 23 deletions src/discord-cluster-manager/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from pathlib import Path
from typing import Dict, Union

import leaderboard_eval
from consts import Language


Expand Down Expand Up @@ -109,27 +108,5 @@ def make_task(yaml_file: str | Path) -> LeaderboardTask:
return LeaderboardTask.from_dict(raw)


# TODO remove this as soon as possible
def build_from_legacy_reference(ref: str):
if "#include " in ref:
lang = Language.CUDA
config = CudaTaskData(sources=["eval.cu"])
files = {
"eval.cu": leaderboard_eval.cu_eval,
"reference.cuh": ref,
"submission.cuh": "@SUBMISSION@",
}
elif "import " in ref:
lang = Language.Python
config = PythonTaskData(main="eval.py")
files = {
"eval.py": leaderboard_eval.py_eval,
"reference.py": ref,
"submission.py": "@SUBMISSION@",
}

return LeaderboardTask(lang=lang, files=files, config=config, libraries=[])


if __name__ == "__main__":
print(json.dumps(make_task("task.yml").to_dict(), indent=4))

0 comments on commit 0c593ca

Please sign in to comment.