Printing figures within parfor

The following is a piece of a email dialog I had with one of the matlab engineers:

Hello Art,

Thanks for your descriptive email. I have some questions/suggestions regarding your email

1. Regarding the 1st problem, I am curious to know why you would want to create an image on a worker. As most of our examples portray, we should perform all the calculations at the worker and then retrieve the result to the client in order to plot it. Is there any special reason you wish to plot at the worker?

Well, there are a couple of scenarios. The one in particular that triggered this question is that I am trying to make a movie. The processing that goes into making each frame takes ~3 seconds and I have about 25,000 frames (in this dataset, some are larger). So we are talking about 21 hours of computation (not including rendering). I figured if I could break that across multiple processors it would be very handy way to speed it up. I used to do this with a matlab movie object, and in fact, in this particular case, now that I think about it, if I can return a handle from "getframe" within parfor that approach might work, but I would still be plotting within parfor (and I might run out of memory). But in general I would like to figure out how to do this with jpgs because we are migrating to XP64 and we have not been able to get AVIs to work with matlab on the 64 bit platform, so going to jpg is I think the only option (plus, the renderers we use are multithreaded so we get a big performance gain relative to movie2avi).

The other scenario is just wanting to make a lot of figures. For example, take a look at one of the web sites I maintain: http://ice.rsmas.miami.edu/telemetry_archive/index.html Here you will find, for each day, six plots of spacecraft telemetry. This is all fully automated, so that once per day the data from the previous day are loaded, processed, and plotted (all in matlab). In this case, the plotting is fast, but the processing of the raw data takes a few minutes per plot. So for each day it might take 10 minutes or so end to end to go from raw data file to web page of plots for that day. When it is running day to day like that it is no problem: 10 minutes is OK with me. The problem comes when say I need to re-process the entire dataset (maybe someone wants a new figure added or another variable or whatever). Then we are talking 10 years * 365 days * 10 minutes = approx 600 hours to run (I have done it a few times). It would be nice to do that in parallel since each day is totally independent.


Return to printing within parfor problem

Return to MATLAB PCT notes

Return to Art Gleason Home

Last Updated: May 2008