I am running simulations in parallel using parfor in Matlab and recently I noticed that close to the end of the simulation it is slowing down.
Trying to understand what can be the reason, I have collected information about the simulation progress over time and have noticed that near the end of the simulation only few workers are running and processing tasks, while it is not clear where are the others. Attached to the message you will find the log file with information about simulation progress from my machine (Windows 10, Matlab 2018b, 4 cores - 8 threads). You can see there that the last 13 tasks were processed by only 2 (out of 8) workers. The following code were used to get the worker ID:
workerID = get(getCurrentTask(),'ID');
I would appreciate, if you could help me understand what is the reason for such behaviour and how to improve it.
Originally, I was trying to run 8 workers, while the pc has 4 cores (intel i7 processor) and should support 8 threads.
Another log for run with 4 workers was attached to the message later.