I have some nested loops I'd like to execute in parallel. The  
sequential pseudocode would look something like

====================================
def func( p1: Array[T](2), n: Int){

        val region = p1.region;
        val dist: Dist{rank==2} = Dist.makeBlock(region,0);
        val p = old_p as Array[T](dist);
        val arry = old_arry as Array[Double]{rank==1};
        val tmp = Array.makeVar[T](dist, ((i,j):Point) => new T());

        for (var i...){
          for(var j = 0 to n){
                r = 0.0;
                for (var k = 0 to n){
                        val b = (j*k)%n;
                        r = r + p(k,i).field * arry(b);
                }
                tmp(j,i) = r;
          }
        }

        for (var i...)
          for(var j = 0 to n)
                p1(i,j) = new T ( tmp(i,j) );
}  /*  func  */
====================================

I have tried the following, which compiles but throw BPE
where noted (*)

====================================

def func( p1: Array[T](2), n: Int){

        val region = p1.region;
        val dist: Dist{rank==2} = Dist.makeBlock(region,0);
        val p = old_p as Array[T](dist);
        val arry = old_arry as Array[Double]{rank==1};
        val tmp = Array.makeVar[T](dist, ((i,j):Point) => new T());

        finish for ( plc in dist.places() ) async (plc){

                for (var i...){
                  for(var j = 0 to n){
                                r = 0.0;
                                for (var k = 0 to n){
                                        val b = (j*k)%n;
                                        r = r + p(k,i).field * arry(b);  // (*) 
BPE thrown here
                                }
                                tmp(j,i) = r;
                  }
                }
        } /* finish async */

for (var i...)
   for(var j = 0 to n)
        p1(i,j) = new T ( tmp(i,j) );  // (*) BPE thrown here

====================================


How can I determine which values are in the wrong place? I apparently  
have a distribution wrong.

Thanks for the help.

Jim

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to