Skip to content

Commit 142f4ad

Browse files
committed
adds CPUversusGPU fig in docs/assets
1 parent d5a94e5 commit 142f4ad

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

docs/src/assets/CPUversusGPU.jl

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using PyPlot
2+
3+
# sample problem
4+
n = [64, 128, 256, 512, 1024, 2048, 4096];
5+
cpu = [63.376e-3, 103.985e-3, 292.813e-3, 872.886e-3, 3.957, 22.645, 79.344 ];
6+
gpu = [18.923e-3, 18.869e-3, 24.897e-3, 71.766e-3, 238.528e-3, 925.671e-3,4.984 ];
7+
8+
# FourierFlows TwoDTurb problem
9+
n = [128, 256, 512, 1024, 2048, 4096]
10+
cpu = [0.446, 1.130, 3.344, 19.654, 98.487, 376.201]
11+
gpu = [0.104, 0.152, 0.414, 1.405, 5.459, 23.724]
12+
13+
14+
fig, axs = subplots(ncols=1, nrows=2, figsize=(6, 7))
15+
16+
subplot(2,1,1)
17+
loglog(n, cpu, "*:", label="CPU", linewidth=0.8, markersize=8)
18+
loglog(n, gpu, "o:", label="GPU", linewidth=0.8, markersize=6)
19+
loglog(n, 0.0001*n.^2, "-k", label="slope 2", linewidth=1)
20+
ylabel("walltime for 100 time-steps [s]", fontsize=12)
21+
title("TwoDTurb module benchmark", fontsize=16)
22+
# xlim(70, 10000)
23+
legend()
24+
25+
subplot(2,1,2)
26+
semilogx(n, cpu./gpu, "d:k", linewidth=0.8, markersize=6)
27+
ylabel("GPU over CPU speedup", fontsize=12)
28+
xlabel("number of grid-points per spatial dimension", fontsize=12)
29+
# xlim(20, 10000)
30+
ylim(0, 20)
31+
legend()
32+
33+
savename = string("CPUversusGPU")
34+
savefig(savename, dpi=300)

docs/src/assets/CPUversusGPU.png

206 KB
Loading

0 commit comments

Comments
 (0)