Skip to content

Commit

Permalink
Avoid Devito's norm.
Browse files Browse the repository at this point in the history
  • Loading branch information
PapyChacal committed Aug 11, 2023
1 parent a3aa779 commit caad210
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions fast/diffusion_3D_wBCs.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,28 +61,28 @@
op = Operator([eq_stencil], name='DevitoOperator', opt=('advanced', {'par-tile': (32,4,8)}))
# Apply the operator for a number of timesteps
op.apply(time=nt, dt=dt, a=nu)
print("Devito Field norm is:", norm(u))
print("Devito Field norm is:", np.linalg.norm(u.data))
if args.plot:
plot_3dfunc(u)

if args.wgpu:
# Reset field
u.data[:, :, :, :] = 0
u.data[:, :, :, int(nz/2)] = 1
xdslop = WGPUOperator([eq_stencil], name='xDSLOperator')
# Apply the xdsl operator for a number of timesteps
xdslop.apply(time=nt, dt=dt, a=nu)
print("XDSL Field norm is:", norm(u))
wgpuop = WGPUOperator([eq_stencil], name='WGPUOperator')
# Apply the wgpu operator for a number of timesteps
wgpuop.apply(time=nt, dt=dt, a=nu)
print("WGPU Field norm is:", np.linalg.norm(u.data))
if args.plot:
plot_3dfunc(u)

if args.xdsl:
# Reset field
u.data[:, :, :, :] = 0
u.data[:, :, :, int(nz/2)] = 1
xdslop = XDSLOperator([eq_stencil], name='xDSLOperator')
wgpuop = XDSLOperator([eq_stencil], name='xDSLOperator')
# Apply the xdsl operator for a number of timesteps
xdslop.apply(time=nt, dt=dt, a=nu)
print("XDSL Field norm is:", norm(u))
wgpuop.apply(time=nt, dt=dt, a=nu)
print("XDSL Field norm is:", np.linalg.norm(u.data))
if args.plot:
plot_3dfunc(u)

0 comments on commit caad210

Please sign in to comment.