Hello, I am using x10 1.7 and the java backend. I am trying to parallelize
nested *for* loops.
This is the original loop:
for(var i:int = 1; i < n1;i++){
for(var j:int = 1; j < n2; j++){
for(var k:int = 1; k<n3; k++){
for(var l:int = 0; l<nc; l++){
A(i,j,k,l) = B(i,j,k,l) - C(i,j,k,l);
}
}
}
}
I tried to parallelize it as follows:
finish {
for(shared var i:int = 1; i < n1;i++){
for(shared var j:int = 1; j < n2; j++){
async {
for(shared var k:int = 1; k<n3; k++){
for(shared var l:int = 0; l<nc; l++){
A(i,j,k,l) = B(i,j,k,l) - C(i,j,k,l);
}
}
}
}
}
}
I get the error: Local variable "i" is accessed from an inner class, and
must be declared final.
And of course, if I declare i as final, I get
Cannot apply ++ to a final variable
So is there a way to parallelize the loop? Note that I am not using
distributions, everything occurs at place 0.
Thanks,
Kshitij
------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
X10-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/x10-users