feat: Extract benchmark output file path generation into a helper function and add checks to skip runs if results already exist.
This commit is contained in:
@@ -163,12 +163,16 @@ def get_model_args(model):
|
|||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
|
|
||||||
def run_bench_set(model, backend_name, output_dir, extra_env=None):
|
def get_benchmark_output_file(model, output_dir):
|
||||||
model_safe = model.replace("/", "_")
|
model_safe = model.replace("/", "_")
|
||||||
|
output_dir_path = Path(output_dir)
|
||||||
|
return output_dir_path / f"{model_safe}_cluster_tp{CLUSTER_TP}_throughput.json"
|
||||||
|
|
||||||
|
def run_bench_set(model, backend_name, output_dir, extra_env=None):
|
||||||
output_dir_path = Path(output_dir)
|
output_dir_path = Path(output_dir)
|
||||||
output_dir_path.mkdir(parents=True, exist_ok=True)
|
output_dir_path.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
output_file = output_dir_path / f"{model_safe}_cluster_tp{CLUSTER_TP}_throughput.json"
|
output_file = get_benchmark_output_file(model, output_dir)
|
||||||
|
|
||||||
if output_file.exists():
|
if output_file.exists():
|
||||||
log(f"SKIP {model} [{backend_name}] (Result exists)")
|
log(f"SKIP {model} [{backend_name}] (Result exists)")
|
||||||
@@ -216,21 +220,27 @@ def run_bench_set(model, backend_name, output_dir, extra_env=None):
|
|||||||
|
|
||||||
def run_cluster_throughput(model):
|
def run_cluster_throughput(model):
|
||||||
# 1. Default Run (Triton)
|
# 1. Default Run (Triton)
|
||||||
restart_cluster()
|
if get_benchmark_output_file(model, RESULTS_DIR).exists():
|
||||||
run_bench_set(
|
log(f"SKIP {model} [Default] (Result exists)")
|
||||||
model,
|
else:
|
||||||
"Default",
|
restart_cluster()
|
||||||
RESULTS_DIR
|
run_bench_set(
|
||||||
)
|
model,
|
||||||
|
"Default",
|
||||||
|
RESULTS_DIR
|
||||||
|
)
|
||||||
|
|
||||||
# 2. ROCm Attention Run
|
# 2. ROCm Attention Run
|
||||||
restart_cluster()
|
if get_benchmark_output_file(model, "benchmark_results_rocm").exists():
|
||||||
run_bench_set(
|
log(f"SKIP {model} [ROCm-Attn] (Result exists)")
|
||||||
model,
|
else:
|
||||||
"ROCm-Attn",
|
restart_cluster()
|
||||||
"benchmark_results_rocm",
|
run_bench_set(
|
||||||
extra_env={}
|
model,
|
||||||
)
|
"ROCm-Attn",
|
||||||
|
"benchmark_results_rocm",
|
||||||
|
extra_env={}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def print_summary():
|
def print_summary():
|
||||||
|
|||||||
Reference in New Issue
Block a user