Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 3612594

Browse files
committedNov 7, 2024
wave-equation: exclude jit compilation from timing
1 parent 2da8b03 commit 3612594

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed
 

Diff for: ‎examples/wave_equation.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,6 @@ def exact_elev(t, x_t_2d, y_t_2d, lx, ly):
166166
sol_t = numpy.cos(2 * omega * t)
167167
return amp * sol_x * sol_y * sol_t
168168

169-
# inital elevation
170-
e[:, :] = exact_elev(0.0, x_t_2d, y_t_2d, lx, ly)
171-
172169
# compute time step
173170
alpha = 0.5
174171
c = (g * h) ** 0.5
@@ -219,6 +216,16 @@ def step(u, v, e, u1, v1, e1, u2, v2, e2):
219216
v[:, 1:-1] = v[:, 1:-1] / 3.0 + 2.0 / 3.0 * (v2[:, 1:-1] + dt * dvdt)
220217
e[:, :] = e[:, :] / 3.0 + 2.0 / 3.0 * (e2[:, :] + dt * dedt)
221218

219+
# warm up jit cache
220+
step(u, v, e, u1, v1, e1, u2, v2, e2)
221+
sync()
222+
223+
# initial solution
224+
e[:, :] = exact_elev(0.0, x_t_2d, y_t_2d, lx, ly)
225+
u[:, :] = create_full(U_shape, 0.0, dtype)
226+
v[:, :] = create_full(V_shape, 0.0, dtype)
227+
sync()
228+
222229
t = 0
223230
i_export = 0
224231
next_t_export = 0

0 commit comments

Comments
 (0)
Please sign in to comment.