I'm still looking for an answer to parallelizing a loop with common data for 
each iteration. It is my understanding that the value vC would be private to 
each iteration of the ateach loop. This doesn't seem to be the case. Output is 
below. I'm using version 1.7.7.


public class TestVal{
        public static def main(args:Rail[String]){
                var c: Complex = new Complex();
                var reg: Region{rank==1} = [1..8];
                var dist: Dist{rank==1} = Dist.make(reg);

                val vC = c;
                finish ateach((i) in dist)
                {
                        vC.imag = i as Double;
                        for ( var n: Int = 0; n < 100; n++ );
                        Console.OUT.println(vC);
                }       
        }       
}


Output: Notice the absence of (0,8) and the replication of (0,2). It seems 
there is a data race on the vC, but my understanding is that vC would be local 
to each thread.

$ x10 TestVal
(0.0, 1.0)
(0.0, 7.0)
(0.0, 6.0)
(0.0, 5.0)
(0.0, 4.0)
(0.0, 3.0)
(0.0, 2.0)
(0.0, 2.0)


If I am misunderstanding this, can anyone offer a correction? In this example, 
I want vC to be private (local) to each iteration. I.e., each iteration gets 
its own copy.

Thanks,

Jim
------------------------------------------------------------------------------

_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to