[Swift-user] Re: Swift app question

Mihael Hategan hategan at mcs.anl.gov
Wed Sep 8 21:37:38 CDT 2010


Theoretically since there is no dependency between m1, m2 and y, it
should run right ahead. Practically each invocation will probably wait
for values in years.

But I have to ask. Why bother doing this for every year if, at least
from your code, x would have the same value every time (i.e. there is no
actual dependency on y)?

Mihael

On Wed, 2010-09-08 at 21:28 -0500, Jonathan Monette wrote:
> 
> This is what I meant.
> 
> foreach y in years
> {
>      Month m1<"month1.txt">;
>      Month m2<"month2.txt">;
> 
>      Year x = calculate( m1, m2 );
> }
> 
> I know that threads will be created and each iteration for the foreach 
> loop will run in parallel.  What I am trying to understand is when is 
> the calculate app executed.  This is a very dumbed down example but I 
> want to know will x be mapped to the output of calculate once m1 and m2 
> are closed or is there a "barrier" that blocks until all threads have 
> finished mapping m1 and m2 before the apps are run in parallel?
> 
> On 9/8/10 9:21 PM, Mihael Hategan wrote:
> > foreach y in years
> > >  >  {
> > >  >            Month m1<  "month1.txt">;
> > >  >            Month m2<"month2.txt">;
> > >  >  
> > >  >            Year y = calculate( m1, m2 );
> > >  >  }
> 





More information about the Swift-user mailing list