Hello.

I am wondering if there is a way to change a mapping of a distributed array. 
For example:


use BlockDist;

var domC = {0..0} dmapped Block({0..0});

var C: [domC] int;

writeln("Initially, C is: ", C);

for i in 0..5 {

  domC = {0..i}; // dmapped Block({0..i}); // needed, or halt on assignment

  C(i) = C(i).locale.id;

  writeln("C(", i, ") assigned, C is: ", C, ". domC is ", domC);

}

On 2 nodes I get:

Initially, C is: 0
C(0) assigned, C is: 0. domC is {0..0}
C(1) assigned, C is: 0 1. domC is {0..1}
C(2) assigned, C is: 0 1 1. domC is {0..2}
C(3) assigned, C is: 0 1 1 1. domC is {0..3}
C(4) assigned, C is: 0 1 1 1 1. domC is {0..4}
C(5) assigned, C is: 0 1 1 1 1 1. domC is {0..5}

I understand why is this, but I am looking for a way to add values to a 
distributed array and then “rebalance” the distribution at some point. So there 
are 2 questions I have:


  1.  Is there a way to do this with arrays at all without somehow creating a 
whole new array?
  2.  Is there any better approach for this?

To give some context, I am trying to come up with a simple distributed graph 
data structure (similar to CSR in that vertices are distributed, but not 
necessarily adjacencies) that allows adding of new vertices. If I add a new 
vertex, I need to put it into a distributed data structure. With arrays with 
Block distribution, everything outside of the bounding box seems to go to the 
last locale. I am not necessarily looking for the most efficient solution at 
this point but rather for something simple using the basic language mechanisms 
in Chapel.

Thank you,
Marcin
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users

Reply via email to