There is no way to do shared memory automatically in a parfor loop. However, depending on where the data is located - there may be options. For instance, if the data is coming from a file - memory mapping may work well. Look at the function memmapfile.
sharing matrix in parfor
3 次查看(过去 30 天)
显示 更早的评论
I have a program which uses the parfor loop and contains a large matrix (2-3GB). Each worker continuously access random locations in the matrix, but never write to the matrix. When using parfor the matrix is copied for each worker causing a massive memory spike. Is there a way to prevent this and allow each worker to read from the same matrix?
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!