Skip to content

Commit

Permalink
mpi: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
georgebisbas committed Aug 2, 2023
1 parent 7f3b37e commit e54cd7b
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions fast/wave3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def plot_3dfunc(u):
import pyvista as pv
cmap = plt.colormaps["viridis"]
values = u.data[0, :, :, :]
vistagrid = pv.UniformGrid()
vistagrid = pv.ImageData()
vistagrid.dimensions = np.array(values.shape) + 1
vistagrid.spacing = (1, 1, 1)
vistagrid.origin = (0, 0, 0) # The bottom left corner of the data set
Expand Down Expand Up @@ -102,14 +102,14 @@ def plot_3dfunc(u):
pde = u.dt2 - u.laplace

# The PDE representation is as on paper
pde
# pde

stencil = Eq(u.forward, solve(pde, u.forward))
stencil

# Finally we define the source injection and receiver read function to generate
# the corresponding code
print(time_range)
# print(time_range)

print("Init norm:", np.linalg.norm(u.data[:]))
src_term = src.inject(field=u.forward, expr=src * dt**2 / model.m)
Expand All @@ -121,6 +121,8 @@ def plot_3dfunc(u):
if args.plot:
plot_3dfunc(u)

devito_norm = norm(u)
print("Init linalg norm 0 (inlined) :", norm(u))
print("Init linalg norm 0 :", np.linalg.norm(u.data[0]))
print("Init linalg norm 1 :", np.linalg.norm(u.data[1]))
print("Init linalg norm 2 :", np.linalg.norm(u.data[2]))
Expand Down Expand Up @@ -151,18 +153,19 @@ def plot_3dfunc(u):
#v[:, ..., :] = 1

print("Reinitialise data for XDSL:", np.linalg.norm(u.data[:]))
print("Init XDSL linalg norm:", np.linalg.norm(u.data[0]))
print("Init XDSL linalg norm:", np.linalg.norm(u.data[1]))
print("Init XDSL linalg norm:", np.linalg.norm(u.data[2]))
print("Init XDSL linalg norm 0:", np.linalg.norm(u.data[0]))
print("Init XDSL linalg norm 1:", np.linalg.norm(u.data[1]))
print("Init XDSL linalg norm 2:", np.linalg.norm(u.data[2]))

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

xdsl_output = u.copy()

print("XDSL norm:", norm(u))
print(f"xdsl output norm: {norm(xdsl_output)}")
print("XDSL output linalg norm:", np.linalg.norm(u.data[0]))
print("XDSL output linalg norm:", np.linalg.norm(u.data[1]))
print("XDSL output linalg norm:", np.linalg.norm(u.data[2]))
print("XDSL output linalg norm 0:", np.linalg.norm(u.data[0]))
print("XDSL output linalg norm 1:", np.linalg.norm(u.data[1]))
print("XDSL output linalg norm 2:", np.linalg.norm(u.data[2]))
print("devito-norm:", devito_norm)

0 comments on commit e54cd7b

Please sign in to comment.