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);
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.