13.01.2013 Views

sundialsTB, a Matlab Interface to SUNDIALS - Site Index Page ...

sundialsTB, a Matlab Interface to SUNDIALS - Site Index Page ...

sundialsTB, a Matlab Interface to SUNDIALS - Site Index Page ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

38 end<br />

39<br />

40 cmd slaves = s p r i n t f ( ’ mpiruns ( ’ ’%s ’ ’ ) ’ , f c t s t r ) ;<br />

41<br />

42 i f debug<br />

43 cmd = ’ xterm ’ ;<br />

44 args = { ’−e ’ , ’ matlab ’ , ’−nosplash ’ , ’−nojvm ’ , ’−r ’ , cmd slaves } ;<br />

45 e l s e<br />

46 cmd = ’ matlab ’ ;<br />

47 args = { ’−nosplash ’ , ’−nojvm ’ , ’−r ’ , cmd slaves } ;<br />

48 end<br />

49<br />

50 [ i n f o c h i l d r e n e r r s ] = MPI Comm spawn(cmd , args , nslaves , ’NULL ’ ,0 , ’SELF ’ ) ;<br />

51<br />

52 [ i n f o NEWORLD] = MPI Intercomm merge ( c h i l d r e n , 0 ) ;<br />

53<br />

54 nvm( 1 ,NEWORLD) ;<br />

55 f e v a l ( f c t ,NEWORLD) ;<br />

56 nvm ( 2 ) ;<br />

57<br />

58 LAM Finish ;<br />

Purpose<br />

mpiruns<br />

mpiruns runs the parallel example on a child MATLAB process.<br />

Synopsis<br />

function [] = mpiruns(fct)<br />

Description<br />

mpiruns runs the parallel example on a child MATLAB process.<br />

This function should not be called directly. It is called<br />

by mpirun on the spawned child processes.<br />

Source Code<br />

1 f u n c t i o n [ ] = mpiruns ( f c t )<br />

5<br />

6 % Radu Serban <br />

7 % Copyright ( c ) 2005 , The Regents o f the U n i v e r s i t y o f C a l i f o r n i a .<br />

8 % $Revision$Date$<br />

9<br />

10 [ dum hostname]= system ( ’ hostname ’ ) ;<br />

11 f p r i n t f ( ’ c h i l d MATLAB p r o c e s s on %s \n ’ , hostname ) ;<br />

12<br />

13 MPI Init ;<br />

14<br />

15 MPI Errhandler set ( ’WORLD’ , ’RETURN’ ) ;<br />

16<br />

17 [ i n f o parent ] = MPI Comm get parent ;<br />

18<br />

58

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!