Skip to content

Commit

Permalink
bench: more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
georgebisbas committed Jul 19, 2023
1 parent fe1650c commit 479d478
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
6 changes: 2 additions & 4 deletions fast/diffusion_2D_wBCs.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,14 @@
t = grid.stepping_dim

initdata = u.data[:]
op = Operator([eq_stencil])
op = Operator([eq_stencil], name='DevitoOperator')
op.apply(time=nt, dt=dt, a=nu)

print("Devito Field norm is:", norm(u))

# plot_image(u.data[0], cmap="seismic")

# Reset data and run XDSLOperator
init_hat(field=u.data[0], dx=dx, dy=dy, value=1.)
xdslop = XDSLOperator([eq_stencil])
xdslop = XDSLOperator([eq_stencil], name='XDSLOperator')
xdslop.apply(time=nt, dt=dt, a=nu)

print("XDSL Field norm is:", norm(u))
7 changes: 4 additions & 3 deletions fast/diffusion_3D_wBCs.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ def plot_3dfunc(u):

a = Constant(name='a')
# Create an equation with second-order derivatives
eq = Eq(u.dt, a * u.laplace, subdomain=grid.interior)
eq = Eq(u.dt, a * u.laplace)

stencil = solve(eq, u.forward)
eq_stencil = Eq(u.forward, stencil)

Expand All @@ -76,15 +77,15 @@ def plot_3dfunc(u):
print(eq_stencil)

# Create Operator
op = Operator([eq_stencil])
op = Operator([eq_stencil], name='DevitoOperator')
# Apply the operator for a number of timesteps
op.apply(time=nt, dt=dt, a=nu)
print("Devito Field norm is:", norm(u))

# Reset field
u.data[:, :, :, :] = 0
u.data[:, :, :, int(nz/2)] = 1
xdslop = XDSLOperator([eq_stencil])
xdslop = XDSLOperator([eq_stencil], name='xDSLOperator')
# Apply the xdsl operator for a number of timesteps
xdslop.apply(time=nt, dt=dt, a=nu)

Expand Down
4 changes: 2 additions & 2 deletions fast/nd_nwave_devito_nodamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def plot_3dfunc(u):
# the corresponding code
print(time_range)
src_term = src.inject(field=u.forward, expr=src * dt**2 / model.m)
op = Operator([stencil] + src_term, subs=model.spacing_map)
op = Operator([stencil] + src_term, subs=model.spacing_map, name='DevitoOperator')
# Run with source and plot
op.apply(time=time_range.num-1, dt=model.critical_dt)

Expand All @@ -115,7 +115,7 @@ def plot_3dfunc(u):
initdata = u.data[:]

# Run more with no sources now (Not supported in xdsl)
xdslop = XDSLOperator([stencil])
xdslop = XDSLOperator([stencil], name='XDSLOperator')
xdslop.apply(time=time_range.num-1, dt=model.critical_dt)

if len(shape) == 3:
Expand Down

0 comments on commit 479d478

Please sign in to comment.