MATLAB Answers

how can i use pcg with Parallel Computing Toolbox ?

1 ビュー (過去 30 日間)
ROSALBA CACCIAPUOTI
ROSALBA CACCIAPUOTI 2020 年 7 月 21 日
Hi MATLAB community,
I know that function pcg is supported in the Parallel Computing Toolbox for use in data parallel computations with distributed arrays, i am using a HPC architecture that it's made of 8 nodes, each blade consists of 2 quadcore processors sharing memory for a total of 8 cores and of 64 cores, in total. I run pcg on 1 core and pcg with distributed arrays on 32 cores.
tic
[y]=pcg(A,b,[],100); %first case
toc
A=distributed(A);
b=distributed(b);
tic
[x,flagCG_1,iter] = pcg(@(x)gather(A*x),b,[],100); %second case on 32 cores
toc
i obtained that
Elapsed time is 0.001279 seconds. %first case
Elapsed time is 0.316632 seconds. %second case on 32 cores
why the time in second case is greater than the time in first case? what am I doing wrong ?
Thanks for your help

  0 件のコメント

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

回答 (1 件)

Edric Ellis
Edric Ellis 2020 年 7 月 22 日
Simply: this problem is far too small for distributed arrays to be effective. You should use distributed arrays only for problems that do not fit into the memory of a single machine. All distributed array algorithms must perform inter-process communication to operate, and that is much less efficient than having all the data stored on a single machine.

  1 件のコメント

ROSALBA CACCIAPUOTI
ROSALBA CACCIAPUOTI 2020 年 9 月 2 日
thank you Edric, i tried with larger size matrices but the time in second case is always greater than the time in first case, i probably don't use pcg correctly for distributed arrays. Can you help me? maybe with an example that makes me understand how to use pcg with distributed arrays to have a gain in terms of execution time.
thank you so much!

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

Community Treasure Hunt

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

Start Hunting!

Translated by