MATLAB Answers


Parfor hangs during execution

Asked by Andrea Stevanato on 13 Jul 2018
Latest activity Edited by Jayaram Theegala on 16 Jul 2018

How i can solve this problem that freeze parfor during execution?

Operation terminated by user during distcomp.remoteparfor/getCompleteIntervals (line 225)
In parallel_function>distributed_execution (line 823)
        [tags, out] = P.getCompleteIntervals(chunkSize);
In parallel_function (line 590)
      R = distributed_execution(...


That's hard to say. Do you have a random number generator in the software? Perhaps memory usage differs, depending on what other software are running at the same time. There's also a job timing issue going on in the back, which always changes between runs depending on the current jobs a CPU has to run. Also, you could get a deadlock situation randomly, if multiple workers are trying to read/write to the same file at the same time. Are you doing some sort of read/write operation? Deadlocks are issues unique to parallel computing.

I know what is deadlook but there aren't. My code works fine for first 10 iteration and after this hangs execution. Two days ago all works fine, yesterday no. Now I'm looking what are the situation for today.

I'm trying to install previous version of matlab, maybe 2017a/b. I am really disappointed of MATLAB's behavior

Sign in to comment.

2 Answers

Answer by Andrea Stevanato on 16 Jul 2018

It's possible to restart all workers without delete(gcp)?


Sign in to comment.

Answer by Jayaram Theegala on 16 Jul 2018
Edited by Jayaram Theegala on 16 Jul 2018

Hello Andrea,

In order to understand the issue better, can you try reducing the number of iterations on your first loop, by setting "it" variable used in your first "for" loop to 1. Also, it may be helpful to just start your pool with 1 worker, and see if the issue still persists.

If the issue continues to happen even after the above changes, provide the following information:

1) Brief information about the function used within the parfor loop: Algorithms.TeMA.evolution

2) Does the issue happen without the above function?

3) Finally, it is generally advisable for outer-most loop to be parfor and the inner loops being for loops.


Sign in to comment.