Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
75c815b
inital-example
astroC86 Jun 29, 2025
908d4b9
Merge remote-tracking branch 'origin/main' into actual-SUMMA
astroC86 Jun 29, 2025
069e5dd
working simple example
astroC86 Jun 29, 2025
5fcbad3
untransformed C
astroC86 Jun 29, 2025
d8d9463
Initial impl of SUMMA matmul
astroC86 Jun 29, 2025
a9e679e
matmul with padding
astroC86 Jun 29, 2025
8142d44
impl adjoint
astroC86 Jul 13, 2025
7363431
cleanedup adjoint impl
astroC86 Jul 13, 2025
4a94ac6
merge and new example
astroC86 Jul 13, 2025
dc00226
added handling for padding
astroC86 Jul 13, 2025
58d3ceb
Cleanup
astroC86 Jul 14, 2025
1ef09ab
converted Bcast into bcast
astroC86 Jul 23, 2025
56e9414
Added docstring
astroC86 Jul 23, 2025
f3d1918
removed block distribute function
astroC86 Jul 23, 2025
9d36b0c
removed unnecessary check on local matrix A
astroC86 Jul 23, 2025
66e3296
Added Generic MatMulOp with docstring
astroC86 Jul 23, 2025
fa07ae8
Merge branch 'PyLops:main' into actual-SUMMA
astroC86 Jul 23, 2025
0956e7b
Converted it to a function
astroC86 Jul 24, 2025
b053f5b
Added SUMMA tests and fixed dtype problem
astroC86 Jul 26, 2025
8851e05
Added documentation and example explination
astroC86 Jul 27, 2025
531873f
Fixed block_gather fn
astroC86 Jul 27, 2025
75900a7
Fixed np to ncp in forward and backward
astroC86 Jul 27, 2025
0c5cb7e
consistancy
astroC86 Jul 27, 2025
302bd4b
Merge branch 'main' into actual-SUMMA
astroC86 Jul 29, 2025
f9c0ca5
minor: clean-up of docstrings and code
mrava87 Jul 31, 2025
3738a06
minor: removed empty first line in MatrixMult
mrava87 Jul 31, 2025
9c04583
feat: ensure y arrays are created on same engine as x
mrava87 Jul 31, 2025
186af3a
fix: Fixed failing test
astroC86 Jul 31, 2025
25f30bc
minor: minor docstring edits
astroC86 Jul 31, 2025
256b98e
Merge branch 'main' into actual-SUMMA
mrava87 Sep 5, 2025
7939587
minor: doc update with MPIMatrixMult
mrava87 Sep 5, 2025
5155186
Fix flake issue
astroC86 Sep 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions examples/plot_summamatrixmult.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import math
import numpy as np
from mpi4py import MPI

import pylops_mpi
from pylops_mpi.basicoperators.MatrixMult import (local_block_spit,
block_gather,
MPISummaMatrixMult)

comm = MPI.COMM_WORLD
rank = comm.Get_rank()
size = comm.Get_size()

N = 9
M = 9
K = 9

A_shape = (N, K)
B_shape = (K, M)
C_shape = (N, M)

p_prime = math.isqrt(size)
assert p_prime * p_prime == size, "Number of processes must be a perfect square"

A_data = np.arange(int(A_shape[0] * A_shape[1])).reshape(A_shape)
B_data = np.arange(int(B_shape[0] * B_shape[1])).reshape(B_shape)

A_slice = local_block_spit(A_shape, rank, comm)
B_slice = local_block_spit(B_shape, rank, comm)
A_local = A_data[A_slice]
B_local = B_data[B_slice]
# A_local, (N_new, K_new) = block_distribute(A_data,rank, comm)
# B_local, (K_new, M_new) = block_distribute(B_data,rank, comm)

B_dist = pylops_mpi.DistributedArray(global_shape=(K * M),
local_shapes=comm.allgather(B_local.shape[0] * B_local.shape[1]),
base_comm=comm,
partition=pylops_mpi.Partition.SCATTER)
B_dist.local_array[:] = B_local.flatten()

Aop = MPISummaMatrixMult(A_local, M, base_comm=comm)
C_dist = Aop @ B_dist
Z_dist = Aop.H @ C_dist

C = block_gather(C_dist, (N,M), (N,M), comm)
Z = block_gather(Z_dist, (K,M), (K,M), comm)
if rank == 0 :
C_correct = np.allclose(A_data @ B_data, C)
print("C expected: ", C_correct)
if not C_correct:
print("expected:\n", A_data @ B_data)
print("calculated:\n",C)

Z_correct = np.allclose((A_data.T.dot((A_data @ B_data).conj())).conj(), Z.astype(np.int32))
print("Z expected: ", Z_correct)
if not Z_correct:
print("expected:\n", (A_data.T.dot((A_data @ B_data).conj())).conj())
print("calculated:\n", Z.astype(np.int32))
Loading
Loading