Parfor loop that was previously working perfectly hanging

7 次查看(过去 30 天)
Hi,
I am not very experienced using parallel programming and am having an issue with a parfor loop. I have been using a routine that was originally written by another researcher, made some tests with their input data and it was all working perfectly fine. Then I made some slight changes to the code, to adapt it to my needs and things were still working. I then made some extra changes and changed the input data and the code started hanging... Looking at RAM usage it seems to be fine. To try to pinpoint the issue, I went back to the initial code and it isn't running well anymore. Could be something to do with driver updates? Or any kind of updates in the computer? I'm using MATLAB 2018b.
If I manually kill the job, it appears to be freezing in line 227 of remoteparfor (see below).
I suspect the issue will be something silly but I can't see what it is. I appreciate any help!
  2 个评论
Edric Ellis
Edric Ellis 2020-10-14
That line is part of the internals of parfor, and is where the desktop MATLAB client session sits waiting for results coming back from your workers. I would recommend perhaps adding disp statements to your parfor loop to help you work out where your workers are getting up to. Or perhaps modify your code so that you force your parfor loop to run on your desktop MATLAB by doing this:
parfor (idx = 1:N, 0) % <-- the 0 means "run locally"
... % do stuff
end
Larissa Perez
Larissa Perez 2020-10-15
Thanks!
I have tried that but still can't figure it out. Ends up I believe it's related to a while loop in one of the functions inside the parfor loop. The while loop includes a function to solve an equation using "eps", but it was never converging. By increasing the tolerance I believe it will run... Let's see...

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Parallel for-Loops (parfor) 的更多信息

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by