From c0db5a92d5bf4d344a64088be801e1c42a71668f Mon Sep 17 00:00:00 2001 From: Brad Chamberlain Date: Thu, 14 Sep 2023 23:13:46 -0700 Subject: [PATCH 1/4] Convert 'Hashed' distribution to a record named 'hashedDist' --- Signed-off-by: Brad Chamberlain --- modules/dists/DSIUtil.chpl | 8 +++ modules/dists/HashedDist.chpl | 117 +++++++++++++++++++++++++++++++--- 2 files changed, 117 insertions(+), 8 deletions(-) diff --git a/modules/dists/DSIUtil.chpl b/modules/dists/DSIUtil.chpl index 2f29830c0972..f6cd89d103b2 100644 --- a/modules/dists/DSIUtil.chpl +++ b/modules/dists/DSIUtil.chpl @@ -778,6 +778,14 @@ record chpl_PrivatizedDistHelper : writeSerializable { return newRectangularDom(rank, idxType, strides, ranges, definedConst); } + proc newAssociativeDom(type idxType, param parSafe: bool=true) { + var x = _value.dsiNewAssociativeDom(idxType, parSafe); + if x.linksDistribution() { + _value.add_dom(x); + } + return x; + } + proc newSparseDom(param rank: int, type idxType, dom: domain) { var x = _value.dsiNewSparseDom(rank, idxType, dom); if x.linksDistribution() { diff --git a/modules/dists/HashedDist.chpl b/modules/dists/HashedDist.chpl index 27367d2091f3..164a00105712 100644 --- a/modules/dists/HashedDist.chpl +++ b/modules/dists/HashedDist.chpl @@ -21,6 +21,8 @@ @unstable("HashedDist is unstable and may change in the future") prototype module HashedDist { +use DSIUtil; + config param debugUserMapAssoc = false; @@ -115,7 +117,99 @@ The `Hashed` domain map initializer is defined as follows: targetLocales: [] locale = Locales) */ -class Hashed : BaseDist, writeSerializable { +record hashedDist : writeSerializable { + type idxType; + type mapperT; + + forwarding const chpl_distHelp: chpl_PrivatizedDistHelper(unmanaged HashedImpl(idxType, mapperT)); + + proc init(type idxType, + mapper:?t = new DefaultMapper(), + targetLocales: [] locale = Locales) { + const value = new unmanaged HashedImpl(idxType, mapper, targetLocales); + this.idxType = idxType; + this.mapperT = t; + this.chpl_distHelp = new chpl_PrivatizedDistHelper( + if _isPrivatized(value) + then _newPrivatizedClass(value) + else nullPid, + value); + } + + proc init(_pid : int, _instance, _unowned : bool) { + this.idxType = _instance.idxType; + this.mapperT = _instance.mapper.type; + this.chpl_distHelp = new chpl_PrivatizedDistHelper(_pid, + _instance, + _unowned); + } + + proc init(value) { + this.idxType = value.idxType; + this.mapperT = value.mapper.type; + this.chpl_distHelp = new chpl_PrivatizedDistHelper( + if _isPrivatized(value) + then _newPrivatizedClass(value) + else nullPid, + _to_unmanaged(value)); + } + + // Note: This does not handle the case where the desired type of 'this' + // does not match the type of 'other'. That case is handled by the compiler + // via coercions. + proc init=(const ref other : hashedDist(?)) { + this.init(other._value.dsiClone()); + } + + proc clone() { + return new hashedDist(this._value.dsiClone()); + } + + @chpldoc.nodoc + inline operator ==(d1: hashedDist(?), d2: hashedDist(?)) { + if (d1._value == d2._value) then + return true; + return d1._value.dsiEqualDMaps(d2._value); + } + + @chpldoc.nodoc + inline operator !=(d1: hashedDist(?), d2: hashedDist(?)) { + return !(d1 == d2); + } + + proc writeThis(x) { + chpl_distHelp.writeThis(x); + } + + proc serialize(writer, ref serializer) throws { + writeThis(writer); + } +} + + +@chpldoc.nodoc +@unstable(category="experimental", reason="assignment between distributions is currently unstable due to lack of testing") +operator =(ref a: hashedDist(?), b: hashedDist(?)) { + if a._value == nil { + __primitive("move", a, chpl__autoCopy(b.clone(), definedConst=false)); + } else { + if a._value.type != b._value.type then + compilerError("type mismatch in distribution assignment"); + if a._value == b._value { + // do nothing + } else + a._value.dsiAssign(b._value); + if _isPrivatized(a._instance) then + _reprivatize(a._value); + } +} + + +@deprecated("'Hashed' is deprecated, please use 'hashedDist' instead") +type Hashed = hashedDist; + + +class HashedImpl : BaseDist, writeSerializable { // GENERICS: @@ -175,7 +269,7 @@ class Hashed : BaseDist, writeSerializable { // proc init(type idxType, mapper, - other: unmanaged Hashed(idxType, mapper.type)) { + other: unmanaged HashedImpl(idxType, mapper.type)) { this.idxType = idxType; this.mapper = mapper; // normally == other.mapper; targetLocDom = other.targetLocDom; @@ -189,7 +283,7 @@ class Hashed : BaseDist, writeSerializable { proc dsiGetPrivatizeData() do return this.mapper; proc dsiPrivatize(privatizeData) { - return new unmanaged Hashed(idxType, privatizeData, _to_unmanaged(this)); + return new unmanaged HashedImpl(idxType, privatizeData, _to_unmanaged(this)); } proc dsiGetReprivatizeData() do return 0; @@ -198,7 +292,7 @@ class Hashed : BaseDist, writeSerializable { } proc dsiClone() { - return new unmanaged Hashed(idxType, mapper, targetLocales); + return new unmanaged HashedImpl(idxType, mapper, targetLocales); } // DISTRIBUTION INTERFACE: @@ -238,8 +332,8 @@ class Hashed : BaseDist, writeSerializable { // print out the distribution // proc writeThis(x) throws { - x.writeln("Hashed"); - x.writeln("-------"); + x.writeln("hashedDist"); + x.writeln("----------"); x.writeln("distributed using: ", mapper); x.writeln("across locales: ", targetLocales); x.writeln("indexed via: ", targetLocDom); @@ -304,7 +398,7 @@ class UserMapAssocDom: BaseAssociativeDom { // // LEFT: a pointer to the parent distribution // - const dist: unmanaged Hashed(idxType, mapperType); + const dist: unmanaged HashedImpl(idxType, mapperType); // // DOWN: an array of local domain class descriptors -- set up in @@ -519,7 +613,7 @@ class UserMapAssocDom: BaseAssociativeDom { // // INTERNAL INTERFACE // - override proc dsiMyDist(): unmanaged Hashed(idxType, mapperType) { + override proc dsiMyDist(): unmanaged HashedImpl(idxType, mapperType) { return dist; } @@ -566,6 +660,13 @@ class UserMapAssocDom: BaseAssociativeDom { } proc rank param { return 1; } + + proc dsiGetDist() { + if _isPrivatized(dist) then + return new hashedDist(dist.pid, dist, _unowned=true); + else + return new hashedDist(nullPid, dist, _unowned=true); + } } From 5b878cf13b87d8e25bc108419dd1039fbe189a4e Mon Sep 17 00:00:00 2001 From: Brad Chamberlain Date: Thu, 14 Sep 2023 23:15:36 -0700 Subject: [PATCH 2/4] Update tests to use hashedDist --- Signed-off-by: Brad Chamberlain --- test/arrays/userAPI/assocDistributedHashed.chpl | 2 +- test/deprecated/dmapType.chpl | 9 +++++++++ test/deprecated/dmapType.good | 7 +++++++ .../bradc/assoc/userAssoc-array-domain-zipper.chpl | 2 +- .../distributions/bradc/assoc/userAssoc-array-noelt.chpl | 2 +- .../bradc/assoc/userAssoc-array-priv-check.chpl | 2 +- .../distributions/bradc/assoc/userAssoc-basic-array.chpl | 2 +- .../bradc/assoc/userAssoc-basic-domain.chpl | 2 +- test/distributions/bradc/assoc/userAssoc-class.chpl | 2 +- .../bradc/assoc/userAssoc-dom-operations.chpl | 2 +- .../bradc/assoc/userAssoc-domain-priv-check.chpl | 2 +- .../bradc/assoc/userAssoc-domain-stress.chpl | 2 +- test/distributions/bradc/assoc/userAssoc-fcf.chpl | 4 ++-- test/distributions/ferguson/dist-assoc-assign.chpl | 2 +- test/distributions/ferguson/dist-assoc-bulkadd.chpl | 2 +- test/distributions/ferguson/dist-assoc-writeln.chpl | 2 +- test/functions/generic/poi/hashed-dist-with-mapper.chpl | 2 +- test/optimizations/autoLocalAccess/common.chpl | 4 ++-- .../autoLocalAccess/regularDeclaration.compopts | 2 +- test/studies/labelprop/labelprop-tweets.chpl | 2 +- 20 files changed, 36 insertions(+), 20 deletions(-) diff --git a/test/arrays/userAPI/assocDistributedHashed.chpl b/test/arrays/userAPI/assocDistributedHashed.chpl index 6a373b22db8f..ff5b840a2235 100644 --- a/test/arrays/userAPI/assocDistributedHashed.chpl +++ b/test/arrays/userAPI/assocDistributedHashed.chpl @@ -23,7 +23,7 @@ proc main() { output.writeln([1,2,3]); var myMapper = new MyMapper(); - var D: domain(string) dmapped Hashed(idxType=string, mapper=myMapper); + var D: domain(string) dmapped hashedDist(idxType=string, mapper=myMapper); var A:[D] real; D += "zero"; diff --git a/test/deprecated/dmapType.chpl b/test/deprecated/dmapType.chpl index aeeaefe212e1..0b657f7a147b 100644 --- a/test/deprecated/dmapType.chpl +++ b/test/deprecated/dmapType.chpl @@ -94,3 +94,12 @@ config var n = 10, leaksAndBreaks=false; writeln(Dist2.type:string); } +{ + use HashedDist; + var Dom: domain(int) dmapped new dmap(new Hashed(idxType=int));; + Dom += 1; + var A: [Dom] real; + writeln(A); + const Dist2: dmap(Hashed(int, DefaultMapper)) = new Hashed(int); + writeln(Dist2.type:string); +} diff --git a/test/deprecated/dmapType.good b/test/deprecated/dmapType.good index fe3e4733025e..a2dc08019fe9 100644 --- a/test/deprecated/dmapType.good +++ b/test/deprecated/dmapType.good @@ -20,6 +20,9 @@ dmapType.chpl:72: warning: 'BlockCyclic' is deprecated, please use 'blockCycDist dmapType.chpl:84: warning: 'DimensionalDist2D' is deprecated, please use 'dimensionalDist2D' instead dmapType.chpl:85: warning: 'DimensionalDist2D' is deprecated, please use 'dimensionalDist2D' instead dmapType.chpl:93: warning: 'DimensionalDist2D' is deprecated, please use 'dimensionalDist2D' instead +dmapType.chpl:99: warning: 'Hashed' is deprecated, please use 'hashedDist' instead +dmapType.chpl:103: warning: 'Hashed' is deprecated, please use 'hashedDist' instead +dmapType.chpl:103: warning: 'Hashed' is deprecated, please use 'hashedDist' instead dmapType.chpl:92: warning: 'DimensionalDist2D' is deprecated, please use 'dimensionalDist2D' instead dmapType.chpl:4: warning: The use of 'dmap' is deprecated for this distribution; please replace 'new dmap(new ())' with 'new ()' dmapType.chpl:8: warning: The use of 'dmap' is deprecated for this distribution; please replace 'dmap(())' with '()' @@ -35,6 +38,8 @@ dmapType.chpl:68: warning: The use of 'dmap' is deprecated for this distribution dmapType.chpl:72: warning: The use of 'dmap' is deprecated for this distribution; please replace 'dmap(())' with '()' dmapType.chpl:84: warning: The use of 'dmap' is deprecated for this distribution; please replace 'new dmap(new ())' with 'new ()' dmapType.chpl:92: warning: The use of 'dmap' is deprecated for this distribution; please replace 'dmap(())' with '()' +dmapType.chpl:99: warning: The use of 'dmap' is deprecated for this distribution; please replace 'new dmap(new ())' with 'new ()' +dmapType.chpl:103: warning: The use of 'dmap' is deprecated for this distribution; please replace 'dmap(())' with '()' 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 blockDist(1,int(64),unmanaged DefaultDist) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 @@ -57,3 +62,5 @@ blockCycDist(1,int(64)) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 dimensionalDist2D([domain(2,int(64),one)] locale,BlockDim(int(64)),BlockDim(int(64)),int(64)) +0.0 +hashedDist(int(64),DefaultMapper) diff --git a/test/distributions/bradc/assoc/userAssoc-array-domain-zipper.chpl b/test/distributions/bradc/assoc/userAssoc-array-domain-zipper.chpl index 6bebba97c14d..5fd0e4453a6f 100644 --- a/test/distributions/bradc/assoc/userAssoc-array-domain-zipper.chpl +++ b/test/distributions/bradc/assoc/userAssoc-array-domain-zipper.chpl @@ -11,7 +11,7 @@ record MyMapper { } var myMapper = new MyMapper(); -var newDist = new dmap(new unmanaged Hashed(idxType=real, mapper=myMapper)); +var newDist = new hashedDist(idxType=real, mapper=myMapper); var D: domain(real) dmapped newDist; diff --git a/test/distributions/bradc/assoc/userAssoc-array-noelt.chpl b/test/distributions/bradc/assoc/userAssoc-array-noelt.chpl index c5f369373e6a..ffd59e5c8aa4 100644 --- a/test/distributions/bradc/assoc/userAssoc-array-noelt.chpl +++ b/test/distributions/bradc/assoc/userAssoc-array-noelt.chpl @@ -8,7 +8,7 @@ record MyMapper { } } -var newDist = new dmap(new unmanaged Hashed(idxType=real, mapper=new MyMapper())); +var newDist = new hashedDist(idxType=real, mapper=new MyMapper()); var D: domain(real) dmapped newDist; diff --git a/test/distributions/bradc/assoc/userAssoc-array-priv-check.chpl b/test/distributions/bradc/assoc/userAssoc-array-priv-check.chpl index ce06d0faf130..de816078272a 100644 --- a/test/distributions/bradc/assoc/userAssoc-array-priv-check.chpl +++ b/test/distributions/bradc/assoc/userAssoc-array-priv-check.chpl @@ -9,7 +9,7 @@ record MyMapper { } proc doit() { - var newDist = new dmap(new unmanaged Hashed(idxType=real, mapper=new MyMapper())); + var newDist = new hashedDist(idxType=real, mapper=new MyMapper()); var D: domain(real) dmapped newDist; diff --git a/test/distributions/bradc/assoc/userAssoc-basic-array.chpl b/test/distributions/bradc/assoc/userAssoc-basic-array.chpl index 0fda30307c34..cdb06dd77be0 100644 --- a/test/distributions/bradc/assoc/userAssoc-basic-array.chpl +++ b/test/distributions/bradc/assoc/userAssoc-basic-array.chpl @@ -8,7 +8,7 @@ record MyMapper { } } -var newDist = new dmap(new unmanaged Hashed(idxType=real, mapper=new MyMapper())); +var newDist = new hashedDist(idxType=real, mapper=new MyMapper()); var D: domain(real) dmapped newDist; diff --git a/test/distributions/bradc/assoc/userAssoc-basic-domain.chpl b/test/distributions/bradc/assoc/userAssoc-basic-domain.chpl index 43816512c47a..6ee07cbb85d2 100644 --- a/test/distributions/bradc/assoc/userAssoc-basic-domain.chpl +++ b/test/distributions/bradc/assoc/userAssoc-basic-domain.chpl @@ -8,7 +8,7 @@ record MyMapper { } } -var newDist = new dmap(new unmanaged Hashed(idxType=real, mapper=new MyMapper())); +var newDist = new hashedDist(idxType=real, mapper=new MyMapper()); var D: domain(real) dmapped newDist; diff --git a/test/distributions/bradc/assoc/userAssoc-class.chpl b/test/distributions/bradc/assoc/userAssoc-class.chpl index 18c1e26bfa5e..da7ec1bb6c42 100644 --- a/test/distributions/bradc/assoc/userAssoc-class.chpl +++ b/test/distributions/bradc/assoc/userAssoc-class.chpl @@ -14,7 +14,7 @@ var myMapper = proc(ind:real, targetLocs: Locales.type) { return indAsInt % numlocs; }; -var D: domain(real) dmapped Hashed(idxType=real, mapper=new MyMapper()); +var D: domain(real) dmapped hashedDist(idxType=real, mapper=new MyMapper()); D += 1.3; D += 22.0; diff --git a/test/distributions/bradc/assoc/userAssoc-dom-operations.chpl b/test/distributions/bradc/assoc/userAssoc-dom-operations.chpl index b2769578b335..d495d8c4ee4e 100644 --- a/test/distributions/bradc/assoc/userAssoc-dom-operations.chpl +++ b/test/distributions/bradc/assoc/userAssoc-dom-operations.chpl @@ -2,7 +2,7 @@ use HashedDist; config const verbose = false; -var newDist = new dmap(new Hashed(idxType=real)); +var newDist = new hashedDist(idxType=real); var D: domain(real) dmapped newDist; diff --git a/test/distributions/bradc/assoc/userAssoc-domain-priv-check.chpl b/test/distributions/bradc/assoc/userAssoc-domain-priv-check.chpl index cf2a2c6f4b94..1880ff826bdc 100644 --- a/test/distributions/bradc/assoc/userAssoc-domain-priv-check.chpl +++ b/test/distributions/bradc/assoc/userAssoc-domain-priv-check.chpl @@ -9,7 +9,7 @@ record MyMapper { } proc doit() { - var newDist = new dmap(new unmanaged Hashed(idxType=real, mapper=new MyMapper())); + var newDist = new hashedDist(idxType=real, mapper=new MyMapper()); var D: domain(real) dmapped newDist; diff --git a/test/distributions/bradc/assoc/userAssoc-domain-stress.chpl b/test/distributions/bradc/assoc/userAssoc-domain-stress.chpl index b9dcfe77d307..f5d82af9f3b9 100644 --- a/test/distributions/bradc/assoc/userAssoc-domain-stress.chpl +++ b/test/distributions/bradc/assoc/userAssoc-domain-stress.chpl @@ -4,7 +4,7 @@ use Random; config const requestCapacity = true; config const updatesPerLocale = 10000; -var D: domain(int) dmapped Hashed(idxType=int); +var D: domain(int) dmapped hashedDist(idxType=int); if requestCapacity then D.requestCapacity(updatesPerLocale*numLocales); diff --git a/test/distributions/bradc/assoc/userAssoc-fcf.chpl b/test/distributions/bradc/assoc/userAssoc-fcf.chpl index 9ba99b53bd8a..26f295c7d3fc 100644 --- a/test/distributions/bradc/assoc/userAssoc-fcf.chpl +++ b/test/distributions/bradc/assoc/userAssoc-fcf.chpl @@ -8,7 +8,7 @@ record MyMapper { } } -var newDist = new dmap(new unmanaged Hashed(idxType=real, mapper=new MyMapper())); +var newDist = hashedDist(idxType=real, mapper=new MyMapper()); var myMapper = proc(ind:real, targetLocs: Locales.type) { const numlocs = targetLocs.domain.size; @@ -16,7 +16,7 @@ var myMapper = proc(ind:real, targetLocs: Locales.type) { return indAsInt % numlocs; }; -var D: domain(real) dmapped Hashed(idxType=real, mapper=myMapper); +var D: domain(real) dmapped hashedDist(idxType=real, mapper=myMapper); D += 1.3; D += 22.0; diff --git a/test/distributions/ferguson/dist-assoc-assign.chpl b/test/distributions/ferguson/dist-assoc-assign.chpl index ee02aff87459..e40cbfbba964 100644 --- a/test/distributions/ferguson/dist-assoc-assign.chpl +++ b/test/distributions/ferguson/dist-assoc-assign.chpl @@ -1,6 +1,6 @@ use HashedDist; -var D: domain(real) dmapped Hashed(idxType=real); +var D: domain(real) dmapped hashedDist(idxType=real); D += 1.3; var localD: domain(real); diff --git a/test/distributions/ferguson/dist-assoc-bulkadd.chpl b/test/distributions/ferguson/dist-assoc-bulkadd.chpl index e2ed10127fd9..e674eb314627 100644 --- a/test/distributions/ferguson/dist-assoc-bulkadd.chpl +++ b/test/distributions/ferguson/dist-assoc-bulkadd.chpl @@ -1,6 +1,6 @@ use HashedDist; -var D: domain(real) dmapped Hashed(idxType=real); +var D: domain(real) dmapped hashedDist(idxType=real); var inds = [2.1, ]; diff --git a/test/distributions/ferguson/dist-assoc-writeln.chpl b/test/distributions/ferguson/dist-assoc-writeln.chpl index 204dbb3d89a2..fe89ca06cfbc 100644 --- a/test/distributions/ferguson/dist-assoc-writeln.chpl +++ b/test/distributions/ferguson/dist-assoc-writeln.chpl @@ -9,7 +9,7 @@ record MyMapper { } } -var D: domain(int) dmapped Hashed(idxType=int, mapper=new MyMapper()); +var D: domain(int) dmapped hashedDist(idxType=int, mapper=new MyMapper()); D += 0; D += 1; diff --git a/test/functions/generic/poi/hashed-dist-with-mapper.chpl b/test/functions/generic/poi/hashed-dist-with-mapper.chpl index 67ce6d5731e6..590744fe580e 100644 --- a/test/functions/generic/poi/hashed-dist-with-mapper.chpl +++ b/test/functions/generic/poi/hashed-dist-with-mapper.chpl @@ -11,7 +11,7 @@ specifically: } proc main() { var myMapper = new MyMapper(); - var D: domain(string) dmapped Hashed(idxType=string, mapper=myMapper); + var D: domain(string) dmapped hashedDist(idxType=string, mapper=myMapper); D += "zero"; } */ diff --git a/test/optimizations/autoLocalAccess/common.chpl b/test/optimizations/autoLocalAccess/common.chpl index ccc56074c748..fbe63582f9f6 100644 --- a/test/optimizations/autoLocalAccess/common.chpl +++ b/test/optimizations/autoLocalAccess/common.chpl @@ -33,8 +33,8 @@ proc createDom(space) { return space dmapped stencilDist(space, fluff=(1,1)); } } - else if distType == Hashed { - var D: domain(int) dmapped Hashed(idxType=int); + else if distType == hashedDist { + var D: domain(int) dmapped hashedDist(idxType=int); for i in space { D += i; } diff --git a/test/optimizations/autoLocalAccess/regularDeclaration.compopts b/test/optimizations/autoLocalAccess/regularDeclaration.compopts index c435fb342afd..83c907c9bba6 100644 --- a/test/optimizations/autoLocalAccess/regularDeclaration.compopts +++ b/test/optimizations/autoLocalAccess/regularDeclaration.compopts @@ -2,4 +2,4 @@ -sdistType=blockCycDist --report-auto-local-access -M$CHPL_HOME/test/optimizations/autoLocalAccess/ -sdistType=cyclicDist --report-auto-local-access -M$CHPL_HOME/test/optimizations/autoLocalAccess/ -sdistType=stencilDist --report-auto-local-access -M$CHPL_HOME/test/optimizations/autoLocalAccess/ --sdistType=Hashed --report-auto-local-access -M$CHPL_HOME/test/optimizations/autoLocalAccess/ +-sdistType=hashedDist --report-auto-local-access -M$CHPL_HOME/test/optimizations/autoLocalAccess/ diff --git a/test/studies/labelprop/labelprop-tweets.chpl b/test/studies/labelprop/labelprop-tweets.chpl index 19d0f50d73fa..29703ac87804 100644 --- a/test/studies/labelprop/labelprop-tweets.chpl +++ b/test/studies/labelprop/labelprop-tweets.chpl @@ -84,7 +84,7 @@ proc main(args:[] string) { // domain assignment in Hashed // Pairs is for collecting twitter user ID to user ID mentions if distributed { - var Pairs: domain( (int, int) ) dmapped Hashed(idxType=(int, int)); + var Pairs: domain( (int, int) ) dmapped hashedD(idxType=(int, int)); run(todo, Pairs); } else { var Pairs: domain( (int, int) ); From 70e77b84b9ffeeee1af93b9ba352247880fb270b Mon Sep 17 00:00:00 2001 From: Brad Chamberlain Date: Thu, 14 Sep 2023 23:33:54 -0700 Subject: [PATCH 3/4] Store mappers as unmanaged; fix typo --- Signed-off-by: Brad Chamberlain --- modules/dists/HashedDist.chpl | 8 ++++---- test/distributions/bradc/assoc/userAssoc-fcf.chpl | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/dists/HashedDist.chpl b/modules/dists/HashedDist.chpl index 164a00105712..7e75088272fa 100644 --- a/modules/dists/HashedDist.chpl +++ b/modules/dists/HashedDist.chpl @@ -121,14 +121,14 @@ record hashedDist : writeSerializable { type idxType; type mapperT; - forwarding const chpl_distHelp: chpl_PrivatizedDistHelper(unmanaged HashedImpl(idxType, mapperT)); + forwarding const chpl_distHelp: chpl_PrivatizedDistHelper(unmanaged HashedImpl(idxType, _to_unmanaged(mapperT))); proc init(type idxType, mapper:?t = new DefaultMapper(), targetLocales: [] locale = Locales) { const value = new unmanaged HashedImpl(idxType, mapper, targetLocales); this.idxType = idxType; - this.mapperT = t; + this.mapperT = _to_unmanaged(t); this.chpl_distHelp = new chpl_PrivatizedDistHelper( if _isPrivatized(value) then _newPrivatizedClass(value) @@ -138,7 +138,7 @@ record hashedDist : writeSerializable { proc init(_pid : int, _instance, _unowned : bool) { this.idxType = _instance.idxType; - this.mapperT = _instance.mapper.type; + this.mapperT = _to_unmanaged(_instance.mapper.type); this.chpl_distHelp = new chpl_PrivatizedDistHelper(_pid, _instance, _unowned); @@ -146,7 +146,7 @@ record hashedDist : writeSerializable { proc init(value) { this.idxType = value.idxType; - this.mapperT = value.mapper.type; + this.mapperT = _to_unmanaged(value.mapper.type); this.chpl_distHelp = new chpl_PrivatizedDistHelper( if _isPrivatized(value) then _newPrivatizedClass(value) diff --git a/test/distributions/bradc/assoc/userAssoc-fcf.chpl b/test/distributions/bradc/assoc/userAssoc-fcf.chpl index 26f295c7d3fc..116cd1af4be0 100644 --- a/test/distributions/bradc/assoc/userAssoc-fcf.chpl +++ b/test/distributions/bradc/assoc/userAssoc-fcf.chpl @@ -8,7 +8,7 @@ record MyMapper { } } -var newDist = hashedDist(idxType=real, mapper=new MyMapper()); +var newDist = new hashedDist(idxType=real, mapper=new MyMapper()); var myMapper = proc(ind:real, targetLocs: Locales.type) { const numlocs = targetLocs.domain.size; From 9b97eb4a4d78910752ea465f1dd1b5bd74bbb8bc Mon Sep 17 00:00:00 2001 From: Brad Chamberlain Date: Thu, 14 Sep 2023 23:40:52 -0700 Subject: [PATCH 4/4] Fix a typo --- Signed-off-by: Brad Chamberlain --- test/studies/labelprop/labelprop-tweets.chpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/studies/labelprop/labelprop-tweets.chpl b/test/studies/labelprop/labelprop-tweets.chpl index 29703ac87804..d4fdcfdcbecd 100644 --- a/test/studies/labelprop/labelprop-tweets.chpl +++ b/test/studies/labelprop/labelprop-tweets.chpl @@ -84,7 +84,7 @@ proc main(args:[] string) { // domain assignment in Hashed // Pairs is for collecting twitter user ID to user ID mentions if distributed { - var Pairs: domain( (int, int) ) dmapped hashedD(idxType=(int, int)); + var Pairs: domain( (int, int) ) dmapped hashedDist(idxType=(int, int)); run(todo, Pairs); } else { var Pairs: domain( (int, int) );