Hi,
While writing a test case to compare my new distribution with the block
distribution I ran into some performance problems when having distributed
domains, arrays and domainmaps inside a class.
If domain map, domains and arrays are members of a class, and computing is done
in a method, it seems to generate much more communication than when not using
class. Gets on the second locale are 8022 without classes and 20222 using the
class thing on my computer. --cache-remote reduces communications, but the
ratio of gets (or get_nbs) stays same.
Code demonstrating this problem is as an attachment. I ran the test with two
locales. Notice the number of gets on the second locale when using the class
approach.
Is this just a limitation of chapel implementation, or does the class approach
require some special tricks...?
use BlockDist;
use Random;
use Time;
class TestClass {
const Space = {0..9,0..9};
const domMap = new dmap(new Block(boundingBox=Space));
const dom: domain(2) dmapped domMap = Space;
const inDom: domain(2) dmapped domMap = {1..8,1..8};
var initArr: [dom] real;
var resArr: [dom] real;
proc TestClass() {
fillRandom(initArr, 42*42-1);
writeln("INITIAL ARRAY");
writeln(initArr);
writeln("---------------------------------------------");
}
proc DoSomething() {
for 1..1000 do {
forall i in inDom do {
const k = 0.01;
const (x, y) = i;
resArr(i) = (1 - 4*k)*initArr(x, y) + k*(initArr(x-1,y) + initArr(x+1,y) + initArr(x,y-1) + initArr(x,y+1));
}
initArr = resArr;
}
}
}
{
const TC = new TestClass();
resetCommDiagnostics();
startCommDiagnostics();
TC.DoSomething();
writeln("***********************************************");
writeln("Test Class diagnostics: ");
writeln(getCommDiagnostics());
writeln();
writeln("Result:");
writeln(TC.resArr);
writeln();
}
{
const Space = {0..9,0..9};
const domMap = new dmap(new Block(boundingBox=Space));
const dom: domain(2) dmapped domMap = Space;
const inDom: domain(2) dmapped domMap = {1..8,1..8};
var initArr: [dom] real;
var resArr: [dom] real;
fillRandom(initArr, 42*42-1);
resetCommDiagnostics();
startCommDiagnostics();
for 1..1000 do {
forall i in inDom do {
const k = 0.01;
const (x, y) = i;
resArr(i) = (1 - 4*k)*initArr(x, y) + k*(initArr(x-1,y) + initArr(x+1,y) + initArr(x,y-1) + initArr(x,y+1));
}
initArr = resArr;
}
writeln("***********************************************");
writeln("Without class diagnostics: ");
writeln(getCommDiagnostics());
writeln();
writeln("Result:");
writeln(resArr);
writeln();
}
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users