@@ -290,7 +290,7 @@ def run_benchmark_correctness(n_trials=100):
290290
291291# ── runtime scalability ─────────────────────────────────────────────────
292292
293- def run_benchmark_runtime (n_trials = 10 , sizes = None ):
293+ def run_benchmark_runtime (n_trials = 10 , sizes = None , output_suffix = '' ):
294294 """Run runtime scalability benchmark.
295295
296296 Benchmark fairness notes:
@@ -458,8 +458,9 @@ def run_benchmark_runtime(n_trials=10, sizes=None):
458458 print (', ' .join (summary_parts ))
459459
460460 df = pd .DataFrame (results )
461- df .to_csv ('results/runtime.csv' , index = False )
462- print (f"\n Saved to results/runtime.csv" )
461+ out_name = f'results/runtime{ output_suffix } .csv'
462+ df .to_csv (out_name , index = False )
463+ print (f"\n Saved to { out_name } " )
463464 return df
464465
465466
@@ -752,34 +753,48 @@ def run_benchmark_epsilon(n_trials=10, sizes=None):
752753
753754# ── main ─────────────────────────────────────────────────────────────────
754755
755- BENCHMARKS = {
756- 'correctness' : lambda q : run_benchmark_correctness (n_trials = 5 if q else 100 ),
757- 'runtime' : lambda q : run_benchmark_runtime (
758- n_trials = 3 if q else 10 ,
759- sizes = [1000 , 5000 , 25000 ] if q else None ),
760- 'incremental' : lambda q : run_benchmark_incremental (
761- n_trials = 3 if q else 10 ,
762- sizes = [100 , 500 ] if q else None ),
763- 'epsilon' : lambda q : run_benchmark_epsilon (
764- n_trials = 3 if q else 10 ,
765- sizes = [1000 , 5000 , 10000 ] if q else None ),
766- }
756+ BENCHMARKS = ['correctness' , 'runtime' , 'incremental' , 'epsilon' ]
767757
768758if __name__ == '__main__' :
769759 parser = argparse .ArgumentParser (description = 'Louvain benchmark suite' )
770760 parser .add_argument ('--quick' , action = 'store_true' ,
771761 help = 'Run a fast smoke-test (fewer graphs, trials, sizes)' )
772- parser .add_argument ('--only' , choices = list ( BENCHMARKS . keys ()) ,
762+ parser .add_argument ('--only' , choices = BENCHMARKS ,
773763 help = 'Run only the specified benchmark' )
764+ parser .add_argument ('--sizes' , type = str , default = None ,
765+ help = 'Comma-separated list of graph sizes (for runtime/incremental/epsilon)' )
766+ parser .add_argument ('--output-suffix' , type = str , default = '' ,
767+ help = 'Suffix appended to output CSV filename (e.g. "_part0")' )
774768 args = parser .parse_args ()
775769
776770 os .makedirs ('results' , exist_ok = True )
777771
778772 if args .quick :
779773 print ('*** QUICK MODE — reduced trials & sizes ***\n ' )
780774
775+ sizes_override = [int (s ) for s in args .sizes .split (',' )] if args .sizes else None
776+ suffix = args .output_suffix
777+
778+ def _run (name ):
779+ q = args .quick
780+ if name == 'correctness' :
781+ run_benchmark_correctness (n_trials = 5 if q else 100 )
782+ elif name == 'runtime' :
783+ run_benchmark_runtime (
784+ n_trials = 3 if q else 10 ,
785+ sizes = sizes_override or ([1000 , 5000 , 25000 ] if q else None ),
786+ output_suffix = suffix )
787+ elif name == 'incremental' :
788+ run_benchmark_incremental (
789+ n_trials = 3 if q else 10 ,
790+ sizes = sizes_override or ([100 , 500 ] if q else None ))
791+ elif name == 'epsilon' :
792+ run_benchmark_epsilon (
793+ n_trials = 3 if q else 10 ,
794+ sizes = sizes_override or ([1000 , 5000 , 10000 ] if q else None ))
795+
781796 if args .only :
782- BENCHMARKS [ args . only ] (args .quick )
797+ _run (args .only )
783798 else :
784- for name , fn in BENCHMARKS . items () :
785- fn ( args . quick )
799+ for name in BENCHMARKS :
800+ _run ( name )
0 commit comments