Could `distributed array` accelerate the speed of solving Linear Equations with Iterative Methods?
1 view (last 30 days)
Show older comments
I am using Iterative Methods, like preconditioned conjugate gradients to solve large sparse linear equations(800,000*800,000). I am glad to find that the distributed array could use parallel methods to achieve this. I think this may be faster. However, in my test data. The distributed array is always slower than the normal sparse matrix. (200 VS 50 seconds). Is this normal? what is the advantages of distributed array to solve the sparse linear equations? My part code is like below. Did I miss some steps for distributed array?
% A is a sparse large matrix ,800,000*800,000 size
% b is the right vector of the equations, 800,000*1 size
Adist = distributed(A);
bdist = distributed(b);
M = ichol(A, struct('type','ict','droptol',1e-3));
[xPCG1,flagPCG1,relresPCG1,iterPCG1,resvecPCG1]=pcg(Adist,bdist,tol,maxit,M,M'); % about 200s
[xPCG2,flagPCG2,relresPCG2,iterPCG22,resvecPCG2]=pcg(A,b,tol,maxit,M,M');% about 50s
0 Comments
Accepted Answer
Oli Tissot
on 13 Aug 2020
This is somehow expected: distributed arrays are not meant to increase the speed of execution but to be used for arrays that are so large that they don't fit in the memory of a single computer. The extra cost for communication makes operations on them slower than on regular arrays most of the time. Instead of getting a 'OutOfMemory' error distributed arrays will allow you to run the computation, but you have to keep in mind that this computation is probably quite complex so it is going to take some time.
If you want to accelerate your computation, you may try to use gpuArray instead. Also the efficiency of pcg depends on the preconditioner so you may try to play around with the parameters of ichol ('type' and 'droptol') to find a better preconditioner for your problem.
0 Comments
More Answers (0)
See Also
Categories
Find more on Sparse Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!