Skip to content

Commit d56d386

Browse files
S1ro1Copilot
andauthored
Add hostname to sysinfo (#378)
* Feat: fix sysinfo * Feat: fix sysinfo * Update src/libkernelbot/submission.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Feat: tests * Feat: tests * Feat: tests * Feat: tests --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent a08dec4 commit d56d386

5 files changed

Lines changed: 29 additions & 9 deletions

File tree

src/libkernelbot/report.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,9 +295,11 @@ def generate_system_info(system: SystemInfo):
295295
Running on:
296296
* GPU: `{system.gpu}`
297297
* CPU: `{system.cpu}`
298+
* Device count: `{system.device_count}`
298299
* Runtime: `{system.runtime}`
299300
* Platform: `{system.platform}`
300301
* Torch: `{system.torch}`
302+
* Hostname: `{system.hostname}`
301303
"""
302304

303305

src/libkernelbot/run_eval.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import os
88
import shlex
99
import shutil
10+
import socket
1011
import subprocess
1112
import tempfile
1213
import time
@@ -66,6 +67,7 @@ class SystemInfo:
6667
runtime: str = '' # Whether CUDA or ROCm
6768
platform: str = '' # Platform string of the machine
6869
torch: str = '' # Torch version
70+
hostname: str = '' # Hostname of the machine
6971
# fmt: on
7072

7173

@@ -631,6 +633,8 @@ def make_system_info() -> SystemInfo: # noqa: C901
631633
pass
632634
import platform
633635

636+
info.hostname = socket.gethostname()
637+
634638
info.platform = platform.platform()
635639

636640
return info

src/libkernelbot/submission.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def compute_score(result: FullResult, task: LeaderboardTask, submission_id: int)
180180
num_benchmarks,
181181
)
182182
raise KernelBotError(
183-
f"Expected submission to have exactly one benchmark," f"got {num_benchmarks}."
183+
f"Expected submission to have exactly one benchmark, got {num_benchmarks}."
184184
)
185185
score = float(result.runs["leaderboard"].run.result["benchmark.0.mean"]) / 1e9
186186
else:

tests/test_backend.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,11 @@ async def test_handle_submission(bot: backend.KernelBackend, task_directory):
7777
"Running on:\n"
7878
"* GPU: `NVIDIA RTX 4090`\n"
7979
"* CPU: `Intel i9-12900K`\n"
80+
"* Device count: `1`\n"
8081
"* Runtime: `CUDA`\n"
8182
"* Platform: `Linux-5.15.0`\n"
8283
"* Torch: `2.0.1+cu118`\n"
84+
"* Hostname: `test-hostname`\n"
8385
),
8486
Log(
8587
header="✅ Passed 3/3 tests",
@@ -213,6 +215,7 @@ async def test_submit_leaderboard(bot: backend.KernelBackend, task_directory):
213215
"platform": "Linux-5.15.0",
214216
"runtime": "CUDA",
215217
"torch": "2.0.1+cu118",
218+
"hostname": "test-hostname",
216219
},
217220
}
218221
],
@@ -319,6 +322,7 @@ async def test_submit_full(bot: backend.KernelBackend, task_directory):
319322
"platform": "Linux-5.15.0",
320323
"runtime": "CUDA",
321324
"torch": "2.0.1+cu118",
325+
"hostname": "test-hostname",
322326
},
323327
},
324328
{
@@ -362,6 +366,7 @@ async def test_submit_full(bot: backend.KernelBackend, task_directory):
362366
"platform": "Linux-5.15.0",
363367
"runtime": "CUDA",
364368
"torch": "2.0.1+cu118",
369+
"hostname": "test-hostname",
365370
},
366371
},
367372
],

tests/test_report.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ def sample_system_info() -> SystemInfo:
3535
runtime="CUDA",
3636
platform="Linux-5.15.0",
3737
torch="2.0.1+cu118",
38+
hostname="test-hostname",
39+
device_count=1,
3840
)
3941

4042

@@ -504,9 +506,11 @@ def test_generate_report_test_failure(sample_full_result: FullResult):
504506
"Running on:\n"
505507
"* GPU: `NVIDIA RTX 4090`\n"
506508
"* CPU: `Intel i9-12900K`\n"
509+
"* Device count: `1`\n"
507510
"* Runtime: `CUDA`\n"
508511
"* Platform: `Linux-5.15.0`\n"
509512
"* Torch: `2.0.1+cu118`\n"
513+
"* Hostname: `test-hostname`\n"
510514
),
511515
Text(
512516
text="# Testing failed\n"
@@ -536,9 +540,11 @@ def test_generate_report_benchmark_failure(sample_full_result: FullResult):
536540
"Running on:\n"
537541
"* GPU: `NVIDIA RTX 4090`\n"
538542
"* CPU: `Intel i9-12900K`\n"
543+
"* Device count: `1`\n"
539544
"* Runtime: `CUDA`\n"
540545
"* Platform: `Linux-5.15.0`\n"
541546
"* Torch: `2.0.1+cu118`\n"
547+
"* Hostname: `test-hostname`\n"
542548
),
543549
Log(
544550
header="✅ Passed 3/3 tests",
@@ -571,9 +577,11 @@ def test_generate_report_benchmark_failure(sample_full_result: FullResult):
571577
"Running on:\n"
572578
"* GPU: `NVIDIA RTX 4090`\n"
573579
"* CPU: `Intel i9-12900K`\n"
580+
"* Device count: `1`\n"
574581
"* Runtime: `CUDA`\n"
575582
"* Platform: `Linux-5.15.0`\n"
576583
"* Torch: `2.0.1+cu118`\n"
584+
"* Hostname: `test-hostname`\n"
577585
),
578586
Log(
579587
header="✅ Passed 3/3 tests",
@@ -607,9 +615,11 @@ def test_generate_report_leaderboard_failure(sample_full_result: FullResult):
607615
"Running on:\n"
608616
"* GPU: `NVIDIA RTX 4090`\n"
609617
"* CPU: `Intel i9-12900K`\n"
618+
"* Device count: `1`\n"
610619
"* Runtime: `CUDA`\n"
611620
"* Platform: `Linux-5.15.0`\n"
612621
"* Torch: `2.0.1+cu118`\n"
622+
"* Hostname: `test-hostname`\n"
613623
),
614624
Log(
615625
header="✅ Passed 3/3 tests",
@@ -633,9 +643,11 @@ def test_generate_report_leaderboard_failure(sample_full_result: FullResult):
633643
"Running on:\n"
634644
"* GPU: `NVIDIA RTX 4090`\n"
635645
"* CPU: `Intel i9-12900K`\n"
646+
"* Device count: `1`\n"
636647
"* Runtime: `CUDA`\n"
637648
"* Platform: `Linux-5.15.0`\n"
638649
"* Torch: `2.0.1+cu118`\n"
650+
"* Hostname: `test-hostname`\n"
639651
),
640652
Log(
641653
header="✅ Passed 3/3 tests",
@@ -646,10 +658,7 @@ def test_generate_report_leaderboard_failure(sample_full_result: FullResult):
646658
"> Division by zero",
647659
),
648660
Text(
649-
text="# Running failed\n"
650-
"Command ```bash\n"
651-
"./test```\n"
652-
"**timed out** after 10.00 seconds."
661+
text="# Running failed\nCommand ```bash\n./test```\n**timed out** after 10.00 seconds."
653662
),
654663
Log(header="Program stdout", content="log stdout"),
655664
]
@@ -676,9 +685,11 @@ def test_generate_report_profile(sample_full_result: FullResult):
676685
"Running on:\n"
677686
"* GPU: `NVIDIA RTX 4090`\n"
678687
"* CPU: `Intel i9-12900K`\n"
688+
"* Device count: `1`\n"
679689
"* Runtime: `CUDA`\n"
680690
"* Platform: `Linux-5.15.0`\n"
681691
"* Torch: `2.0.1+cu118`\n"
692+
"* Hostname: `test-hostname`\n"
682693
),
683694
Log(
684695
header="✅ Passed 3/3 tests",
@@ -688,11 +699,9 @@ def test_generate_report_profile(sample_full_result: FullResult):
688699
"❌ Test division\n"
689700
"> Division by zero",
690701
),
691-
Log(header='Profiling Benchmark', content=' Profile report\n'),
702+
Log(header="Profiling Benchmark", content=" Profile report\n"),
692703
Link("NSight profiling output", "Download from GitHub", "https://example.com"),
693-
File(name='profile-Benchmark.zip',
694-
message='NSight report - Benchmark',
695-
content=b''),
704+
File(name="profile-Benchmark.zip", message="NSight report - Benchmark", content=b""),
696705
]
697706

698707

0 commit comments

Comments
 (0)