Created
August 5, 2022 05:00
-
-
Save vasslitvinov/6566eb3035151f3314a8f23e2e6eb413 to your computer and use it in GitHub Desktop.
Arkouda mods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/FindSegmentsMsg.chpl b/src/FindSegmentsMsg.chpl | |
--- a/src/FindSegmentsMsg.chpl | |
+++ b/src/FindSegmentsMsg.chpl | |
@@ -112,7 +112,7 @@ module FindSegmentsMsg | |
// Permutation that groups the keys | |
var perm = toSymEntry(gPerm, int); | |
ref pa = perm.a; // ref to actual permutation array | |
- ref paD = perm.aD; // ref to domain | |
+ const ref paD = perm.aD; // ref to domain | |
// Unique key indices; true where first value of each unique key occurs | |
var ukeylocs: [paD] bool; | |
// First key is automatically present | |
@@ -189,7 +189,7 @@ module FindSegmentsMsg | |
var sname = st.nextName(); // segments | |
var segs = st.addEntry(sname, pop, int); | |
ref sa = segs.a; | |
- ref saD = segs.aD; | |
+ const ref saD = segs.aD; | |
// segment position... 1-based needs to be converted to 0-based because of inclusive-scan | |
// where ever a segment break (true value) is... that index is a segment start index | |
forall i in ukeylocs.domain with (var agg = newDstAggregator(int)) { | |
diff --git a/src/IndexingMsg.chpl b/src/IndexingMsg.chpl | |
--- a/src/IndexingMsg.chpl | |
+++ b/src/IndexingMsg.chpl | |
@@ -396,7 +396,7 @@ module IndexingMsg | |
var a = st.addEntry(rname, pop, XType); | |
//[i in e.aD] if (truth.a[i] == true) {a.a[iv[i]-1] = e.a[i];}// iv[i]-1 for zero base index | |
- ref ead = e.aD; | |
+ const ref ead = e.aD; | |
ref ea = e.a; | |
ref trutha = truth.a; | |
ref aa = a.a; | |
@@ -669,7 +669,7 @@ module IndexingMsg | |
value = value.replace("False","false"); // chapel to python bool | |
} | |
var val = try! value:dtype; | |
- ref ead = e.aD; | |
+ const ref ead = e.aD; | |
ref ea = e.a; | |
ref trutha = truth.a; | |
forall i in ead with (var agg = newDstAggregator(dtype)) { | |
@@ -842,7 +842,7 @@ module IndexingMsg | |
return new MsgTuple(errorMsg,MsgType.ERROR);; | |
} | |
ref ya = y.a; | |
- ref ead = e.aD; | |
+ const ref ead = e.aD; | |
ref ea = e.a; | |
ref trutha = truth.a; | |
forall (eai, i) in zip(ea, ead) with (var agg = newSrcAggregator(t)) { | |
diff --git a/src/SequenceMsg.chpl b/src/SequenceMsg.chpl | |
--- a/src/SequenceMsg.chpl | |
+++ b/src/SequenceMsg.chpl | |
@@ -45,7 +45,7 @@ module SequenceMsg { | |
t1 = Time.getCurrentTime(); | |
ref ea = e.a; | |
- ref ead = e.aD; | |
+ const ref ead = e.aD; | |
forall (ei, i) in zip(ea,ead) { | |
ei = start + (i * stride); | |
} | |
@@ -91,7 +91,7 @@ module SequenceMsg { | |
t1 = Time.getCurrentTime(); | |
ref ea = e.a; | |
- ref ead = e.aD; | |
+ const ref ead = e.aD; | |
forall (ei, i) in zip(ea,ead) { | |
ei = start + (i * stride); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/MultiTypeSymEntry.chpl b/src/MultiTypeSymEntry.chpl | |
--- a/src/MultiTypeSymEntry.chpl | |
+++ b/src/MultiTypeSymEntry.chpl | |
@@ -174,57 +174,66 @@ | |
class SymEntry : GenSymEntry | |
{ | |
/* | |
generic element type array | |
etype is different from dtype (chapel vs numpy) | |
*/ | |
type etype; | |
- /* | |
- 'aD' is the distributed domain for 'a' whose value and type | |
- are defined by makeDistDom() to support varying distributions | |
- */ | |
- const aD: makeDistDom(size).type; | |
- var a: [aD] etype; | |
- | |
+ var a = makeDistArray(size, etype); | |
+ | |
+ pragma "no copy return" // workaround for #20389 | |
+ proc aD /*const ref*/ return a.domain; | |
+ | |
/* | |
This init takes length and element type | |
:arg len: length of array to be allocated | |
:type len: int | |
:arg etype: type to be instantiated | |
:type etype: type | |
*/ | |
proc init(len: int, type etype) { | |
super.init(etype, len); | |
this.entryType = SymbolEntryType.PrimitiveTypedArraySymEntry; | |
assignableTypes.add(this.entryType); | |
this.etype = etype; | |
- this.aD = makeDistDom(len); | |
// this.a uses default initialization | |
} | |
/*This init takes an array of a type | |
:arg a: array | |
:type a: [] ?etype | |
*/ | |
- proc init(a: [?D] ?etype) { | |
+ // This initializer does not copy or create domains/arrays: | |
+ // `this.a` simply takes over the ownership of the `a` formal. | |
+ proc init(in a: [?D] ?etype) where a.type == makeDistArray(1, etype).type { | |
super.init(etype, D.size); | |
this.entryType = SymbolEntryType.PrimitiveTypedArraySymEntry; | |
assignableTypes.add(this.entryType); | |
this.etype = etype; | |
- this.aD = D; | |
this.a = a; | |
} | |
+ // Used, for example, when the actual is a default rectangular array. | |
+ proc init(a: [?D] ?etype) { | |
+ super.init(etype, D.size); | |
+ this.entryType = SymbolEntryType.PrimitiveTypedArraySymEntry; | |
+ assignableTypes.add(this.entryType); | |
+ | |
+ this.etype = etype; | |
+ this.a = makeDistArray(D.size, etype); // initialization | |
+ this.a = a; // assignment | |
+ } | |
+ | |
/* | |
Verbose flag utility method | |
*/ | |
proc postinit() { | |
//if v {write("aD = "); printOwnership(this.a);} | |
} | |
/* | |
Verbose flag utility method |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment