Memory grows using parallel
显示 更早的评论
Hi, It's my first approach to the parallel computing, and I wrote a matlab code to take advantage this feature in Matlab. My problem is that the memory usage during the parallel run (using a parfor call) grows until I get an out of memory error.
My code is something like:
DATA=rand(1000,1000);
for k=1:1000
A=DATA(k,:);
B=DATA(k,:);
parfor i=1:100 do_something; end
end
I tried to clear out all the unused variables and pass to the function inside the parfor only the necessary part of data to ensure the smallest overhead, but it seems that in some way the code occupy even more memory for each run. Furthermore the whos output during each run didn't reveal the puzzle (all the variables have the same size).
Any ideas/suggestions to help me solve the problem?
Regards d
5 个评论
Benjamin Thompson
2022-10-24
You example is incomplete and does not work since the size of DATA is 100 by 100 and you are trying to access the 1000th row of DATA in the outer for loop.
DavidePiccinini
2022-10-24
Benjamin Thompson
2022-10-24
We cannot reproduce your problem unless you define what "do_something" is doing.
DavidePiccinini
2022-10-25
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Large Files and Big Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!