From 7f3b37ef46ed4bce1d9b04a1a4eae92b0251880e Mon Sep 17 00:00:00 2001 From: George Bisbas Date: Wed, 2 Aug 2023 19:34:25 +0300 Subject: [PATCH] mpi: wip --- fast/wave2d.py | 1 - fast/wave3d.py | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/fast/wave2d.py b/fast/wave2d.py index 4d5a7eed5b..9fb0758f9b 100644 --- a/fast/wave2d.py +++ b/fast/wave2d.py @@ -142,7 +142,6 @@ def plot_2dfunc(u): if args.plot: plot_3dfunc(u) -#devito_output = u.data[:] print("After Operator 1: 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])) diff --git a/fast/wave3d.py b/fast/wave3d.py index 1497d3bea2..3a485fb3c7 100644 --- a/fast/wave3d.py +++ b/fast/wave3d.py @@ -93,7 +93,7 @@ def plot_3dfunc(u): # Define the wavefield with the size of the model and the time dimension u = TimeFunction(name="u", grid=model.grid, time_order=to, space_order=so) - +# Another one to clone data u2 = TimeFunction(name="u", grid=model.grid, time_order=to, space_order=so) # We can now write the PDE @@ -111,7 +111,7 @@ def plot_3dfunc(u): # the corresponding code print(time_range) -print("Init norm:", norm(u)) +print("Init norm:", np.linalg.norm(u.data[:])) src_term = src.inject(field=u.forward, expr=src * dt**2 / model.m) op0 = Operator([stencil] + src_term, subs=model.spacing_map, name='SourceDevitoOperator') # Run with source and plot @@ -124,8 +124,8 @@ def plot_3dfunc(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])) - print("Norm of initial data:", np.linalg.norm(u.data[:])) + configuration['mpi'] = 0 u2.data[:] = u.data[:] configuration['mpi'] = 'basic' @@ -139,7 +139,7 @@ def plot_3dfunc(u): plot_3dfunc(u) #devito_output = u.data[:] -print("After Operator 1: Devito norm:", norm(u)) +print("After Operator 1: Devito norm:", np.linalg.norm(u.data[:])) 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])) @@ -150,7 +150,7 @@ def plot_3dfunc(u): configuration['mpi'] = 'basic' #v[:, ..., :] = 1 -print("Reinitialise data: Devito norm:", np.linalg.norm(u.data[:])) +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]))