From: Carlos R del Blanco on 8 Jul 2010 09:25 Hello, my problem is that I have to plot and print to a file a lot of results. The 90% of the computation time is due to that. So I would like to plot and especially print to file using several core, processors or even computers. I have tried two possibilities that have failed: 1) Using the parallel computing toolbox: the problem is that the workers have no object graphics capabilities, so apparently it is impossible. 2)Using the COM interface to open new Matlab sessions: the problem is that I can put in the server Matlab sessions graphic objects, cell arrays or structures, only matrices and scalars. Therefore, I would have to do major modifications to decompose my cell, and data structures in simple matrices and scalar in order to transmit all the information to the Matlab server session. It seems very tricky and annoying, and in addition, I don't know if it would be very efficient. Has somebody got an idea? Thanks in advance.
From: Edric M Ellis on 8 Jul 2010 11:29 "Carlos R del Blanco" <cda(a)gti.ssr.upm.es> writes: > Hello, my problem is that I have to plot and print to a file a lot of > results. The 90% of the computation time is due to that. So I would > like to plot and especially print to file using several core, > processors or even computers. > > I have tried two possibilities that have failed: > 1) Using the parallel computing toolbox: the problem is that the > workers have no object graphics capabilities, so apparently it is > impossible. Even though Parallel Computing Toolbox workers cannot display graphics on-screen, they can certainly print to file. Do you have an example where things don't work as you'd expect? Cheers, Edric.
From: Carlos R del Blanco on 8 Jul 2010 11:50 Yes, I have problems in printing. For example, I plot a figure in the Matlab client, then I use the saveas function, that internally calls to the print function to plot to a file the figure. For this operation I need the figure handle. Then I obtain this error: ??? Error using ==> parallel_function at 594 Error in ==> saveas at 59 Invalid handle. Specifically the piece of code is: h =imshow(RGB_double); parfor i_h = 1:2 if(i_h == 1) saveas(h, '.\img.jpg'); end if(i_h == 2) saveas(h, '.\img.fig'); end end I can imagine that the graphic object "lives" in the workspace of the Matlab client, so it can be seen by any Matlab worker. Edric M Ellis <eellis(a)mathworks.com> wrote in message <ytwwrt656wz.fsf(a)uk-eellis-deb5-64.mathworks.co.uk>... > "Carlos R del Blanco" <cda(a)gti.ssr.upm.es> writes: > > > Hello, my problem is that I have to plot and print to a file a lot of > > results. The 90% of the computation time is due to that. So I would > > like to plot and especially print to file using several core, > > processors or even computers. > > > > I have tried two possibilities that have failed: > > 1) Using the parallel computing toolbox: the problem is that the > > workers have no object graphics capabilities, so apparently it is > > impossible. > > Even though Parallel Computing Toolbox workers cannot display graphics > on-screen, they can certainly print to file. Do you have an example > where things don't work as you'd expect? > > Cheers, > > Edric.
From: Steven Lord on 8 Jul 2010 14:23 "Carlos R del Blanco" <cda(a)gti.ssr.upm.es> wrote in message news:i14s3d$q4m$1(a)fred.mathworks.com... > Yes, I have problems in printing. For example, I plot a figure in the > Matlab client, then I use the saveas function, that internally calls to > the print function to plot to a file the figure. For this operation I need > the figure handle. Then I obtain this error: > > ??? Error using ==> parallel_function at 594 > Error in ==> saveas at 59 > Invalid handle. > > Specifically the piece of code is: > > h =imshow(RGB_double); This image object is created _by the client session_. > parfor i_h = 1:2 > if(i_h == 1) > saveas(h, '.\img.jpg'); This command is executed _by the worker session._ > end > if(i_h == 2) > saveas(h, '.\img.fig'); > end > end > > I can imagine that the graphic object "lives" in the workspace of the > Matlab client You can think of it that way, yes. >, so it can be seen by any Matlab worker. No. A MATLAB worker is a separate session of MATLAB from the client; if you manually started two sessions of MATLAB on the same machine, would you expect one to have access to the graphics created by the other? You shouldn't. The same goes for the client session and workers. You may be confusing graphics objects with functions; because functions can exist outside MATLAB sessions (as files on disk) they are not tied to any particular MATLAB session and so could be used by client or worker sessions. But graphics objects are created and "owned" by one particular MATLAB session and only last as long as that MATLAB session does -- other MATLAB sessions can't interact with them directly. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
From: Carlos R del Blanco on 8 Jul 2010 15:49
"Steven Lord" <slord(a)mathworks.com> wrote in message <i1552i$epi$1(a)fred.mathworks.com>... > > "Carlos R del Blanco" <cda(a)gti.ssr.upm.es> wrote in message > news:i14s3d$q4m$1(a)fred.mathworks.com... > > Yes, I have problems in printing. For example, I plot a figure in the > > Matlab client, then I use the saveas function, that internally calls to > > the print function to plot to a file the figure. For this operation I need > > the figure handle. Then I obtain this error: > > > > ??? Error using ==> parallel_function at 594 > > Error in ==> saveas at 59 > > Invalid handle. > > > > Specifically the piece of code is: > > > > h =imshow(RGB_double); > > This image object is created _by the client session_. > > > parfor i_h = 1:2 > > if(i_h == 1) > > saveas(h, '.\img.jpg'); > > This command is executed _by the worker session._ > > > end > > if(i_h == 2) > > saveas(h, '.\img.fig'); > > end > > end > > > > I can imagine that the graphic object "lives" in the workspace of the > > Matlab client > > You can think of it that way, yes. > > >, so it can be seen by any Matlab worker. > > No. A MATLAB worker is a separate session of MATLAB from the client; if you > manually started two sessions of MATLAB on the same machine, would you > expect one to have access to the graphics created by the other? You > shouldn't. The same goes for the client session and workers. > > You may be confusing graphics objects with functions; because functions can > exist outside MATLAB sessions (as files on disk) they are not tied to any > particular MATLAB session and so could be used by client or worker sessions. > But graphics objects are created and "owned" by one particular MATLAB > session and only last as long as that MATLAB session does -- other MATLAB > sessions can't interact with them directly. > > -- > Steve Lord > slord(a)mathworks.com > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ > To contact Technical Support use the Contact Us link on > http://www.mathworks.com > Oh, sorry, there was an error, I wanted to say "so it can NOT be seen by any Matlab worker", so of course I agree with you. The question is: can I transfer the graphic object to the worker in order to print it? or, since the workers have not graphics capabilities, does it imply that is totally impossible? |