sharing matrix in parfor

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?

답변 (1개)

Sarah Wait Zaranek
Sarah Wait Zaranek 2012년 9월 14일

1 개 추천

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.

카테고리

도움말 센터File Exchange에서 Parallel for-Loops (parfor)에 대해 자세히 알아보기

질문:

2012년 6월 30일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by