Hello all,

im using native X10 2.3.1
I have the following code and would ask if you can help me for some 
performance tuning tips

for(val dim in (0..(dimension-1)){
   for(var i:int = maxLevel -1; i>0;i--){
     val l = i;
     finish for(val p in Place.places()) async at(p){
       val size = (values(l).size / Place.MAX_PLACES) + 
((values(l).size%Place.MAX_PLACES==0)?0:1);
       val rangeStart = Math.min(values(l).size,p.id*size);
       val rangeStop = Math.min(values(l).size,((p.id+1)*size));
       val rSize = rangeStop - rangeStart;
       val sizePerThread = (rSize / numThreads) + 
((rSize%numThreads==0)?0:1);

       finish for(val t:int in (0..(numThreads-1))) async {
         val threadStart = rangeStart + Math.min(rSize,t*sizePerThread);
         val threadStop = 
Math.min(rangeStop,rangeStart+(t+1)*sizePerThread);

         for(var j:int=threadStart; j<threadStop; j++){
           val lParent:double = parent(l, j, dim, -1);
           val rParent:double = parent(l, j, dim, 1);
           values(l)(j) -= (lParent + rParent) * 0.5;
         }

         //broadcast results to all places
         if(threadStop-threadStart>0){
           for(val pl in Place.places()){
             if(pl!=here)
               Array.asyncCopy(values(l),threadStart,at (pl) (new 
RemoteArray(values(l))),threadStart,threadStop-threadStart);
           }
         }
       }
     }
   }
}

"values" is a two dimensional array of type
static val values = new Array[Array[Double]](maxLevel);

the method "parent" returns only elements of one of the arrays in 
values(k), k<l

Thanks in advance,
Thomas

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
X10-users mailing list
X10-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/x10-users

Reply via email to