Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extract DSI array class from dmapped array instance?

I'm doing some performance testing on a custom distribution hierarchy, and I need to access the array class that backs a mapped array. I can access the backing domain through array.domain, but there doesn't seem to be anything for the backing array class.

For example, how would I extract BlockArr/LocBlockArr from the Block distributed array A in the following code:

const Space = {1..8, 1..8};
const D: domain(2) dmapped Block(boundingBox=Space) = Space;
var A: [D] int;
var A_BlockArr_obj : BockArr = A.???
like image 298
memorableusername Avatar asked Jan 16 '18 17:01

memorableusername


1 Answers

Let's say you wanted to access some method or field from the backing array class. In Chapel 1.16 you can write:

var A_obj = A._value;
A_obj.foo();
writeln(A_obj.myField);

The _value method returns the backing array class (or a privatized copy if you have enabled privatization). The same method can be called on domains and distributions. Note that this is intentionally undocumented and may change in future releases.

In Chapel 1.17 (to be released in April 2018) method calls and field accesses on arrays, domains, and distributions now forward to the backing class, so you could instead write:

A.foo();
writeln(A.myField);

These method calls and field accesses will be invoked on a privatized instance of the class if possible.

like image 90
benharsh Avatar answered Nov 07 '22 01:11

benharsh