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.

107<br />

108 emptyflag = f a l s e ;<br />

109 i f isempty (LNO)<br />

110 % t h i s shouldn ’ t happen<br />

111 emptyflag=true ;<br />

112 % i t ’ s MATLAB’ s f a u l t I think<br />

113 f p r i n t f ( ’ pushing stubborn MATLAB ” system ” c a l l ( lamnodes ) : ’ ) ;<br />

114 end<br />

115<br />

116 while isempty (LNO) | | s t a t<br />

117 f p r i n t f ( ’ . ’ ) ;<br />

118 [ stat , LNO] = system ( ’ lamnodes ’ ) ;<br />

119 end<br />

120 i f emptyflag<br />

121 f p r i n t f ( ’ \n ’ ) ;<br />

122 end<br />

123<br />

124 LF = char ( 1 0 ) ;<br />

125 LNO = s p l i t (LNO, LF ) ; % s p l i t l i n e s in rows at \n<br />

126<br />

127 [ stat , NHL] = system ( ’ lamnodes | wc −l ’ ) ; % Number o f Hosts in Lamnodes<br />

128<br />

129 emptyflag = f a l s e ; % again ,<br />

130 i f isempty (NHL) % t h i s shouldn ’ t happen<br />

131 emptyflag=true ; % i t ’ s MATLAB’ s f a u l t I think<br />

132 f p r i n t f ( ’ pushing stubborn MATLAB ” system ” c a l l ( lamnodes | wc ) : ’ ) ;<br />

133 end<br />

134 while isempty (NHL) | | s t a t<br />

135 f p r i n t f ( ’ . ’ ) ;<br />

136 [ stat , NHL] = system ( ’ lamnodes | wc −l ’ ) ;<br />

137 end<br />

138 i f emptyflag<br />

139 f p r i n t f ( ’ \n ’ ) ;<br />

140 end<br />

141<br />

142 NHL = str2num (NHL) ;<br />

143 i f NHL ˜= s i z e (LNO, 1 ) | | ˜ NHL>0 % Oh my, l o g i c e r r o r<br />

144 NHL= 0 ; % pretend t h e r e are no nodes<br />

145 disp ( ’ LAM Init : i n t e r n a l l o g i c e r r o r : lamboot ’ )<br />

146 end % <strong>to</strong> f o r c e lamboot w/o lamhalt<br />

147 i f isempty ( f i n d s t r (LNO( end , : ) , ’ t h i s n o d e ’ ) ) % master computer l a s t in l i s t<br />

148 disp ( ’ LAM Init : l o c a l host i s not l a s t in n o d e l i s t , hope that ’ ’ s r i g h t ’ )<br />

149 b e f o r e f l a g =0;<br />

150 f o r i =1: s i z e (LNO, 1 )<br />

151 i f ˜ isempty ( f i n d s t r (LNO( i , : ) , ’ t h i s n o d e ’ ) )<br />

152 b e f o r e f l a g =1;<br />

153 break ; % well , not 1 s t but i t ’ s t h e r e<br />

154 end<br />

155 end % we a l r e a d y warned the user<br />

156 i f ˜ b e f o r e f l a g % Oh my, i n c r e d i b l e , not t h e r e<br />

157 NHL= 0 ; % pretend t h e r e are no nodes<br />

158 disp ( ’ LAM Init : l o c a l host not in LAM? lamboot ’ )<br />

159 end<br />

160 end % <strong>to</strong> f o r c e lamboot w/o lamhalt<br />

62

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

Saved successfully!

Ooh no, something went wrong!