Parallel Implementation of Jacobi Method
Show older comments
Good morning to everyone,
I am trying to implement a parallel version of the Jacobi method for solving systems of linear equations in MATLAB through the tools offered by the Parallel Computing Toolbox, specifically distributed arrays and functions with built-in multithreading support.
In the attachments, you find the script I wrote, whose interface emulates the one of the MATLAB pcg function.
While testing it out on my PC (with an Intel Core i7 12 gen and 16 Gbs of RAM), pjm resulted extremely slow, featuring an execution time of several minutes for solving a system with a few thousands equations and unknwons.
The coefficient matrix and the right-hand side of the test system were
A = distributed(gallery('poisson',50));
b = sum(A,2);
with an expected solution equals to
xExact = ones(2500,1,'distributed');
I suspect there is some bottleneck in my code but I can't figure it out; the implemetation of the method seems me mathematically correct.
I guess the function is wasting time in checking if the method diverges at each iteration, but I do not want to limit the execution of the functions to systems that will always converge to the exact solution for the Jacobi method. Another expensive computation might be the computation of the residual error throughout the whole algorithm, but I want to provide the user with this type of information.
Again, the function has to behave the same way pcg does.
I'll appreciate some related feedback and I thank you in advance for any effort you'll put in figuring out this problem.
Accepted Answer
More Answers (0)
Categories
Find more on Distributed Arrays 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!