Skip to content

Commit aef51a9

Browse files
committed
TL: added pretty printing to collectInfos
1 parent 1492a61 commit aef51a9

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

pySDC/playgrounds/dedalus/scripts/collectInfos.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33
import os
4+
import json
45
import glob
56
import shutil
67
import argparse
@@ -37,6 +38,12 @@
3738
ext = fileName.split(".")[-1]
3839
dst = f"{outFolder}/{folder[len(prefix):]}.{ext}"
3940
print(f" -- copying {src} into {dst}")
40-
shutil.copy(src, dst)
41+
if ext == "json":
42+
with open(src, "r") as f:
43+
content = json.load(f)
44+
with open(dst, "w") as f:
45+
json.dump(content, f, indent=4)
46+
else:
47+
shutil.copy(src, dst)
4148

4249
print(" -- all done !")

pySDC/playgrounds/dedalus/scripts/plotScaling.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@
99
import numpy as np
1010
import matplotlib.pyplot as plt
1111

12-
folder = "_benchJusuf"
12+
folder = "_benchJureca"
1313

14-
schemes = ["RK443", "SDC", "SDC-MPI", "SDC-MPI2", "SDC-MPI2-GT"]
1514
R = 2
15+
if R == 2:
16+
schemes = ["RK443", "SDC", "SDC-MPI2-GT"] # + ["SDC-MPI", "SDC-MPI2"]
17+
elif R == 1:
18+
schemes = ["RK443", "SDC", "SDC-MPI2-GT"]
1619

1720
useNSpS = False
1821
nSpS = {
@@ -47,13 +50,14 @@
4750
results[scheme].sort(key=lambda p: p[0])
4851

4952
symbols = ["o", "^", "s", "p", "*"]
53+
colors = plt.rcParams['axes.prop_cycle'].by_key()['color']
54+
ls = "--" if "64tpc" in folder else "-"
5055

51-
52-
plt.figure("scaling"+"-nSpS"*useNSpS)
53-
for scheme, sym in zip(results.keys(), symbols):
56+
plt.figure("scaling"+"-nSpS"*useNSpS+f"-R{R}")
57+
for scheme, sym, col in zip(results.keys(), symbols, colors):
5458
res = np.array(results[scheme]).T
55-
plt.loglog(*res, sym+'-', label=scheme)
56-
plt.loglog(res[0], np.prod(res[:, 0])/res[0], "--", c="gray")
59+
plt.loglog(*res, sym+ls, label=scheme, c=col)
60+
# plt.loglog(res[0], np.prod(res[:, 0])/res[0], "--", c="gray")
5761
plt.legend()
5862
plt.grid(True)
5963
plt.xlabel("$N_{p}$")
@@ -64,12 +68,12 @@
6468
plt.tight_layout()
6569

6670

67-
plt.figure("PinT-speedup")
71+
plt.figure(f"PinT-speedup-R{R}")
6872
nProcSpace, tSDC = np.array(results["SDC"]).T
69-
for scheme, sym in zip(schemes[2:], symbols):
73+
for scheme, sym, col in zip(schemes[2:], symbols, colors):
7074
_, tSDCPinT = np.array(results[scheme]).T
71-
speedup = tSDC[:-2]/tSDCPinT
72-
plt.semilogx(nProcSpace[:-2], speedup, sym+"-", label=scheme)
75+
speedup = tSDC[:len(tSDCPinT)]/tSDCPinT
76+
plt.semilogx(nProcSpace[:len(tSDCPinT)], speedup, sym+ls, c=col, label=scheme)
7377
plt.legend()
7478
plt.grid(True)
7579
plt.xlabel("$N_{p,S}$"), plt.ylabel("PinT Speedup")

0 commit comments

Comments
 (0)