Writing error in parfor loop
显示 更早的评论
Hi everyone,
I have a script that randomly removes and repredicts links in networks 100 times. Of course the bigger the networks are the longer it takes so, I made the 100 iterations into a parfor loop. It works fine for smaller networks but with the big ones I get the error
A write error occurred while sending to worker xy.
I assumed its due to memory problems but I can check in the task manager that the error occurs before the memory of my pc is used up. Also it says writing error...So does anybody have an idea what this error message refers to? Im using windows 7 pro, 64bit and matlab R2014a and I have 196GB of ram(I know quite a lot (:).
Any help would be appreciated! Thanks a lot, Josephine
3 个评论
Adam
2015-6-5
Is your memory anywhere close to being used up when the error occurs? It may be that it tries to allocate a large chunk of memory and fails so it wouldn't just allocate up to what is available and then crash.
I imagine you'd need to show some code to get a better idea though. It is hard to get an idea of how much has to be copied to each of the workers from just what you say. If it is a lot then remember that memory allocation is effectively multiplied by how many workers you have if some large amount of data must be copied to all workers.
I have been caught out by this numerous times. What seems like not an excessive memory requirement suddenly explodes when it needs to be assigned to 8 parallel cores when I got my code slightly wrong so that it was copying more than it needed to to each worker.
J T
2015-6-5
J T
2015-6-5
回答(2 个)
Thomas Koelen
2015-6-5
0 个投票
Try writing a function that writes the data, then call this function in your parfor loop.
Walter Roberson
2015-6-5
0 个投票
The data needs to be transferred to even the one worker so Yes you can run out of memory even with one worker.
2 个评论
J T
2015-6-8
Walter Roberson
2015-6-8
The documentation is the File Exchange Contribution page and the code itself which is there. It works using handle objects.
There is one part of it that invokes "spmd" as part of the initialization. That suggests that you should open your parfor pool first before using the worker object wrapper.
类别
在 帮助中心 和 File Exchange 中查找有关 Parallel for-Loops (parfor) 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!