Skip to content

Commit bf3ba5c

Browse files
committed
TL: scaling script + better space decomposition
1 parent c863bfa commit bf3ba5c

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

pySDC/playgrounds/dedalus/problems/rbc.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,9 @@ def buildGrid(self, aspectRatio, meshRatio, sComm, mpiBlocks):
382382
else:
383383
blocks = BlockDecomposition(nProcs, [Ny, Nz])
384384
mpiBlocks = blocks.nBlocks[-1::-1]
385+
if mpiBlocks[-1] > Nz:
386+
# limit number of blocks in z direction
387+
mpiBlocks = [nProcs//Nz, Nz]
385388
self.log(f" -- {mpiBlocks = }")
386389

387390
coords = d3.CartesianCoordinates('x', 'y', 'z')
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
"""
4+
Plot string scaling results stored in a given folder
5+
"""
6+
import json
7+
import glob
8+
9+
import numpy as np
10+
import matplotlib.pyplot as plt
11+
12+
folder = "_benchJusuf"
13+
14+
methods = ["RK443", "SDC"]
15+
res = 2
16+
17+
useNSpS = False
18+
nSpS = {
19+
"RK443": 23,
20+
"SDC": 17,
21+
}
22+
23+
results = {}
24+
25+
for scheme in methods:
26+
27+
files = glob.glob(f"{folder}/R{res}_{scheme}*.json")
28+
29+
results[scheme] = []
30+
31+
for file in files:
32+
33+
with open(file, "r") as f:
34+
infos = json.load(f)
35+
36+
nDOF = 5*infos["Nx"]*infos["Ny"]*infos["Nz"]
37+
nSteps = infos["nSteps"]
38+
tSim = infos["tComp"]/nDOF/nSteps
39+
nP = infos["MPI_SIZE"]
40+
if useNSpS:
41+
tSim *= nSpS[scheme]
42+
if scheme == "SDC" and useNSpS:
43+
tSim /= 3
44+
nP *= 4
45+
results[scheme].append([nP, tSim])
46+
47+
results[scheme].sort(key=lambda p: p[0])
48+
49+
symbols = ["o", "^", "s"]
50+
plt.figure("scaling"+"-nSpS"*useNSpS)
51+
for scheme, sym in zip(results.keys(), symbols):
52+
res = np.array(results[scheme]).T
53+
plt.loglog(*res, sym+'-', label=scheme)
54+
plt.loglog(res[0], np.prod(res[:, 0])/res[0], "--", c="gray")
55+
plt.legend()
56+
plt.grid(True)
57+
plt.xlabel("$N_{p}$")
58+
if useNSpS:
59+
plt.ylabel("$t_{wall}/N_{DoF}/T_{sim}$")
60+
else:
61+
plt.ylabel("$t_{wall}/N_{DoF}/N_{steps}$")
62+
plt.tight_layout()

0 commit comments

Comments
 (0)