Coverage for pySDC/projects/GPU/paper_plots.py: 0%
2 statements
« prev ^ index » next coverage.py v7.6.12, created at 2025-02-20 10:09 +0000
« prev ^ index » next coverage.py v7.6.12, created at 2025-02-20 10:09 +0000
1"""Make plots for publications"""
3import matplotlib.pyplot as plt
4from pySDC.helpers.plot_helper import setup_mpl, figsize_by_journal
7def plot_scalings_separately(problem, journal='TUHH_thesis', **kwargs): # pragma: no cover
8 from pySDC.projects.GPU.analysis_scripts.parallel_scaling import (
9 plot_scalings,
10 GrayScottSpaceScalingGPU3D,
11 GrayScottSpaceScalingCPU3D,
12 RayleighBenardSpaceScalingCPU,
13 RayleighBenardSpaceScalingGPU,
14 PROJECT_PATH,
15 )
17 if problem == 'GS3D':
18 configs = [
19 GrayScottSpaceScalingCPU3D(),
20 GrayScottSpaceScalingGPU3D(),
21 ]
22 elif problem == 'RBC':
23 configs = [
24 RayleighBenardSpaceScalingCPU(),
25 RayleighBenardSpaceScalingGPU(),
26 ]
28 else:
29 raise NotImplementedError
31 ideal_lines = {
32 ('GS3D', 'throughput'): {'x': [0.25, 400], 'y': [5e6, 8e9]},
33 ('GS3D', 'time'): {'x': [0.25, 400], 'y': [80, 5e-2]},
34 }
36 fig, ax = plt.subplots(figsize=figsize_by_journal(journal, 1, 0.6))
37 configs[1].plot_scaling_test(ax=ax, quantity='efficiency')
38 ax.legend(frameon=False)
39 path = f'{PROJECT_PATH}/plots/scaling_{problem}_efficiency.pdf'
40 fig.savefig(path, bbox_inches='tight')
41 print(f'Saved {path!r}', flush=True)
43 for quantity in ['time']:
44 fig, ax = plt.subplots(figsize=figsize_by_journal(journal, 1, 0.6))
45 for config in configs:
46 config.plot_scaling_test(ax=ax, quantity=quantity)
47 if (problem, quantity) in ideal_lines.keys():
48 ax.loglog(*ideal_lines[(problem, quantity)].values(), color='black', ls=':', label='ideal')
49 ax.legend(frameon=False)
50 path = f'{PROJECT_PATH}/plots/scaling_{problem}_{quantity}.pdf'
51 fig.savefig(path, bbox_inches='tight')
52 print(f'Saved {path!r}', flush=True)
55def make_plots_for_thesis(): # pragma: no cover
56 from pySDC.projects.GPU.analysis_scripts.plot_RBC_matrix import plot_DCT, plot_preconditioners, plot_ultraspherical
58 # small plots with no simulations
59 plot_DCT()
60 plot_preconditioners()
61 plot_ultraspherical()
63 # plot space-time parallel scaling
64 for problem in ['GS3D', 'RBC']:
65 plot_scalings_separately(problem=problem)
68if __name__ == '__main__':
69 import argparse
71 parser = argparse.ArgumentParser()
72 parser.add_argument('--target', choices=['thesis'], type=str)
73 args = parser.parse_args()
75 if args.target == 'thesis':
76 make_plots_for_thesis()
77 else:
78 raise NotImplementedError(f'Don\'t know how to make plots for target {args.target}')