how can i use pcg with Parallel Computing Toolbox ?

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

답변 (1개)

Edric Ellis
Edric Ellis 2020년 7월 22일

1 개 추천

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

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!

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Parallel Computing Fundamentals에 대해 자세히 알아보기

질문:

2020년 7월 21일

댓글:

2020년 9월 2일

Community Treasure Hunt

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

Start Hunting!

Translated by