<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Hi Ketan,</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">
I have a test which can confirm the same behavior you are seeing, which I think is a bug.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">
For now, I have a tested piece of code which forces the three foreach loops into sequence:</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Hope this helps:</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">
<br></div><div class="gmail_default"><div class="gmail_default"><font face="arial, helvetica, sans-serif">iterate loop_count {</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"> switch (loop_count)<span class="" style="white-space:pre"> </span>{</font></div>
<div class="gmail_default"><font face="arial, helvetica, sans-serif"> case 0:</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"> foreach i in [0:3]{</font></div><div class="gmail_default">
<font face="arial, helvetica, sans-serif"> outfileA[i] = A ("astring");</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"> art[i]=i;</font></div><div class="gmail_default">
<font face="arial, helvetica, sans-serif"> }</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"> </font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"> case 1:</font></div>
<div class="gmail_default"><font face="arial, helvetica, sans-serif"> foreach j in [0:3]{</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"> outfileB[j] = B ("bstring");</font></div>
<div class="gmail_default"><font face="arial, helvetica, sans-serif"> }</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"> default:</font></div>
<div class="gmail_default"><font face="arial, helvetica, sans-serif"><span class="" style="white-space:pre"> </span>tracef("Reached end loop_count:%i \n", loop_count);</font></div><div class="gmail_default"><font face="arial, helvetica, sans-serif"> }</font></div>
<div class="gmail_default"><font face="arial, helvetica, sans-serif">} until (loop_count == 2);</font></div></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">
Thanks,</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">-Yadu</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Sep 20, 2013 at 2:08 PM, Ketan Maheshwari <span dir="ltr"><<a href="mailto:ketancmaheshwari@gmail.com" target="_blank">ketancmaheshwari@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hi,<br><br></div>I am working with APS user Hemant Sharma (in CC) on one of his projects. Hemant wrote a Swift script which has about three foreach invocations which he wants to run one after other.<br>
<br></div>In order to achieve this coordination, Hemant is using an int[] in one loop which is passed as input to the app call of another loop. He observes that the coordination is not maintained and both app calls happen simultaneously resulting in application error. <br>
<br></div>Here is a quick reproduction I tried and I observe indeed that coordination is not happening:<br><br>$ cat dummy.swift<br>type file;<br><br>app (file out) A (string in1){<br> dummyA in1 stdout=@out;<br>}<br><br>
app (file out) B (string in1, int[] _art){<br> dummyB in1 stdout=@out;<br>}<br><br>file outfileA[]<simple_mapper; location="outdir", prefix="a.",suffix=".out">;<br>file outfileB[]<simple_mapper; location="outdir", prefix="b.",suffix=".out">;<br>
<br>int art[];<br>foreach i in [0:3]{<br> outfileA[i] = A ("astring");<br> art[i]=i;<br> }<br><br>foreach j in [0:3]{<br> outfileB[j] = B ("bstring", art);<br> }<br clear="all"><div><div><div><div><br>
</div><div>Since the art array is wholly required in app B, one would expect the first foreach to finish befor the call to B gets invoked. This is not happening in my simple test where I ask the executable called by A to sleep for 5 sec and that called by B to print timestamp and quit.<br>
<br></div><div>I see in the resulting files that the timestamps in B precede those in A.<br><br></div><div>This looks like a bug to me. Swift is 0.94 swift-r7091 cog-r3789.<br></div><div><br></div><div>Thanks,<span class="HOEnZb"><font color="#888888"><br>
</font></span></div><span class="HOEnZb"><font color="#888888"><div>
-- <br><font face="'courier new', monospace">Ketan</font><br><br>
</div></font></span></div></div></div></div>
<br>_______________________________________________<br>
Swift-user mailing list<br>
<a href="mailto:Swift-user@ci.uchicago.edu">Swift-user@ci.uchicago.edu</a><br>
<a href="https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user" target="_blank">https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br>
<div dir="ltr">Yadu Nand B<div><br></div></div>
</div>