Skip to content

Commit 048f1c6

Browse files
committed
wave-equation: exclude jit compilation from timing
1 parent 7fb1742 commit 048f1c6

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
@@ -169,9 +169,6 @@ def exact_elev(t, x_t_2d, y_t_2d, lx, ly):
169169
sol_t = numpy.cos(2 * omega * t)
170170
return amp * sol_x * sol_y * sol_t
171171

172-
# inital elevation
173-
e[:, :] = exact_elev(0.0, x_t_2d, y_t_2d, lx, ly)
174-
175172
# compute time step
176173
alpha = 0.5
177174
c = (g * h) ** 0.5
@@ -222,6 +219,16 @@ def step(u, v, e, u1, v1, e1, u2, v2, e2):
222219
v[:, 1:-1] = v[:, 1:-1] / 3.0 + 2.0 / 3.0 * (v2[:, 1:-1] + dt * dvdt)
223220
e[:, :] = e[:, :] / 3.0 + 2.0 / 3.0 * (e2[:, :] + dt * dedt)
224221

222+
# warm up jit cache
223+
step(u, v, e, u1, v1, e1, u2, v2, e2)
224+
sync()
225+
226+
# initial solution
227+
e[:, :] = exact_elev(0.0, x_t_2d, y_t_2d, lx, ly)
228+
u[:, :] = create_full(U_shape, 0.0, dtype)
229+
v[:, :] = create_full(V_shape, 0.0, dtype)
230+
sync()
231+
225232
t = 0
226233
i_export = 0
227234
next_t_export = 0

0 commit comments

Comments
 (0)