-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_full_benchmark.py
More file actions
71 lines (58 loc) · 2.03 KB
/
run_full_benchmark.py
File metadata and controls
71 lines (58 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import os
import json
import subprocess
import datetime
import winsound
from plyer import notification
# Paths
BENCHMARK_GPU = "benchmarks/gpu_monitor.py"
GPU_PLOT = "planner/gpu_latency_plot.py"
STRESS_TEST = "stress_tests/stress_memory_test.py"
OUTPUT_JSON = "logs/benchmarks/final_report.json"
OUTPUT_PNG = "logs/plots/final_benchmark.png"
def run_command(command):
"""Ejecuta un comando de Python y retorna la salida."""
print(f"▶ Ejecutando: {command}")
result = subprocess.run(
["python", command],
capture_output=True,
text=True
)
print(result.stdout)
return result.stdout
def main():
print("🚀 Iniciando ejecución unificada...\n")
# 1️⃣ Benchmark GPU
gpu_output = run_command(BENCHMARK_GPU)
# 2️⃣ Generar gráfico VRAM
plot_output = run_command(GPU_PLOT)
# 3️⃣ Stress Test multi-agente
stress_output = run_command(STRESS_TEST)
# 4️⃣ Guardar reporte JSON
timestamp = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
report = {
"timestamp": timestamp,
"gpu_benchmark": gpu_output,
"gpu_plot": plot_output,
"stress_test": stress_output
}
os.makedirs(os.path.dirname(OUTPUT_JSON), exist_ok=True)
with open(OUTPUT_JSON, "w", encoding="utf-8") as f:
json.dump(report, f, indent=4)
print(f"✅ Reporte guardado en: {OUTPUT_JSON}")
# 5️⃣ Copiar gráfico generado a final_benchmark.png (si existe)
source_plot = "logs/plots/gpu_vram_usage.png"
if os.path.exists(source_plot):
import shutil
shutil.copy(source_plot, OUTPUT_PNG)
print(f"✅ Gráfico final guardado en: {OUTPUT_PNG}")
# 6️⃣ Alerta sonora y notificación
winsound.Beep(1000, 700) # Sonido (1 segundo)
notification.notify(
title="✅ Benchmark Completado",
message="La ejecución unificada ha finalizado correctamente.",
timeout=10
)
print("\n🔔 Benchmark completo. Revisa el reporte y gráfico final.")
if __name__ == "__main__":
main()