Skip to content

Commit

Permalink
Get scripts WGPU+MacOS ready
Browse files Browse the repository at this point in the history
  • Loading branch information
PapyChacal committed Aug 11, 2023
1 parent 5704c4f commit 38bf444
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 312 deletions.
6 changes: 3 additions & 3 deletions fast/diffusion_2D_wBCs.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@
if args.devito:
op = Operator([eq_stencil], name='DevitoOperator', opt=('advanced', {'par-tile': (32,4,8)}))
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_2dfunc(u)

if args.wgpu:
op = WGPUOperator([eq_stencil], name='WGPUOperator', opt=('advanced', {'par-tile': (32,4,8)}))
op.apply(time=nt, dt=dt, a=nu)
print("WGPU Field norm is:", norm(u))
print("WGPU Field norm is:", np.linalg.norm(u.data))

if args.plot:
plot_2dfunc(u)
Expand All @@ -77,4 +77,4 @@
if args.xdsl:
xdslop = XDSLOperator([eq_stencil], name='XDSLOperator')
xdslop.apply(time=nt, dt=dt, a=nu)
print("XDSL Field norm is:", norm(u))
print("XDSL Field norm is:", np.linalg.norm(u.data))
158 changes: 0 additions & 158 deletions fast/wave2d.py

This file was deleted.

20 changes: 20 additions & 0 deletions fast/wave2d_b.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from devito import (TimeFunction, Eq, Operator, solve, norm,
XDSLOperator, configuration, Grid)
from devito.operator.wgpu_operator import WGPUOperator
from examples.seismic import RickerSource
from examples.seismic import Model, TimeAxis, plot_image
from fast.bench_utils import plot_2dfunc
Expand All @@ -29,6 +30,7 @@
parser.add_argument("-plot", "--plot", default=False, type=bool, help="Plot2D")
parser.add_argument("-devito", "--devito", default=False, type=bool, help="Devito run")
parser.add_argument("-xdsl", "--xdsl", default=False, type=bool, help="xDSL run")
parser.add_argument("-wgpu", "--wgpu", default=False, type=bool, help="xDSL run")
args = parser.parse_args()


Expand Down Expand Up @@ -108,6 +110,24 @@
# print("Devito linalg norm 1:", np.linalg.norm(u.data[1]))
# print("Devito linalg norm 2:", np.linalg.norm(u.data[2]))

if args.wgpu:
# Run more with no sources now (Not supported in xdsl)
# op1 = Operator([stencil], name='DevitoOperator', subs=grid.spacing_map)
op1 = WGPUOperator([stencil], name='WGPUOperator')
op1.apply(time=nt, dt=dt)

configuration['mpi'] = 0
ub.data[:] = u.data[:]
configuration['mpi'] = mpiconf

if len(shape) == 2 and args.plot:
plot_2dfunc(u)

print("Devito norm:", norm(u))
# print("Devito linalg norm 0:", np.linalg.norm(u.data[0]))
# print("Devito linalg norm 1:", np.linalg.norm(u.data[1]))
# print("Devito linalg norm 2:", np.linalg.norm(u.data[2]))


if args.xdsl:
# print("Reinitialise data: Devito norm:", norm(u))
Expand Down
148 changes: 0 additions & 148 deletions fast/wave3d.py

This file was deleted.

Loading

0 comments on commit 38bf444

Please sign in to comment.