MATLAB Answers

How to speed up huge matrix mldivide?

17 ビュー (過去 30 日間)
zawye aung
zawye aung 2020 年 6 月 6 日
コメント済み: zawye aung 2020 年 8 月 18 日
How to speed up huge matrix mldivide? I was solved this matrix on single core but it took too long. So, i was used distributed array using parallel computing tool box, but i didn't get speed up. Using distributed array took too long than single core. How to speed up solution.

  3 件のコメント

James Tursa
James Tursa 2020 年 6 月 6 日
How large? Are there any special features of the matrix such as sparsity or symmetry or patterns?
zawye aung
zawye aung 2020 年 6 月 6 日
n = 5000; M = rand(n); x = ones(n,1);
tic
u = M\x;
clear A b
disp(['Time to solve on single core = ' num2str(toc)])
% parallel operations in spmd
tic
spmd
m = codistributed(M, codistributor('1d',2)); % by column
y = codistributed(x, codistributor('1d',1)); % by row
v = m\y;
end
disp(['Time to solve on 4 core = ' num2str(toc)])
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Time to solve on single core = 2.4375
Time to solve on 4 core = 4.4646
zawye aung
zawye aung 2020 年 6 月 6 日
This is a sample coding. And another problem i has. The huge matrix size hurts memory. If run the program using huge matrix with codistributed array in SPMD, the Matlab software is delay because of full of memory.

サインインしてコメントする。

採用された回答

Edric Ellis
Edric Ellis 2020 年 6 月 8 日
distributed arrays on a single machine will generally perform worse than normal arrays - this is because the standard MATLAB mldivide is already intrinsically multithreaded.
If you have access to a capable GPU, and your problem fits in the memory of the GPU, this might be a good option. See this example which compares mldivide performance on the CPU and GPU.

  1 件のコメント

zawye aung
zawye aung 2020 年 8 月 18 日
Thank you! For your suggestion. I really appreciated that. I had already build MJS cluster, so i executed the mldivide fun, but i didn't get speed up. If i use more core, the program more take time. Any suggestion or guidence.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by