Performance of Parfor Loops

조회 수: 1 (최근 30일)
Lokesh Marisetty
Lokesh Marisetty 2021년 1월 12일
답변: Matt J 2021년 1월 12일
I am performing Monte-calro simulations to evaluate performance of a communication system. I have used parfor loop for 'n' interations. I am providing the pseudo code below. Each of the loop is completely independent.
[config] = config_init();
parfor i = 1: no_iterations
[tx_sig] = transmit(config);
[rx_sig] = channel(tx_sig);
[detect] = recieve(rx_sig);
end
I am using a computer with 8-core processor to run the simulations. I see that the execution speed goes up by only 2 to 3 times when parfor is used.
Why is that the speed doesn't go up by 8 times when 8 workers are used. I greatly appreciate if someone can explain necessary changes required in the code to achieve approximately 8 times ( number of cores) improvement in the speed.
Thanks,
Lokesh

채택된 답변

Matt J
Matt J 2021년 1월 12일
Because even when you use just 1 worker, the Matlab code will to some degree be able to use all 8 cores that you have. To see if the scale up makes sense, you should monitor the usage of the cores in both cases, e.g. with the Task Manager if in Windows.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by