Workers aborted when saving surf-figures to disk using parfor

1 view (last 30 days)
This code
parfor ii = 1:5
surf(rand(500))
saveas(gcf, ['test_' num2str(ii)], 'eps');
end
causes me the error
>> parfortest
Warning: A worker aborted during execution of the parfor
loop. The parfor loop will now run again on the remaining
workers.
> In parallel_function at 589
In parfortest at 1
Error using parallel_function (line 597)
All workers aborted during execution of the parfor loop.
Error in parfortest (line 1)
parfor ii = 1:5
The client lost connection to lab 2. This might be due to
network problems, or the interactive communicating job
might have errored.
The error occurs only for surfaces above a certain dimension (e.g. surf(rand(5)) is fine). Other 3D-plot as trisurf or plot3 are affected as well while 2D-plots like plot or hist seem to be no problem.
Running this code with R2013b on Mac OS 10.9.3 on a Intel Core 2 Duo

Accepted Answer

Edric Ellis
Edric Ellis on 23 Sep 2014
Edited: Edric Ellis on 6 Jan 2015
Unfortunately this is likely to be caused by a known bug, the report is here: http://www.mathworks.co.uk/support/bugreports/253188 (I know this refers to 'pcolor' - it's likely that surf has the same problem). Unfortunately, the workaround is not applicable in your case because workers always run '-nodisplay'.
Note that the bug should be fixed in R2014b.

More Answers (2)

Corbin Wilhelmi
Corbin Wilhelmi on 24 Nov 2014
In order to avoid duplicate posts, I have run across this issue as well using 2014b which, according to Edric's link, the bug was reportedly fixed. I am running a simulation with ~140K iterations. The program will go through a couple hundred and then give a very similar error to the one above. Below is psuedocode for what I am doing. Please note that many are embedded functions and I will try to explain as simply as I can...
-------
Load various .mat files parpool(5) %Create parallel pool on 5 cores.
parfor 1:length(someVariable)
[out1 out2] = function1(in1, in2, in3)
end %End parfor loop
-------
FUNCTION 1 EXPLAINED:
figure; axis([0 1 0 1 0 1]) %Open figure and set axis for three dimensions
set(gcf,'Visible','off') %Hide figure, similar to -nosplash
variable = function2(in1) %This function loads a .mat file, does nothing else.
for i = 1:size(someVariable,2) %Size of some variable across columns
Do these operations
end
for i = 1:size(someVariable,1) %Size of some variable across rows
fill3(attributes) %Creates 3 dimensional solid figures
end
function3(in1, in2) %Saves the figure, nothing more
end
%End of Function1
-------
Because of using eval(['...']) commands, those have to be in separate functions. I don't know if this is just a work around but it seems to do the job for me. If anyone would like to try and duplicate this error please send me your email and I will send you the pertinent files. For completeness sake: I am running MATLAB 2014b on 64bit Ubuntu (14 I think) with hex core i7, 64gb ram.
Am I looking at a similar error as above but using fill3 instead of pcolor as stated in the error report?
Thanks in advance for your help and consideration.
Best
Corbin
  2 Comments
rico
rico on 25 Nov 2014
Unfortunately, I can't help with your problem. But it might be useful to know that for me, the bug was actually fixed in R2014b. Since I updated, the error does no longer occur.
Corbin Wilhelmi
Corbin Wilhelmi on 25 Nov 2014
I think it might be a new bug that is related to the one you came across, I'm emailing Edric the information and files today.

Sign in to comment.


Ao
Ao on 6 Jan 2015
Edited: Ao on 6 Jan 2015
I also encountered the same error when using Matlab r2014a. However, if I chose to save the figures as .fig instead of .eps or other file types, it is indeed workable. I am still searching for a solution of how to save the pictures as the type I want.
If you have already solved the problem, please kindly let me know the solution. Thank you very much!
  2 Comments
Edric Ellis
Edric Ellis on 6 Jan 2015
If you are able to use R2014b, the bug should be fixed there.
Ao
Ao on 16 Jan 2015
Thank you very much! I have upgraded to R2014b, and now it is workable.

Sign in to comment.

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!