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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4.2 Parallel utilities<br />

Purpose<br />

mpirun runs parallel examples.<br />

Synopsis<br />

function [] = mpirun(fct,npe,dbg)<br />

Description<br />

mpirun runs parallel examples.<br />

Usage: mpirun ( FCT , NPE [, DBG] )<br />

mpirun<br />

FCT - name (or handle) of the function <strong>to</strong> be executed on all MATLAB<br />

processes.<br />

NPE - number of processes <strong>to</strong> be used (including the master).<br />

DBG - flag for debugging. If true, spawn MATLAB child processes<br />

with a visible xterm. (default DBG=false)<br />

Source Code<br />

1 f u n c t i o n [ ] = mpirun ( f c t , npe , dbg )<br />

11<br />

12 % Radu Serban <br />

13 % 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 />

14 % $Revision$Date$<br />

15<br />

16 ih = i s a ( f c t , ’ f u n c t i o n h a n d l e ’ ) ;<br />

17 i s = i s a ( f c t , ’ char ’ ) ;<br />

18 i f ih<br />

19 sh = f u n c t i o n s ( f c t ) ;<br />

20 f c t s t r = sh . f u n c t i o n ;<br />

21 e l s e i f i s<br />

22 f c t s t r = f c t ;<br />

23 e l s e<br />

24 e r r o r ( ’ mpirun : : Unrecognized f u n c t i o n ’ ) ;<br />

25 end<br />

26<br />

27 i f e x i s t ( f c t s t r ) ˜= 2<br />

28 err msg = s p r i n t f ( ’ mpirun : : Function %s not in search path . ’ , f c t s t r ) ;<br />

29 e r r o r ( err msg ) ;<br />

30 end<br />

31<br />

32 n s l a v e s = npe −1;<br />

33 LAM Start ( n s l a v e s ) ;<br />

34<br />

35 debug = f a l s e ;<br />

36 i f ( nargin > 2) & dbg<br />

37 debug = true ;<br />

57

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

Saved successfully!

Ooh no, something went wrong!