how can i use pcg with Parallel Computing Toolbox ?
조회 수: 1 (최근 30일)
이전 댓글 표시
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
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.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!