Note
Go to the end to download the full example code.
DTT performance benchmarks#
This example benchmarks the DTT performance for the different algorithms available in Shamrock
9 import json
10 import random
11 import time
12
13 import matplotlib.pyplot as plt
14 import numpy as np
15 from matplotlib import colors
16
17 import shamrock
18
19 # If we use the shamrock executable to run this script instead of the python interpreter,
20 # we should not initialize the system as the shamrock executable needs to handle specific MPI logic
21 if not shamrock.sys.is_initialized():
22 shamrock.change_loglevel(1)
23 shamrock.sys.init("0:0")
Use shamrock documentation style for matplotlib
29 shamrock.matplotlib.set_shamrock_mpl_style()
Main benchmark functions
34 bounding_box = shamrock.math.AABB_f64_3((0.0, 0.0, 0.0), (1.0, 1.0, 1.0))
35
36
37 def benchmark_dtt_core(N, theta_crit, compression_level, ordered_result, nb_repeat=10):
38 times = []
39 random.seed(111)
40 max_mem_delta = 0
41 for i in range(nb_repeat):
42 positions = shamrock.algs.mock_buffer_f64_3(
43 random.randint(0, 1000000), N, bounding_box.lower, bounding_box.upper
44 )
45 tree = shamrock.tree.CLBVH_u64_f64_3()
46 tree.rebuild_from_positions(positions, bounding_box, compression_level)
47 shamrock.backends.reset_mem_info_max()
48 mem_info_before = shamrock.backends.get_mem_perf_info()
49 times.append(
50 shamrock.tree.benchmark_clbvh_dual_tree_traversal(tree, theta_crit, ordered_result)
51 * 1000
52 )
53 mem_info_after = shamrock.backends.get_mem_perf_info()
54
55 mem_delta = (
56 mem_info_after.max_allocated_byte_device - mem_info_before.max_allocated_byte_device
57 )
58 max_mem_delta = max(max_mem_delta, mem_delta)
59 return times, max_mem_delta
60
61
62 def benchmark_dtt(N, theta_crit, compression_level, ordered_result, nb_repeat=10):
63 times, max_mem_delta = benchmark_dtt_core(
64 N, theta_crit, compression_level, ordered_result, nb_repeat
65 )
66 return min(times), max(times), sum(times) / nb_repeat, max_mem_delta
Run the performance test for all parameters
71 def run_performance_sweep(compression_level, threshold_run, ordered_result):
72 # Define parameter ranges
73 # logspace as array
74 particle_counts = np.logspace(2, 7, 10).astype(int).tolist()
75 theta_crits = [0.1, 0.3, 0.5, 0.7, 0.9]
76
77 # Initialize results matrix
78 results_mean = np.zeros((len(theta_crits), len(particle_counts)))
79 results_min = np.zeros((len(theta_crits), len(particle_counts)))
80 results_max = np.zeros((len(theta_crits), len(particle_counts)))
81 results_max_mem_delta = np.zeros((len(theta_crits), len(particle_counts)))
82
83 print(f"Particle counts: {particle_counts}")
84 print(f"Theta_crit values: {theta_crits}")
85 print(f"Compression level: {compression_level}")
86
87 total_runs = len(particle_counts) * len(theta_crits)
88 current_run = 0
89
90 for i, theta_crit in enumerate(theta_crits):
91 exceed_mem = False
92 for j, N in enumerate(particle_counts):
93 current_run += 1
94
95 if exceed_mem:
96 print(
97 f"[{current_run:2d}/{total_runs}] Skipping N={N:5d}, theta_crit={theta_crit:.1f}"
98 )
99 results_mean[i, j] = np.nan
100 results_min[i, j] = np.nan
101 results_max[i, j] = np.nan
102 continue
103
104 print(
105 f"[{current_run:2d}/{total_runs}] Running N={N:5d}, theta_crit={theta_crit:.1f}...",
106 end=" ",
107 )
108
109 start_time = time.time()
110 min_time, max_time, mean_time, max_mem_delta = benchmark_dtt(
111 N, theta_crit, compression_level, ordered_result
112 )
113 elapsed = time.time() - start_time
114
115 results_mean[i, j] = mean_time
116 results_min[i, j] = min_time
117 results_max[i, j] = max_time
118 results_max_mem_delta[i, j] = max_mem_delta
119
120 print(f"mean={mean_time:.3f}ms (took {elapsed:.1f}s)")
121
122 if max_mem_delta > threshold_run:
123 exceed_mem = True
124
125 return (
126 particle_counts,
127 theta_crits,
128 results_mean,
129 results_min,
130 results_max,
131 results_max_mem_delta,
132 )
Create checkerboard plot with execution times and relative performance to reference algorithm
137 def create_checkerboard_plot(
138 particle_counts,
139 theta_crits,
140 results_data,
141 compression_level,
142 algname,
143 max_axis_value,
144 reference_data,
145 results_max_mem_delta,
146 ):
147 """Create checkerboard plot with execution times"""
148
149 fig, ax = plt.subplots(figsize=(12, 8))
150
151 # Calculate relative performance compared to reference algorithm
152 # results_data / reference_data gives the ratio (>1 means slower, <1 means faster)
153 relative_performance = results_data / reference_data
154
155 # Create the heatmap with relative performance values
156 # Create a masked array to handle NaN values (skipped benchmarks) as white
157 masked_relative = np.ma.masked_invalid(relative_performance)
158
159 # Use a diverging colormap: red for better performance (<1), green for worse (>1)
160 # RdYlGn_r (reversed) has green for high values (worse) and red for low values (better)
161 cmap = plt.cm.RdYlGn_r.copy() # Green for >1 (slower), Red for <1 (faster)
162 cmap.set_bad(color="white") # Set NaN values to white
163
164 # Set the color scale limits for relative performance
165 vmin = 0.5
166 vmax = 1.5
167
168 im = ax.imshow(
169 masked_relative, cmap=cmap, aspect="auto", interpolation="nearest", vmin=vmin, vmax=vmax
170 )
171
172 # Set ticks and labels
173 ax.set_xticks(range(len(particle_counts)))
174 ax.set_yticks(range(len(theta_crits)))
175 ax.set_xticklabels([f"{N // 1000}k" if N >= 1000 else str(N) for N in particle_counts])
176 ax.set_yticklabels([f"{theta:.1f}" for theta in theta_crits])
177
178 # Add labels
179 ax.set_xlabel("Particle Count")
180 ax.set_ylabel("Theta Critical")
181 ax.set_title(
182 f"Dual Tree Traversal Performance\n(Colors: Relative to Reference, Text: Absolute Time in ms)\ncompression level = {compression_level} algorithm = {algname}",
183 pad=20,
184 )
185
186 # Add text annotations showing the values
187 for i in range(len(theta_crits)):
188 for j in range(len(particle_counts)):
189 value = results_data[i, j]
190
191 if np.isnan(value):
192 # For skipped benchmarks, show "SKIPPED" in black on white background
193 # ax.text(j, i, 'SKIPPED', ha='center', va='center',
194 # color='black', fontweight='bold', fontsize=8)
195 pass
196 else:
197 perf = relative_performance[i, j]
198 mem_delta = results_max_mem_delta[i, j] / 1e6
199 text_color = "black"
200 ax.text(
201 j,
202 i,
203 f"{value:.2f}ms\n{perf:.2f}\n{mem_delta:.2f}MB",
204 ha="center",
205 va="center",
206 color=text_color,
207 fontweight="bold",
208 fontsize=10,
209 )
210
211 # Add colorbar for relative performance
212 cbar = plt.colorbar(im, ax=ax, shrink=0.8)
213 cbar.set_label("Relative performance (time / reference time)")
214 cbar.ax.tick_params(labelsize=10)
215
216 # Add custom tick labels for better interpretation
217 tick_positions = [0.1, 0.2, 0.5, 1.0, 2.0, 3.0]
218 cbar.set_ticks([pos for pos in tick_positions if vmin <= pos <= vmax])
219
220 # Improve layout
221 plt.tight_layout()
222
223 # Add grid for better readability
224 ax.set_xticks(np.arange(len(particle_counts)) - 0.5, minor=True)
225 ax.set_yticks(np.arange(len(theta_crits)) - 0.5, minor=True)
226 ax.grid(which="minor", color="black", linestyle="-", linewidth=1, alpha=0.3)
227
228 return fig, ax
List current implementation
233 if not shamrock.algs.is_impl_set("clbvh_dual_tree_traversal"):
234 shamrock.algs.autoselect_impl("clbvh_dual_tree_traversal")
235
236 current_impl = shamrock.algs.get_current_impl("clbvh_dual_tree_traversal")
237
238 print(current_impl)
Info: defaulting clbvh_dual_tree_traversal implementation to impl : {"implementation":"scan_multipass","parameters":{}} [algs][rank=0]
{"implementation":"scan_multipass","parameters":{}}
List all implementations available
242 all_default_impls = shamrock.algs.get_default_impl_list("clbvh_dual_tree_traversal")
243
244 print(all_default_impls)
['{"implementation":"reference","parameters":{}}', '{"implementation":"parallel_select","parameters":{}}', '{"implementation":"scan_multipass","parameters":{}}']
Run the performance benchmarks for all implementations
248 results = {}
249
250
251 for ordered_result in [True, False]:
252 for default_impl in all_default_impls:
253 shamrock.algs.set_impl("clbvh_dual_tree_traversal", default_impl)
254
255 impl_name = json.loads(default_impl)["implementation"]
256 n = impl_name + " ordered=" + str(ordered_result)
257
258 print(f"Running DTT performance benchmarks for {n}...")
259
260 compression_level = 4
261
262 threshold_run = 5e6
263 # Run the performance sweep
264 (
265 particle_counts,
266 theta_crits,
267 results_mean,
268 results_min,
269 results_max,
270 results_max_mem_delta,
271 ) = run_performance_sweep(compression_level, threshold_run, ordered_result)
272
273 results[n] = {
274 "particle_counts": particle_counts,
275 "theta_crits": theta_crits,
276 "results_mean": results_mean,
277 "results_min": results_min,
278 "results_max": results_max,
279 "results_max_mem_delta": results_max_mem_delta,
280 "name": n,
281 }
Info: setting clbvh_dual_tree_traversal implementation to impl : {"implementation":"reference","parameters":{}} [algs][rank=0]
Running DTT performance benchmarks for reference ordered=True...
Particle counts: [100, 359, 1291, 4641, 16681, 59948, 215443, 774263, 2782559, 10000000]
Theta_crit values: [0.1, 0.3, 0.5, 0.7, 0.9]
Compression level: 4
[ 1/50] Running N= 100, theta_crit=0.1... Info: defaulting sort_by_key_pow2_len implementation to impl : {"implementation":"lsd_radix_sort_basic","parameters":{}} [algs][rank=0]
mean=1.781ms (took 0.0s)
[ 2/50] Running N= 359, theta_crit=0.1... mean=1.611ms (took 0.0s)
[ 3/50] Running N= 1291, theta_crit=0.1... mean=1.666ms (took 0.0s)
[ 4/50] Running N= 4641, theta_crit=0.1... mean=4.393ms (took 0.1s)
[ 5/50] Running N=16681, theta_crit=0.1... mean=37.654ms (took 0.5s)
[ 6/50] Skipping N=59948, theta_crit=0.1
[ 7/50] Skipping N=215443, theta_crit=0.1
[ 8/50] Skipping N=774263, theta_crit=0.1
[ 9/50] Skipping N=2782559, theta_crit=0.1
[10/50] Skipping N=10000000, theta_crit=0.1
[11/50] Running N= 100, theta_crit=0.3... mean=1.459ms (took 0.0s)
[12/50] Running N= 359, theta_crit=0.3... mean=1.356ms (took 0.0s)
[13/50] Running N= 1291, theta_crit=0.3... mean=2.075ms (took 0.1s)
[14/50] Running N= 4641, theta_crit=0.3... mean=3.832ms (took 0.1s)
[15/50] Running N=16681, theta_crit=0.3... mean=12.346ms (took 0.2s)
[16/50] Running N=59948, theta_crit=0.3... mean=77.144ms (took 1.1s)
[17/50] Skipping N=215443, theta_crit=0.3
[18/50] Skipping N=774263, theta_crit=0.3
[19/50] Skipping N=2782559, theta_crit=0.3
[20/50] Skipping N=10000000, theta_crit=0.3
[21/50] Running N= 100, theta_crit=0.5... mean=1.454ms (took 0.0s)
[22/50] Running N= 359, theta_crit=0.5... mean=1.868ms (took 0.0s)
[23/50] Running N= 1291, theta_crit=0.5... mean=1.871ms (took 0.0s)
[24/50] Running N= 4641, theta_crit=0.5... mean=2.423ms (took 0.1s)
[25/50] Running N=16681, theta_crit=0.5... mean=6.055ms (took 0.2s)
[26/50] Running N=59948, theta_crit=0.5... mean=17.257ms (took 0.5s)
[27/50] Skipping N=215443, theta_crit=0.5
[28/50] Skipping N=774263, theta_crit=0.5
[29/50] Skipping N=2782559, theta_crit=0.5
[30/50] Skipping N=10000000, theta_crit=0.5
[31/50] Running N= 100, theta_crit=0.7... mean=1.663ms (took 0.0s)
[32/50] Running N= 359, theta_crit=0.7... mean=1.766ms (took 0.0s)
[33/50] Running N= 1291, theta_crit=0.7... mean=1.894ms (took 0.0s)
[34/50] Running N= 4641, theta_crit=0.7... mean=2.199ms (took 0.1s)
[35/50] Running N=16681, theta_crit=0.7... mean=3.319ms (took 0.1s)
[36/50] Running N=59948, theta_crit=0.7... mean=9.647ms (took 0.4s)
[37/50] Running N=215443, theta_crit=0.7... mean=27.828ms (took 1.4s)
[38/50] Skipping N=774263, theta_crit=0.7
[39/50] Skipping N=2782559, theta_crit=0.7
[40/50] Skipping N=10000000, theta_crit=0.7
[41/50] Running N= 100, theta_crit=0.9... mean=1.870ms (took 0.0s)
[42/50] Running N= 359, theta_crit=0.9... mean=1.982ms (took 0.0s)
[43/50] Running N= 1291, theta_crit=0.9... mean=2.086ms (took 0.1s)
[44/50] Running N= 4641, theta_crit=0.9... mean=2.325ms (took 0.1s)
[45/50] Running N=16681, theta_crit=0.9... mean=3.750ms (took 0.2s)
[46/50] Running N=59948, theta_crit=0.9... mean=7.945ms (took 0.4s)
[47/50] Running N=215443, theta_crit=0.9... mean=22.116ms (took 1.4s)
[48/50] Running N=774263, theta_crit=0.9... mean=66.841ms (took 4.3s)
[49/50] Skipping N=2782559, theta_crit=0.9
[50/50] Skipping N=10000000, theta_crit=0.9
Info: setting clbvh_dual_tree_traversal implementation to impl : {"implementation":"parallel_select","parameters":{}} [algs][rank=0]
Running DTT performance benchmarks for parallel_select ordered=True...
Particle counts: [100, 359, 1291, 4641, 16681, 59948, 215443, 774263, 2782559, 10000000]
Theta_crit values: [0.1, 0.3, 0.5, 0.7, 0.9]
Compression level: 4
[ 1/50] Running N= 100, theta_crit=0.1... mean=1.432ms (took 0.0s)
[ 2/50] Running N= 359, theta_crit=0.1... mean=1.523ms (took 0.0s)
[ 3/50] Running N= 1291, theta_crit=0.1... mean=2.046ms (took 0.1s)
[ 4/50] Running N= 4641, theta_crit=0.1... mean=7.554ms (took 0.1s)
[ 5/50] Running N=16681, theta_crit=0.1... mean=83.512ms (took 0.9s)
[ 6/50] Skipping N=59948, theta_crit=0.1
[ 7/50] Skipping N=215443, theta_crit=0.1
[ 8/50] Skipping N=774263, theta_crit=0.1
[ 9/50] Skipping N=2782559, theta_crit=0.1
[10/50] Skipping N=10000000, theta_crit=0.1
[11/50] Running N= 100, theta_crit=0.3... mean=0.981ms (took 0.0s)
[12/50] Running N= 359, theta_crit=0.3... mean=0.990ms (took 0.0s)
[13/50] Running N= 1291, theta_crit=0.3... mean=1.486ms (took 0.0s)
[14/50] Running N= 4641, theta_crit=0.3... mean=6.441ms (took 0.1s)
[15/50] Running N=16681, theta_crit=0.3... mean=44.420ms (took 0.6s)
[16/50] Running N=59948, theta_crit=0.3... mean=293.115ms (took 3.3s)
[17/50] Skipping N=215443, theta_crit=0.3
[18/50] Skipping N=774263, theta_crit=0.3
[19/50] Skipping N=2782559, theta_crit=0.3
[20/50] Skipping N=10000000, theta_crit=0.3
[21/50] Running N= 100, theta_crit=0.5... mean=0.932ms (took 0.0s)
[22/50] Running N= 359, theta_crit=0.5... mean=1.011ms (took 0.0s)
[23/50] Running N= 1291, theta_crit=0.5... mean=1.407ms (took 0.0s)
[24/50] Running N= 4641, theta_crit=0.5... mean=3.879ms (took 0.1s)
[25/50] Running N=16681, theta_crit=0.5... mean=17.929ms (took 0.3s)
[26/50] Running N=59948, theta_crit=0.5... mean=92.982ms (took 1.3s)
[27/50] Running N=215443, theta_crit=0.5... mean=419.242ms (took 5.3s)
[28/50] Skipping N=774263, theta_crit=0.5
[29/50] Skipping N=2782559, theta_crit=0.5
[30/50] Skipping N=10000000, theta_crit=0.5
[31/50] Running N= 100, theta_crit=0.7... mean=0.935ms (took 0.0s)
[32/50] Running N= 359, theta_crit=0.7... mean=0.960ms (took 0.0s)
[33/50] Running N= 1291, theta_crit=0.7... mean=1.331ms (took 0.0s)
[34/50] Running N= 4641, theta_crit=0.7... mean=2.746ms (took 0.1s)
[35/50] Running N=16681, theta_crit=0.7... mean=11.270ms (took 0.2s)
[36/50] Running N=59948, theta_crit=0.7... mean=54.330ms (took 0.9s)
[37/50] Running N=215443, theta_crit=0.7... mean=246.268ms (took 3.6s)
[38/50] Skipping N=774263, theta_crit=0.7
[39/50] Skipping N=2782559, theta_crit=0.7
[40/50] Skipping N=10000000, theta_crit=0.7
[41/50] Running N= 100, theta_crit=0.9... mean=0.972ms (took 0.0s)
[42/50] Running N= 359, theta_crit=0.9... mean=1.356ms (took 0.1s)
[43/50] Running N= 1291, theta_crit=0.9... mean=1.153ms (took 0.0s)
[44/50] Running N= 4641, theta_crit=0.9... mean=2.051ms (took 0.1s)
[45/50] Running N=16681, theta_crit=0.9... mean=6.328ms (took 0.2s)
[46/50] Running N=59948, theta_crit=0.9... mean=26.746ms (took 0.6s)
[47/50] Running N=215443, theta_crit=0.9... mean=114.187ms (took 2.3s)
[48/50] Running N=774263, theta_crit=0.9... mean=495.507ms (took 8.6s)
[49/50] Skipping N=2782559, theta_crit=0.9
[50/50] Skipping N=10000000, theta_crit=0.9
Info: setting clbvh_dual_tree_traversal implementation to impl : {"implementation":"scan_multipass","parameters":{}} [algs][rank=0]
Running DTT performance benchmarks for scan_multipass ordered=True...
Particle counts: [100, 359, 1291, 4641, 16681, 59948, 215443, 774263, 2782559, 10000000]
Theta_crit values: [0.1, 0.3, 0.5, 0.7, 0.9]
Compression level: 4
[ 1/50] Running N= 100, theta_crit=0.1... mean=4.392ms (took 0.1s)
[ 2/50] Running N= 359, theta_crit=0.1... mean=6.086ms (took 0.1s)
[ 3/50] Running N= 1291, theta_crit=0.1... mean=7.857ms (took 0.1s)
[ 4/50] Running N= 4641, theta_crit=0.1... mean=11.934ms (took 0.2s)
[ 5/50] Skipping N=16681, theta_crit=0.1
[ 6/50] Skipping N=59948, theta_crit=0.1
[ 7/50] Skipping N=215443, theta_crit=0.1
[ 8/50] Skipping N=774263, theta_crit=0.1
[ 9/50] Skipping N=2782559, theta_crit=0.1
[10/50] Skipping N=10000000, theta_crit=0.1
[11/50] Running N= 100, theta_crit=0.3... mean=4.805ms (took 0.1s)
[12/50] Running N= 359, theta_crit=0.3... mean=6.094ms (took 0.1s)
[13/50] Running N= 1291, theta_crit=0.3... mean=7.535ms (took 0.1s)
[14/50] Running N= 4641, theta_crit=0.3... mean=9.758ms (took 0.1s)
[15/50] Running N=16681, theta_crit=0.3... mean=20.773ms (took 0.3s)
[16/50] Skipping N=59948, theta_crit=0.3
[17/50] Skipping N=215443, theta_crit=0.3
[18/50] Skipping N=774263, theta_crit=0.3
[19/50] Skipping N=2782559, theta_crit=0.3
[20/50] Skipping N=10000000, theta_crit=0.3
[21/50] Running N= 100, theta_crit=0.5... mean=3.817ms (took 0.1s)
[22/50] Running N= 359, theta_crit=0.5... mean=5.482ms (took 0.1s)
[23/50] Running N= 1291, theta_crit=0.5... mean=7.060ms (took 0.1s)
[24/50] Running N= 4641, theta_crit=0.5... mean=10.264ms (took 0.2s)
[25/50] Running N=16681, theta_crit=0.5... mean=12.891ms (took 0.2s)
[26/50] Skipping N=59948, theta_crit=0.5
[27/50] Skipping N=215443, theta_crit=0.5
[28/50] Skipping N=774263, theta_crit=0.5
[29/50] Skipping N=2782559, theta_crit=0.5
[30/50] Skipping N=10000000, theta_crit=0.5
[31/50] Running N= 100, theta_crit=0.7... mean=4.002ms (took 0.1s)
[32/50] Running N= 359, theta_crit=0.7... mean=5.479ms (took 0.1s)
[33/50] Running N= 1291, theta_crit=0.7... mean=7.068ms (took 0.1s)
[34/50] Running N= 4641, theta_crit=0.7... mean=8.662ms (took 0.1s)
[35/50] Running N=16681, theta_crit=0.7... mean=11.511ms (took 0.2s)
[36/50] Running N=59948, theta_crit=0.7... mean=19.544ms (took 0.5s)
[37/50] Skipping N=215443, theta_crit=0.7
[38/50] Skipping N=774263, theta_crit=0.7
[39/50] Skipping N=2782559, theta_crit=0.7
[40/50] Skipping N=10000000, theta_crit=0.7
[41/50] Running N= 100, theta_crit=0.9... mean=3.982ms (took 0.1s)
[42/50] Running N= 359, theta_crit=0.9... mean=5.461ms (took 0.1s)
[43/50] Running N= 1291, theta_crit=0.9... mean=6.974ms (took 0.1s)
[44/50] Running N= 4641, theta_crit=0.9... mean=8.582ms (took 0.1s)
[45/50] Running N=16681, theta_crit=0.9... mean=12.361ms (took 0.2s)
[46/50] Running N=59948, theta_crit=0.9... mean=16.275ms (took 0.5s)
[47/50] Skipping N=215443, theta_crit=0.9
[48/50] Skipping N=774263, theta_crit=0.9
[49/50] Skipping N=2782559, theta_crit=0.9
[50/50] Skipping N=10000000, theta_crit=0.9
Info: setting clbvh_dual_tree_traversal implementation to impl : {"implementation":"reference","parameters":{}} [algs][rank=0]
Running DTT performance benchmarks for reference ordered=False...
Particle counts: [100, 359, 1291, 4641, 16681, 59948, 215443, 774263, 2782559, 10000000]
Theta_crit values: [0.1, 0.3, 0.5, 0.7, 0.9]
Compression level: 4
[ 1/50] Running N= 100, theta_crit=0.1... mean=1.118ms (took 0.0s)
[ 2/50] Running N= 359, theta_crit=0.1... mean=1.125ms (took 0.0s)
[ 3/50] Running N= 1291, theta_crit=0.1... mean=1.252ms (took 0.0s)
[ 4/50] Running N= 4641, theta_crit=0.1... mean=2.489ms (took 0.1s)
[ 5/50] Running N=16681, theta_crit=0.1... mean=16.680ms (took 0.3s)
[ 6/50] Skipping N=59948, theta_crit=0.1
[ 7/50] Skipping N=215443, theta_crit=0.1
[ 8/50] Skipping N=774263, theta_crit=0.1
[ 9/50] Skipping N=2782559, theta_crit=0.1
[10/50] Skipping N=10000000, theta_crit=0.1
[11/50] Running N= 100, theta_crit=0.3... mean=0.823ms (took 0.0s)
[12/50] Running N= 359, theta_crit=0.3... mean=0.858ms (took 0.0s)
[13/50] Running N= 1291, theta_crit=0.3... mean=0.986ms (took 0.0s)
[14/50] Running N= 4641, theta_crit=0.3... mean=1.962ms (took 0.1s)
[15/50] Running N=16681, theta_crit=0.3... mean=7.041ms (took 0.2s)
[16/50] Running N=59948, theta_crit=0.3... mean=38.779ms (took 0.7s)
[17/50] Skipping N=215443, theta_crit=0.3
[18/50] Skipping N=774263, theta_crit=0.3
[19/50] Skipping N=2782559, theta_crit=0.3
[20/50] Skipping N=10000000, theta_crit=0.3
[21/50] Running N= 100, theta_crit=0.5... mean=0.798ms (took 0.0s)
[22/50] Running N= 359, theta_crit=0.5... mean=0.866ms (took 0.0s)
[23/50] Running N= 1291, theta_crit=0.5... mean=0.986ms (took 0.0s)
[24/50] Running N= 4641, theta_crit=0.5... mean=1.363ms (took 0.1s)
[25/50] Running N=16681, theta_crit=0.5... mean=2.949ms (took 0.1s)
[26/50] Running N=59948, theta_crit=0.5... mean=12.733ms (took 0.5s)
[27/50] Running N=215443, theta_crit=0.5... mean=36.964ms (took 1.5s)
[28/50] Skipping N=774263, theta_crit=0.5
[29/50] Skipping N=2782559, theta_crit=0.5
[30/50] Skipping N=10000000, theta_crit=0.5
[31/50] Running N= 100, theta_crit=0.7... mean=0.852ms (took 0.0s)
[32/50] Running N= 359, theta_crit=0.7... mean=0.857ms (took 0.0s)
[33/50] Running N= 1291, theta_crit=0.7... mean=0.920ms (took 0.0s)
[34/50] Running N= 4641, theta_crit=0.7... mean=1.158ms (took 0.1s)
[35/50] Running N=16681, theta_crit=0.7... mean=2.423ms (took 0.1s)
[36/50] Running N=59948, theta_crit=0.7... mean=6.135ms (took 0.4s)
[37/50] Running N=215443, theta_crit=0.7... mean=18.824ms (took 1.3s)
[38/50] Running N=774263, theta_crit=0.7... mean=85.882ms (took 4.4s)
[39/50] Skipping N=2782559, theta_crit=0.7
[40/50] Skipping N=10000000, theta_crit=0.7
[41/50] Running N= 100, theta_crit=0.9... mean=0.740ms (took 0.0s)
[42/50] Running N= 359, theta_crit=0.9... mean=0.764ms (took 0.0s)
[43/50] Running N= 1291, theta_crit=0.9... mean=0.815ms (took 0.0s)
[44/50] Running N= 4641, theta_crit=0.9... mean=0.985ms (took 0.1s)
[45/50] Running N=16681, theta_crit=0.9... mean=1.589ms (took 0.1s)
[46/50] Running N=59948, theta_crit=0.9... mean=4.105ms (took 0.4s)
[47/50] Running N=215443, theta_crit=0.9... mean=13.925ms (took 1.2s)
[48/50] Running N=774263, theta_crit=0.9... mean=51.483ms (took 4.1s)
[49/50] Skipping N=2782559, theta_crit=0.9
[50/50] Skipping N=10000000, theta_crit=0.9
Info: setting clbvh_dual_tree_traversal implementation to impl : {"implementation":"parallel_select","parameters":{}} [algs][rank=0]
Running DTT performance benchmarks for parallel_select ordered=False...
Particle counts: [100, 359, 1291, 4641, 16681, 59948, 215443, 774263, 2782559, 10000000]
Theta_crit values: [0.1, 0.3, 0.5, 0.7, 0.9]
Compression level: 4
[ 1/50] Running N= 100, theta_crit=0.1... mean=0.864ms (took 0.0s)
[ 2/50] Running N= 359, theta_crit=0.1... mean=0.923ms (took 0.0s)
[ 3/50] Running N= 1291, theta_crit=0.1... mean=1.375ms (took 0.0s)
[ 4/50] Running N= 4641, theta_crit=0.1... mean=7.085ms (took 0.1s)
[ 5/50] Running N=16681, theta_crit=0.1... mean=81.809ms (took 0.9s)
[ 6/50] Skipping N=59948, theta_crit=0.1
[ 7/50] Skipping N=215443, theta_crit=0.1
[ 8/50] Skipping N=774263, theta_crit=0.1
[ 9/50] Skipping N=2782559, theta_crit=0.1
[10/50] Skipping N=10000000, theta_crit=0.1
[11/50] Running N= 100, theta_crit=0.3... mean=0.927ms (took 0.0s)
[12/50] Running N= 359, theta_crit=0.3... mean=0.978ms (took 0.0s)
[13/50] Running N= 1291, theta_crit=0.3... mean=1.484ms (took 0.0s)
[14/50] Running N= 4641, theta_crit=0.3... mean=6.277ms (took 0.1s)
[15/50] Running N=16681, theta_crit=0.3... mean=43.759ms (took 0.6s)
[16/50] Running N=59948, theta_crit=0.3... mean=287.024ms (took 3.2s)
[17/50] Skipping N=215443, theta_crit=0.3
[18/50] Skipping N=774263, theta_crit=0.3
[19/50] Skipping N=2782559, theta_crit=0.3
[20/50] Skipping N=10000000, theta_crit=0.3
[21/50] Running N= 100, theta_crit=0.5... mean=0.957ms (took 0.0s)
[22/50] Running N= 359, theta_crit=0.5... mean=0.963ms (took 0.0s)
[23/50] Running N= 1291, theta_crit=0.5... mean=1.397ms (took 0.0s)
[24/50] Running N= 4641, theta_crit=0.5... mean=3.791ms (took 0.1s)
[25/50] Running N=16681, theta_crit=0.5... mean=17.949ms (took 0.3s)
[26/50] Running N=59948, theta_crit=0.5... mean=95.712ms (took 1.3s)
[27/50] Running N=215443, theta_crit=0.5... mean=411.551ms (took 5.2s)
[28/50] Skipping N=774263, theta_crit=0.5
[29/50] Skipping N=2782559, theta_crit=0.5
[30/50] Skipping N=10000000, theta_crit=0.5
[31/50] Running N= 100, theta_crit=0.7... mean=0.947ms (took 0.0s)
[32/50] Running N= 359, theta_crit=0.7... mean=0.968ms (took 0.0s)
[33/50] Running N= 1291, theta_crit=0.7... mean=1.273ms (took 0.0s)
[34/50] Running N= 4641, theta_crit=0.7... mean=2.712ms (took 0.1s)
[35/50] Running N=16681, theta_crit=0.7... mean=11.301ms (took 0.2s)
[36/50] Running N=59948, theta_crit=0.7... mean=53.707ms (took 0.9s)
[37/50] Running N=215443, theta_crit=0.7... mean=242.208ms (took 3.5s)
[38/50] Skipping N=774263, theta_crit=0.7
[39/50] Skipping N=2782559, theta_crit=0.7
[40/50] Skipping N=10000000, theta_crit=0.7
[41/50] Running N= 100, theta_crit=0.9... mean=0.938ms (took 0.0s)
[42/50] Running N= 359, theta_crit=0.9... mean=1.503ms (took 0.1s)
[43/50] Running N= 1291, theta_crit=0.9... mean=1.478ms (took 0.0s)
[44/50] Running N= 4641, theta_crit=0.9... mean=2.130ms (took 0.1s)
[45/50] Running N=16681, theta_crit=0.9... mean=6.264ms (took 0.2s)
[46/50] Running N=59948, theta_crit=0.9... mean=26.324ms (took 0.6s)
[47/50] Running N=215443, theta_crit=0.9... mean=112.454ms (took 2.2s)
[48/50] Running N=774263, theta_crit=0.9... mean=481.105ms (took 8.4s)
[49/50] Skipping N=2782559, theta_crit=0.9
[50/50] Skipping N=10000000, theta_crit=0.9
Info: setting clbvh_dual_tree_traversal implementation to impl : {"implementation":"scan_multipass","parameters":{}} [algs][rank=0]
Running DTT performance benchmarks for scan_multipass ordered=False...
Particle counts: [100, 359, 1291, 4641, 16681, 59948, 215443, 774263, 2782559, 10000000]
Theta_crit values: [0.1, 0.3, 0.5, 0.7, 0.9]
Compression level: 4
[ 1/50] Running N= 100, theta_crit=0.1... mean=3.239ms (took 0.1s)
[ 2/50] Running N= 359, theta_crit=0.1... mean=4.772ms (took 0.1s)
[ 3/50] Running N= 1291, theta_crit=0.1... mean=6.426ms (took 0.1s)
[ 4/50] Running N= 4641, theta_crit=0.1... mean=8.852ms (took 0.1s)
[ 5/50] Skipping N=16681, theta_crit=0.1
[ 6/50] Skipping N=59948, theta_crit=0.1
[ 7/50] Skipping N=215443, theta_crit=0.1
[ 8/50] Skipping N=774263, theta_crit=0.1
[ 9/50] Skipping N=2782559, theta_crit=0.1
[10/50] Skipping N=10000000, theta_crit=0.1
[11/50] Running N= 100, theta_crit=0.3... mean=3.261ms (took 0.1s)
[12/50] Running N= 359, theta_crit=0.3... mean=4.690ms (took 0.1s)
[13/50] Running N= 1291, theta_crit=0.3... mean=6.235ms (took 0.1s)
[14/50] Running N= 4641, theta_crit=0.3... mean=8.527ms (took 0.1s)
[15/50] Running N=16681, theta_crit=0.3... mean=13.746ms (took 0.2s)
[16/50] Skipping N=59948, theta_crit=0.3
[17/50] Skipping N=215443, theta_crit=0.3
[18/50] Skipping N=774263, theta_crit=0.3
[19/50] Skipping N=2782559, theta_crit=0.3
[20/50] Skipping N=10000000, theta_crit=0.3
[21/50] Running N= 100, theta_crit=0.5... mean=3.286ms (took 0.1s)
[22/50] Running N= 359, theta_crit=0.5... mean=4.396ms (took 0.1s)
[23/50] Running N= 1291, theta_crit=0.5... mean=6.120ms (took 0.1s)
[24/50] Running N= 4641, theta_crit=0.5... mean=7.902ms (took 0.1s)
[25/50] Running N=16681, theta_crit=0.5... mean=10.546ms (took 0.2s)
[26/50] Skipping N=59948, theta_crit=0.5
[27/50] Skipping N=215443, theta_crit=0.5
[28/50] Skipping N=774263, theta_crit=0.5
[29/50] Skipping N=2782559, theta_crit=0.5
[30/50] Skipping N=10000000, theta_crit=0.5
[31/50] Running N= 100, theta_crit=0.7... mean=3.265ms (took 0.1s)
[32/50] Running N= 359, theta_crit=0.7... mean=4.698ms (took 0.1s)
[33/50] Running N= 1291, theta_crit=0.7... mean=7.827ms (took 0.1s)
[34/50] Running N= 4641, theta_crit=0.7... mean=7.834ms (took 0.1s)
[35/50] Running N=16681, theta_crit=0.7... mean=9.983ms (took 0.2s)
[36/50] Running N=59948, theta_crit=0.7... mean=14.820ms (took 0.5s)
[37/50] Skipping N=215443, theta_crit=0.7
[38/50] Skipping N=774263, theta_crit=0.7
[39/50] Skipping N=2782559, theta_crit=0.7
[40/50] Skipping N=10000000, theta_crit=0.7
[41/50] Running N= 100, theta_crit=0.9... mean=3.272ms (took 0.1s)
[42/50] Running N= 359, theta_crit=0.9... mean=4.701ms (took 0.1s)
[43/50] Running N= 1291, theta_crit=0.9... mean=7.857ms (took 0.1s)
[44/50] Running N= 4641, theta_crit=0.9... mean=7.767ms (took 0.1s)
[45/50] Running N=16681, theta_crit=0.9... mean=9.572ms (took 0.2s)
[46/50] Running N=59948, theta_crit=0.9... mean=12.538ms (took 0.4s)
[47/50] Skipping N=215443, theta_crit=0.9
[48/50] Skipping N=774263, theta_crit=0.9
[49/50] Skipping N=2782559, theta_crit=0.9
[50/50] Skipping N=10000000, theta_crit=0.9
Plot the performance benchmarks for all implementations
285 dump_folder = "_to_trash"
286
287 import os
288
289 # Create the dump directory if it does not exist
290 if shamrock.sys.world_rank() == 0:
291 os.makedirs(dump_folder, exist_ok=True)
292
293 ref_key = "reference ordered=False"
294 largest_refalg_value = np.nanmax(results[ref_key]["results_min"])
295
296 i = 0
297 # iterate over the results
298 for k, v in results.items():
299 # Get the results for this algorithm
300 particle_counts = v["particle_counts"]
301 theta_crits = v["theta_crits"]
302 results_min = v["results_min"]
303 results_max_mem_delta = v["results_max_mem_delta"]
304
305 # Get reference algorithm results for comparison
306 reference_min = results[ref_key]["results_min"]
307
308 # Create and display the plot
309 fig, ax = create_checkerboard_plot(
310 particle_counts,
311 theta_crits,
312 results_min,
313 compression_level,
314 v["name"],
315 largest_refalg_value,
316 reference_min,
317 results_max_mem_delta,
318 )
319
320 plt.savefig(f"{dump_folder}/benchmark-dtt-performance-{i}.pdf")
321 i += 1
322
323 plt.show()
Total running time of the script: (1 minutes 37.461 seconds)
Estimated memory usage: 290 MB





