MATLAB: Does “parfor” freeze when working with very large files

dataqueuefreezehanghangingMATLABParallel Computing Toolboxparforrangepartitionmethodsendsubrangesize

Best Answer

The pause issue may be due to the workers sending big messages (e.g. 1 GB+) to the MATLAB client.
The recommendation for this workload is to continue to use "parforOptions" to set the interval size to a fixed number. A fixed range 100 may behave better than a setting of "auto". We believe that you can see better performance if the range is started at 100 and you iteratively test larger ranges until performance stops increasing.
Your code should look approximately like the following code.
opts = parforOptions(p,'RangePartitionMethod','fixed','SubrangeSize',100);
parfor (ii=1:1:t_n_1,opts)
CellArray{ii} = OurFunction();
send(q, ii);
end