@@ -81,13 +81,17 @@ def run_scaling_test(self, **kwargs):
8181 ** kwargs ,
8282 )
8383
84- def plot_scaling_test (self , ax , quantity = 'time' , ** plotting_params ): # pragma: no cover
84+ def plot_scaling_test (self , ax , quantity = 'time' , space_time = None , ** plotting_params ): # pragma: no cover
8585 from matplotlib .colors import TABLEAU_COLORS
8686
8787 cmap = TABLEAU_COLORS
8888 colors = list (cmap .values ())
8989
9090 for experiment in self .experiments :
91+ if space_time is not None :
92+ if not experiment .PinT == space_time :
93+ continue
94+
9195 tasks_time = self .tasks_time if experiment .PinT else 1
9296 timings = {}
9397
@@ -141,20 +145,30 @@ def plot_scaling_test(self, ax, quantity='time', **plotting_params): # pragma:
141145 elif quantity == 'throughput_per_task' :
142146 timings [np .prod (procs )] = experiment .res ** self .ndim / t_mean
143147 elif quantity == 'efficiency' :
148+ if type (config ).__name__ == 'GrayScottScaling3D' :
149+ norm = 13216322.909
150+ else :
151+ norm = 1
144152 timings [np .prod (procs ) / self .tasks_per_node ] = (
145- experiment .res ** self .ndim / t_mean / np .prod (procs )
153+ experiment .res ** self .ndim / t_mean / np .prod (procs ) / norm
146154 )
147155 elif quantity == 'time' :
148156 timings [np .prod (procs ) / self .tasks_per_node ] = t_mean
149157 elif quantity == 'time_per_task' :
150158 timings [np .prod (procs )] = t_mean
151159 elif quantity == 'min_time_per_task' :
152160 timings [np .prod (procs )] = t_min
161+ elif quantity == 'min_time' :
162+ timings [np .prod (procs ) / self .tasks_per_node ] = t_min
153163 else :
154164 raise NotImplementedError
155165 except (FileNotFoundError , ValueError ):
156166 pass
157167
168+ if quantity == 'efficiency' and type (config ).__name__ == 'RayleighBenard_scaling' :
169+ norm = max (timings .values ())
170+ timings = {key : value / norm for key , value in timings .items ()}
171+
158172 ax .loglog (
159173 timings .keys (),
160174 timings .values (),
@@ -171,7 +185,8 @@ def plot_scaling_test(self, ax, quantity='time', **plotting_params): # pragma:
171185 'time' : r'$t_\mathrm{step}$ / s' ,
172186 'time_per_task' : r'$t_\mathrm{step}$ / s' ,
173187 'min_time_per_task' : r'minimal $t_\mathrm{step}$ / s' ,
174- 'efficiency' : 'efficiency / DoF/s/task' ,
188+ 'min_time' : r'minimal $t_\mathrm{step}$ / s' ,
189+ 'efficiency' : r'parallel efficiency / \%' ,
175190 }
176191 ax .set_ylabel (labels [quantity ])
177192
@@ -331,17 +346,28 @@ class RayleighBenardDedalusComparisonGPU(GPUConfig, ScalingConfig):
331346 ]
332347
333348
334- def plot_scalings (problem , ** kwargs ): # pragma: no cover
349+ def plot_scalings (problem , XPU = None , space_time = None , ** kwargs ): # pragma: no cover
335350 if problem == 'GS3D' :
336- configs = [
337- GrayScottSpaceScalingCPU3D (),
338- GrayScottSpaceScalingGPU3D (),
339- ]
351+ if XPU == 'CPU' :
352+ configs = [GrayScottSpaceScalingCPU3D ()]
353+ elif XPU == 'GPU' :
354+ configs = [GrayScottSpaceScalingGPU3D ()]
355+ else :
356+ configs = [GrayScottSpaceScalingCPU3D (), GrayScottSpaceScalingGPU3D ()]
340357 elif problem == 'RBC' :
341- configs = [
342- RayleighBenardSpaceScalingGPU (),
343- RayleighBenardSpaceScalingCPU (),
344- ]
358+ if XPU == 'CPU' :
359+ configs = [
360+ RayleighBenardSpaceScalingCPU (),
361+ ]
362+ elif XPU == 'GPU' :
363+ configs = [
364+ RayleighBenardSpaceScalingGPU (),
365+ ]
366+ else :
367+ configs = [
368+ RayleighBenardSpaceScalingGPU (),
369+ RayleighBenardSpaceScalingCPU (),
370+ ]
345371 elif problem == 'RBC_dedalus' :
346372 configs = [
347373 RayleighBenardDedalusComparison (),
@@ -358,31 +384,26 @@ def plot_scalings(problem, **kwargs): # pragma: no cover
358384 ('RBC' , 'time' ): {'x' : [1 / 10 , 64 ], 'y' : [60 , 60 / 640 ]},
359385 ('RBC' , 'time_per_task' ): {'x' : [1 , 640 ], 'y' : [60 , 60 / 640 ]},
360386 ('RBC' , 'min_time_per_task' ): {'x' : [1 , 640 ], 'y' : [60 , 60 / 640 ]},
387+ ('RBC' , 'min_time' ): {'x' : [1 , 640 ], 'y' : [60 , 60 / 640 ]},
361388 ('RBC' , 'throughput_per_task' ): {'x' : [1 / 1 , 640 ], 'y' : [2e4 , 2e4 * 640 ]},
362389 }
363390
364- fig , ax = plt .subplots (figsize = figsize_by_journal ('TUHH_thesis' , 1 , 0.6 ))
365- configs [1 ].plot_scaling_test (ax = ax , quantity = 'efficiency' )
366- # ax.legend(frameon=False)
367- box = ax .get_position ()
368- ax .set_position ([box .x0 , box .y0 , box .width * 0.8 , box .height ])
369- ax .legend (loc = 'center left' , bbox_to_anchor = (1 , 0.5 ))
370-
371- ax .set_yscale ('linear' )
372- path = f'{ PROJECT_PATH } /plots/scaling_{ problem } _efficiency.pdf'
373- fig .savefig (path , bbox_inches = 'tight' )
374- print (f'Saved { path !r} ' , flush = True )
375-
376- for quantity in ['time' , 'throughput' , 'time_per_task' , 'throughput_per_task' , 'min_time_per_task' ][::- 1 ]:
391+ for quantity in ['time' , 'throughput' , 'time_per_task' , 'throughput_per_task' , 'min_time_per_task' , 'efficiency' ][
392+ ::- 1
393+ ]:
377394 fig , ax = plt .subplots (figsize = figsize_by_journal ('TUHH_thesis' , 1 , 0.6 ))
378395 for config in configs :
379- config .plot_scaling_test (ax = ax , quantity = quantity )
396+ config .plot_scaling_test (ax = ax , quantity = quantity , space_time = space_time )
380397 if (problem , quantity ) in ideal_lines .keys ():
381398 ax .loglog (* ideal_lines [(problem , quantity )].values (), color = 'black' , ls = ':' , label = 'ideal' )
399+ elif quantity == 'efficiency' :
400+ ax .axhline (1 , color = 'black' , ls = ':' , label = 'ideal' )
401+ ax .set_yscale ('linear' )
402+ ax .set_ylim (0 , 1.1 )
382403 box = ax .get_position ()
383404 ax .set_position ([box .x0 , box .y0 , box .width * 0.8 , box .height ])
384405 ax .legend (loc = 'center left' , bbox_to_anchor = (1 , 0.5 ))
385- path = f'{ PROJECT_PATH } /plots/scaling_{ problem } _{ quantity } .pdf'
406+ path = f'{ PROJECT_PATH } /plots/scaling_{ problem } _{ quantity } _ { XPU } _ { space_time } .pdf'
386407 fig .savefig (path , bbox_inches = 'tight' )
387408 print (f'Saved { path !r} ' , flush = True )
388409
@@ -393,8 +414,8 @@ def plot_scalings(problem, **kwargs): # pragma: no cover
393414 parser = argparse .ArgumentParser ()
394415 parser .add_argument ('--mode' , type = str , choices = ['run' , 'plot' ], default = 'run' )
395416 parser .add_argument ('--problem' , type = str , default = 'GS' )
396- parser .add_argument ('--XPU' , type = str , choices = ['CPU' , 'GPU' ], default = 'CPU' )
397- parser .add_argument ('--space_time' , type = str , choices = ['True' , 'False' ], default = 'False' )
417+ parser .add_argument ('--XPU' , type = str , choices = ['CPU' , 'GPU' , 'both' ], default = 'CPU' )
418+ parser .add_argument ('--space_time' , type = str , choices = ['True' , 'False' , 'None' ], default = 'False' )
398419 parser .add_argument ('--submit' , type = str , choices = ['True' , 'False' ], default = 'True' )
399420 parser .add_argument ('--nsys_profiling' , type = str , choices = ['True' , 'False' ], default = 'False' )
400421
@@ -403,6 +424,13 @@ def plot_scalings(problem, **kwargs): # pragma: no cover
403424 submit = args .submit == 'True'
404425 nsys_profiling = args .nsys_profiling == 'True'
405426
427+ if args .space_time == 'True' :
428+ space_time = True
429+ elif args .space_time == 'False' :
430+ space_time = False
431+ else :
432+ space_time = None
433+
406434 config_classes = []
407435
408436 if args .problem == 'GS3D' :
@@ -429,6 +457,6 @@ def plot_scalings(problem, **kwargs): # pragma: no cover
429457 if args .mode == 'run' :
430458 config .run_scaling_test (submit = submit , nsys_profiling = nsys_profiling )
431459 elif args .mode == 'plot' :
432- plot_scalings (problem = args .problem )
460+ plot_scalings (problem = args .problem , XPU = args . XPU , space_time = space_time )
433461 else :
434462 raise NotImplementedError (f'Don\' t know mode { args .mode !r} ' )
0 commit comments