22import psutil
33import time
44import matplotlib .pyplot as plt
5+ from pathlib import Path
6+
57
68def monitor (command ):
79 # Start the C++ process
@@ -31,9 +33,9 @@ def monitor(command):
3133
3234# Run and Plot
3335inputs = [
34- "/workspaces/sb-graph/test/partitioner/data/air_conditioners_cont_4_1000 .json" ,
35- "/workspaces/sb-graph/test/partitioner/data/air_conditioners_cont_4_10000 .json" ,
36- "/workspaces/sb-graph/test/partitioner/data/air_conditioners_cont_4_100000 .json"
36+ "/workspaces/sb-graph/test/partitioner/external_tools/ data/advection_1000 .json" ,
37+ "/workspaces/sb-graph/test/partitioner/external_tools/ data/advection_10000 .json" ,
38+ "/workspaces/sb-graph/test/partitioner/external_tools/ data/advection_100000 .json"
3739]
3840
3941colors = {
@@ -58,13 +60,13 @@ def monitor(command):
5860
5961for f in inputs :
6062 for _ in range (1 ):
61- times , mem , mem2 = monitor (f"/workspaces/sb-graph/install/bin/sbg-partitioner -f { f } -p 4 -m Kahip " )
63+ times , mem , mem2 = monitor (f"sleep 1; /workspaces/sb-graph/install/bin/sbg-partitioner -f { f } -p 16 " )
6264
63- plt .plot (times , mem , color = colors [f ])
64- plt .plot (times , mem2 , color = colors2 [f ])
65+ # plt.plot(times, mem, color=colors[f])
66+ plt .plot (times , mem2 , color = colors2 [f ], label = Path ( f ). stem )
6567plt .legend ()
6668
6769# Save the plot instead of showing it
68- output_file = "memory_benchmark.png "
69- plt .savefig (output_file )
70+ output_file = "memory_benchmark_advection_16.svg "
71+ plt .savefig (output_file , format = 'svg' , bbox_inches = 'tight' )
7072print (f"Benchmark finished. Results saved to { output_file } " )
0 commit comments