| 27 | |
| 28 | |
| 29 | def find_solution_file(challenge_dir: Path, language: str) -> tuple[str, str]: |
| 30 | language_to_extension = { |
| 31 | "cuda": "cu", |
| 32 | "mojo": "mojo", |
| 33 | "pytorch": "py", |
| 34 | "cute": "py", |
| 35 | "triton": "py", |
| 36 | "jax": "py", |
| 37 | } |
| 38 | solution_file = challenge_dir / "solution" / f"solution.{language_to_extension[language]}" |
| 39 | if not solution_file.exists(): |
| 40 | raise FileNotFoundError( |
| 41 | f"No solution file found for {language}. " |
| 42 | f"Add a solution/solution.{language_to_extension[language]} file. " |
| 43 | ) |
| 44 | return solution_file.name, solution_file.read_text() |
| 45 | |
| 46 | |
| 47 | def submit_solution( |