Jim LaGrone <jlagr...@cs.uh.edu> wrote on 08/27/2009 06:43:57 PM:

> 
> On Aug 27, 2009, at 3:55 PM, Igor Peshansky wrote:
> 
> > You can also use the place-local idiom, as follows:
> >
> >      val norms = Array.make[Double](Dist.makeUnique(), (Point)=>0.0);
> >      finish ateach ( (p) in distS.places() ) {
> >         for ( (i, j) in distS | p ) { // at this point, p == here
> >            norms(p.id) += Math.sqrt(S(i,j).real*S(i,j).real +
> >               S(i,j).image*S(i,j).image);
> >         }
> >      }
> >      rawNormPower2 = norms.sum(); // a distributed reduction
> >
> > Here, norms is an array with a unique distribution (which has one 
> > point
> > per place).  The ateach loop again spawns parallel iterations on each
> > place (but now there's one per place covered by the distribution). 
> > The
> > body of the ateach has a sequential loop that runs over the part of 
> > distS
> > that lives in that place.  Each iteration of that sequential loop 
> > updates
> > the local element of norms.  There is no need for atomic, since all
> > updates happen sequentially.  Once the ateach loop is done, a
> > (distributed)
> > reduction is performed over the norms array, and the sum is stored 
> > in the
> > final result location.
> 
> 
> Using this method and Java backend, I have
> 
>    rawNormPower2 = 0;
>    val norms = Array.make[Double](Dist.makeUnique(), (Point)=>0.0);
>    finish ateach( (p) in distS.places() ){   //line 327
>       for( (i,j) in distS | p ){
>          norms(p.id) += Math.sqrt(S(i1,j1).real*S(i1,j1).real +
>                S(i1,j1).image*S(i1,j1).image); 
>       }
>    }
>    rawNormPower2 = norms.sum()/( N*Mc );  //line 333
> 
> 
> but get this
> 
> /Users/jlagrone/GradSchool/Research/workspace/X10-code/SSCA3-X10/src- 
> par/State.x10:327: Could not infer type for formal parameter.
> /Users/jlagrone/GradSchool/Research/workspace/X10-code/SSCA3-X10/src- 
> par/State.x10:327: Could not infer type for formal parameter.
> /Users/jlagrone/GradSchool/Research/workspace/X10-code/SSCA3-X10/src- 
> par/State.x10:333: No valid method call found for sum() in 
> x10.lang.Array[x10.lang.Double].

Sorry, this will teach me to actually test the code before sending it out.
Line 327 should be "finish for ( p in distS.places() ) async (p) {".
In line 33, replace "sum()" by "reduce((a:Int,b:Int)=>a+b, 0)".

> Also, is it safe to assume this will work with Java backend on dual- 
> core machine? Or should I do development on cluster from here on out? 
> How should the program be executed. We usually use slurm, but is there 
> some special method?

If you are working with the 1.7.* releases, the Java backend should work.
If you want to use a cluster, you should use the C++ backend.

To execute the program on a JVM, use the "x10" script supplied with the
distribution.  For running on the cluster of Linux machines, you can use
mpiexec from an OpenMPI installation.
        Igor
-- 
Igor Peshansky  (note the spelling change!)
IBM T.J. Watson Research Center
XJ: No More Pain for XML's Gain (http://www.research.ibm.com/xj/)
X10: Parallel Productivity and Performance (http://x10.sf.net/)


------------------------------------------------------------------------------
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