Skip to content

Commit fd7a6dc

Browse files
committed
Added GS series plot
1 parent 86c4928 commit fd7a6dc

File tree

3 files changed

+60
-36
lines changed

3 files changed

+60
-36
lines changed

pySDC/projects/GPU/analysis_scripts/parallel_scaling.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,13 @@ def run_scaling_test(self, **kwargs):
7272
command += ' --useGPU=True'
7373

7474
write_jobscript(
75-
sbatch_options, srun_options, command, self.cluster, name=f'{type(self).__name__}_{res}', OMP_NUM_THREADS=self.OMP_NUM_THREADS, **kwargs
75+
sbatch_options,
76+
srun_options,
77+
command,
78+
self.cluster,
79+
name=f'{type(self).__name__}_{res}',
80+
OMP_NUM_THREADS=self.OMP_NUM_THREADS,
81+
**kwargs,
7682
)
7783

7884
def plot_scaling_test(self, ax, quantity='time', **plotting_params): # pragma: no cover
@@ -163,6 +169,7 @@ class CPUConfig(ScalingConfig):
163169
partition = 'batch'
164170
tasks_per_node = 16
165171

172+
166173
class JurecaCPU(ScalingConfig):
167174
cluster = 'jureca'
168175
partition = 'dc-cpu'
@@ -213,11 +220,11 @@ class GrayScottSpaceScalingGPU3D(GPUConfig, ScalingConfig):
213220
]
214221

215222

216-
217223
class RBCBaseConfig(ScalingConfig):
218224
def format_resolution(self, resolution):
219225
return fr'${{{resolution}}}\times{{{resolution//4}}}$'
220226

227+
221228
class RayleighBenardSpaceScalingCPU(JurecaCPU, RBCBaseConfig):
222229
ndim = 2
223230
config = 'RBC_scaling'
@@ -237,6 +244,7 @@ class RayleighBenardSpaceScalingCPU(JurecaCPU, RBCBaseConfig):
237244
# Experiment(res=16384, PinT=False, sequence=[4096], marker='o'),
238245
]
239246

247+
240248
class RayleighBenardSpaceScalingCPULarge(RayleighBenardSpaceScalingCPU):
241249
tasks_per_node = 32
242250

@@ -301,12 +309,12 @@ class RayleighBenardDedalusComparisonGPU(GPUConfig, ScalingConfig):
301309

302310

303311
def plot_scalings(problem, **kwargs): # pragma: no cover
304-
if problem == 'GS':
305-
configs = [
306-
GrayScottSpaceScalingCPU(),
307-
GrayScottSpaceScalingGPU(),
308-
]
309-
elif problem == 'GS3D':
312+
# if problem == 'GS':
313+
# configs = [
314+
# GrayScottSpaceScalingCPU(),
315+
# GrayScottSpaceScalingGPU(),
316+
# ]
317+
if problem == 'GS3D':
310318
configs = [
311319
GrayScottSpaceScalingCPU3D(),
312320
GrayScottSpaceScalingGPU3D(),
@@ -375,10 +383,7 @@ def plot_scalings(problem, **kwargs): # pragma: no cover
375383
config_classes += [GrayScottSpaceScalingGPU3D]
376384
elif args.problem == 'RBC':
377385
if args.XPU == 'CPU':
378-
config_classes += [
379-
RayleighBenardSpaceScalingCPU,
380-
RayleighBenardSpaceScalingCPULarge
381-
]
386+
config_classes += [RayleighBenardSpaceScalingCPU, RayleighBenardSpaceScalingCPULarge]
382387
else:
383388
config_classes += [RayleighBenardSpaceScalingGPU]
384389
elif args.problem == 'RBC_dedalus':

pySDC/projects/GPU/analysis_scripts/plot_large_simulations.py

Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -210,29 +210,6 @@ def plot_residual(self):
210210
ax.legend(frameon=False)
211211
self.save_fig(fig, 'residual')
212212

213-
def plot_step_size(self):
214-
fig, ax = self.get_fig()
215-
dt = get_sorted(self.stats, type='dt', recomputed=False)
216-
CFL = self.get_CFL_limit()
217-
218-
ax.plot([me[0] for me in dt], [me[1] for me in dt], label=r'$\Delta t$')
219-
ax.plot(CFL.keys(), CFL.values(), label='CFL limit')
220-
ax.set_yscale('log')
221-
ax.set_xlabel('$t$')
222-
ax.set_ylabel(r'$\Delta t$')
223-
ax.legend(frameon=False)
224-
self.save_fig(fig, 'dt')
225-
226-
def plot_verification(self):
227-
fig, ax = self.get_fig()
228-
229-
nu = get_sorted(self.stats, type='Nusselt', recomputed=False)
230-
for key in ['t', 'b', 'V']:
231-
ax.plot([me[0] for me in nu], [me[1][key] for me in nu], label=fr'$Nu_\mathrm{{{key}}}$')
232-
ax.legend(frameon=False)
233-
ax.set_xlabel('$t$')
234-
self.save_fig(fig, 'verification')
235-
236213
def plot_series(self):
237214
indices = [0, 56, 82, 100, 162, 186]
238215

@@ -300,6 +277,45 @@ def plot_step_size(self):
300277
ax.legend(frameon=False)
301278
self.save_fig(fig, 'dt')
302279

280+
def plot_series(self, test=False):
281+
if test:
282+
indices = [0, 1, 2, 3, 4, 5]
283+
process = 0
284+
else:
285+
indices = [0, 10, 20, 30, 40, 90]
286+
process = 96
287+
288+
from mpl_toolkits.axes_grid1 import make_axes_locatable
289+
290+
# get grid
291+
path = self.get_path(idx=0, n_space=process)
292+
with open(path, 'rb') as file:
293+
data = pickle.load(file)
294+
X = data['X']
295+
296+
if tqdm:
297+
frame_range = tqdm(indices)
298+
frame_range.set_description('Plotting slice')
299+
300+
for frame in frame_range:
301+
302+
plt.rcParams['figure.constrained_layout.use'] = True
303+
fig, ax = plt.subplots(1, 1, figsize=figsize_by_journal('TUHH_thesis', 0.4, 1.1))
304+
divider = make_axes_locatable(ax)
305+
cax = divider.append_axes('right', size='3%', pad=0.03)
306+
307+
path = self.get_path(idx=frame, n_space=process)
308+
with open(path, 'rb') as file:
309+
data = pickle.load(file)
310+
im = ax.pcolormesh(X[1][0], X[2][0], data['u'][0], cmap='binary', rasterized=True)
311+
312+
fig.colorbar(im, cax) # , label=f'$T(t={{{t:.1f}}})$')
313+
314+
ax.set_xlabel('$y$')
315+
ax.set_ylabel('$z$')
316+
ax.set_aspect(1)
317+
self.save_fig(fig, f'series_{frame}_t={data["t"]:.0f}')
318+
303319

304320
if __name__ == '__main__': # pragma: no cover
305321
import argparse
@@ -333,6 +349,7 @@ def plot_step_size(self):
333349
plotter.plot_verification()
334350
plotter.plot_series()
335351
else:
352+
plotter.plot_series(args.config == 'test')
336353
plotter.plot_step_size()
337354

338355
plt.show()

pySDC/projects/GPU/etc/generate_jobscript.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ def generate_directories():
1414
os.makedirs(path, exist_ok=True)
1515

1616

17-
def get_jobscript_text(sbatch_options, srun_options, command, cluster, name='Coffeebreak', nsys_profiling=False, OMP_NUM_THREADS=1):
17+
def get_jobscript_text(
18+
sbatch_options, srun_options, command, cluster, name='Coffeebreak', nsys_profiling=False, OMP_NUM_THREADS=1
19+
):
1820
"""
1921
Generate the text for a jobscript
2022

0 commit comments

Comments
 (0)