-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Hi,
I am currently working on implementing your optimization module (conjugate gradient method) to solve a linear system.
The system that I am trying to solve is, simple 2D Poisson equation. Therefore, left-hand side matrix is a sparse matrix and my goal is to use pylops_distributed to reduce calculation time. (below is code snippets that I am testing)
import numpy as np
from pylops_distributed.optimization.cg import cg
from pylops_distributed.basicoperators import MatrixMult
import pylops_distributed
from pyamg.gallery import poison
Nx = 1024
Ny = 1024
Ntot = Nx * Ny
A = poison((Nx, Ny), format='csr', dtype=np.float64)
n_workers = 4
client, _ = pylops_distributed.utils.backend.dask(n_workers=n_workers,
threads_per_worker=2)
workers = int(np.sqrt(n_workers))
A_da = da.from_array(A, chunks=(Nx//workers, Ny//workers))
A_op = MatrixMult(A_da)
b_da = da.zeros(Ntot, chunks=(Ntot//n_workers))
x = cg(A_op, b_da)
client.close()The problem or question I have is that I cannot have any benefits of using distributed computation.
I am comparing this to scipy.linalg and pyamg libraries and pylops_distributed gives me about 100times slower calculation time.
Also, I observed the smaller the workers, the faster the calculation. Seems like there is a communication overhead.
I just wonder whether this is a known issue or not. (or whether pylops_distrubted is suitable to solve the problem I am tacking or not)
Thank you in advance!
Best regards,
Kyoungseoun Chung