2

(chpl version 1.16.0.e43acc7)

I'm starting to learn the DSI interface and have run into a confusing issue when constructing a Domain class from the dsiNewRectangularDom function in the Distribution class:

class MyDist : BaseDist {

  proc MyDist( fold_dimensions ...?dims ){ }

  proc dsiNewRectangularDom(param rank: int, type idxType, param stridable: bool, inds) {
    var dom = new MyDom( rank=rank, idxType=idxType, stridable=stridable, dist=this);
    return dom;
  }
}

class MyDom : BaseRectangularDom { }

class MyArr : BaseArr { }

config const n = 4;
config const m = 8;
const base_domain = {1..#n,1..#m};
const mapped_domain = base_domain dmapped MyDist( 1 );

(This is very basic code, and I don't expect it to fully compile, but I'm stuck on this part.)

This produces the compile error:

file.chpl:5: In function 'dsiNewRectangularDom':
file.chpl:6: error: unresolved call 'MyDom.init(rank=2, idxType=type int(64), stridable=0, dist=MyDist)'
file.chpl:11: note: candidates are: MyDom.init(_arrs, _arrs_containing_dom: int(64), _arrsLock: atomicbool, _free_when_no_arrs: bool, pid: int(64), param rank: int(64), type idxType, param stridable: bool)

(see this TIO instance)

I'm a bit confused about where this init function comes from. I'm following the behavior of Block, BlockDist, and BlockDom (in particular BlockDist.chpl:533 where Block.dsiNewRectangularDom calls BlockDom's constructor. Since MyDom inherits from BaseRectangularDom, I (1) don't need to declare the rank, idxType, etc member variables, and (2) don't need to define the MyDom( rank, idxType, ... ) constructor. I also don't see a BlockDom.init function that I could learn from.

What am I missing?

  • 2
    With respect to this question, I'll mention that I've been mulling over the possibility of writing a "So you want to write your own domain map?" tutorial that would take one through the process step-by-step, growing the interface incrementally, and therefore the set of features a client program can use. If this would be of interest to you, please open a Chapel GitHub "feature request" issue along these lines to lend more weight to it (and indicate whether you consider it a "blocking issue" or not in the text or a follow-up comment). Thanks. – Brad Dec 21 '17 at 01:39

1 Answers1

1

Your most immediate problem is that BaseRectangularDom (and therefore MyDom) does not have a field named 'dist'. Like BlockDom, you'll want to add a 'dist' field, probably like:

var dist : MyDist;

Once you fix that, you'll be on to the next error (dsiAssignDomain is not implemented).

The error message likely mentioned 'init' as a side effect of the ongoing conversion from constructors to initializers.

benharsh
  • 396
  • 1
  • 8