how can i use pcg with Parallel Computing Toolbox ?

1 view (last 30 days)
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

Answers (1)

Edric Ellis
Edric Ellis on 22 Jul 2020
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 Comment
ROSALBA CACCIAPUOTI
ROSALBA CACCIAPUOTI on 2 Sep 2020
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!

Sign in to comment.

Categories

Find more on MATLAB Parallel Server 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!