24
24
"Benchmark for Azimuthal integration of PyFAI"
25
25
26
26
__author__ = "Jérôme Kieffer"
27
- __date__ = "21/05/2024 "
27
+ __date__ = "11/03/2025 "
28
28
__license__ = "MIT"
29
29
__copyright__ = "2012-2024 European Synchrotron Radiation Facility, Grenoble, France"
30
30
@@ -256,6 +256,7 @@ def __init__(self, nbr=10, repeat=1, memprofile=False, unit="2th_deg", max_size=
256
256
self .unit = unit
257
257
self .out_2d = (500 , 360 )
258
258
self .max_size = max_size or sys .maxunicode
259
+ self .plot_y_range = [1 , 1000 ]
259
260
260
261
def get_cpu (self ):
261
262
if self ._cpu is None :
@@ -363,7 +364,7 @@ def bench_1d(self, method="splitBBox", check=False, opencl=None, function="integ
363
364
device = ' ' .join (str (ocl .platforms [platformid ].devices [deviceid ]).split ())
364
365
print ("Working on device: %s platform: %s device: %s" % (devicetype , platform , device ))
365
366
# label = ("%s %s %s %s %s" % (function, devicetype, self.LABELS[method.method[1:4]], platform, device)).replace(" ", "_")
366
- label = f'{ devicetype } :{ platform } :{ device } / { function } : { method .split_lower } _ { method .algo_lower } _ { method .impl_lower } '
367
+ label = f'{ devicetype } :{ platform } :{ device } / { function } : ( { method .split_lower } , { method .algo_lower } , { method .impl_lower } ) '
367
368
method = IntegrationMethod .select_method (dim = 1 , split = method .split_lower ,
368
369
algo = method .algo_lower , impl = method .impl_lower ,
369
370
target = (opencl ["platformid" ], opencl ["deviceid" ]))[0 ]
@@ -639,24 +640,25 @@ def init_curve(self):
639
640
self .ax .set_yscale ("log" , base = 2 )
640
641
except Exception :
641
642
self .ax .set_yscale ("log" , basey = 2 )
642
- t = [0.5 , 1 , 2 , 5 , 10 , 20 , 50 , 100 , 200 , 500 , 1000 ]
643
+ t = [0.1 , 0.2 , 0. 5 , 1 , 2 , 5 , 10 , 20 , 50 , 100 , 200 , 500 , 1000 , 2000 , 5000 ]
643
644
self .ax .set_yticks ([float (i ) for i in t ])
644
645
self .ax .set_yticklabels ([str (i )for i in t ])
645
646
self .ax .set_xlim (0.0 , 20 )
646
- self .ax .set_ylim (0.5 , 1500 )
647
+ self .ax .set_ylim (0.75 * self .plot_y_range [0 ],
648
+ 1.5 * self .plot_y_range [1 ])
647
649
self .ax .set_title (f'CPU: { self .get_cpu ()} \n GPU: { self .get_gpu ()} ' )
648
650
649
651
# Display detector markers (vertical lines)
650
652
self .ax .vlines (
651
653
x = data_sizes ,
652
- ymin = self . ax . get_ylim ()[ 0 ] ,
653
- ymax = self .ax . get_ylim () [1 ],
654
+ ymin = 0 ,
655
+ ymax = 100 * self .plot_y_range [1 ],
654
656
linestyles = 'dashed' ,
655
657
alpha = 0.4 ,
656
658
colors = 'black' ,
657
659
)
658
660
for size , detector_label in zip (data_sizes , detector_names ):
659
- self .ax .text (x = size , y = 0.6 , s = detector_label , rotation = 270 , fontsize = 7 )
661
+ self .ax .text (x = size , y = 0.8 , s = detector_label , rotation = 270 , fontsize = 7 )
660
662
661
663
update_fig (self .fig )
662
664
@@ -674,7 +676,11 @@ def new_curve(self, results, label, style="-", marker="x"):
674
676
self .plot_x = list (results .keys ())
675
677
self .plot_x .sort ()
676
678
self .plot_y = [1000.0 / results [i ] for i in self .plot_x ]
679
+ self .plot_y_range = [min (min (self .plot_y_range ), min (self .plot_y )),
680
+ max (max (self .plot_y_range ), max (self .plot_y ))]
677
681
self .plot = self .ax .plot (self .plot_x , self .plot_y , marker + style , label = label )[0 ]
682
+ self .ax .set_ylim (0.75 * self .plot_y_range [0 ],
683
+ 1.5 * self .plot_y_range [1 ])
678
684
679
685
handles , labels = self .ax .get_legend_handles_labels ()
680
686
self .ax .legend (
@@ -697,9 +703,14 @@ def new_point(self, size, exec_time):
697
703
if not self .plot :
698
704
return
699
705
706
+ y_value = 1000.0 / exec_time
700
707
self .plot_x .append (size )
701
- self .plot_y .append (1000.0 / exec_time )
708
+ self .plot_y .append (y_value )
702
709
self .plot .set_data (self .plot_x , self .plot_y )
710
+ self .plot_y_range = [min (self .plot_y_range [0 ], y_value ),
711
+ max (self .plot_y_range [1 ], y_value )]
712
+ self .ax .set_ylim (0.75 * self .plot_y_range [0 ],
713
+ 1.5 * self .plot_y_range [1 ])
703
714
update_fig (self .fig )
704
715
705
716
def display_all (self ):
0 commit comments