Why does "parfor" freeze when working with very large files?
Show older comments
I have a MATLAB script with a "parfor" loop with the following structure:
- A struct array variable is loaded into MATLAB with large amounts of data.
- "parfor" loop iterates from 1 to N, where N is the length of the array. The data is sent from MATLAB to the workers (communication overhead).
- Some function is performed on the array element inside the "parfor" loop, the result is saved into a pre-allocated cell array, using data queue to send data from worker to the client.
- "parfor" loop finishes.
- Cell array is converted into a struct array.
When my "parfor" reaches around 75%, it is stuck for about 2 minutes without progress. Then it continues to work as normal. I am using around 1 GB of data, which after the "parfor" is about 13 GB in size. My RAM is 32 GB, so it should not be an issue.
If I rerun my script, it freezes at the same time. Why is "parfor" hanging at that point?
Accepted Answer
More Answers (0)
Categories
Find more on Parallel for-Loops (parfor) in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!