Skip to content

Commit

Permalink
Rename Replicated to replicatedDist (chapel-lang#23342)
Browse files Browse the repository at this point in the history
[reviewed by @jabraham17]

This renames `Replicated` to `replicatedDist`, similar to what we've
done for `Block`, `Cyclic`, and `Stencil` in previous PRs.
  • Loading branch information
bradcray authored Sep 13, 2023
2 parents 6eb2f16 + c6bb384 commit cd18649
Show file tree
Hide file tree
Showing 34 changed files with 78 additions and 70 deletions.
37 changes: 21 additions & 16 deletions modules/dists/ReplicatedDist.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// THE REPLICATED DISTRIBUTION IMPLEMENTATION
//
// Classes defined:
// Replicated -- Global distribution descriptor
// ReplicatedImpl -- Global distribution descriptor
// ReplicatedDom -- Global domain descriptor
// LocReplicatedDom -- Local domain descriptor
// ReplicatedArr -- Global array descriptor
Expand Down Expand Up @@ -51,12 +51,12 @@ config param traceReplicatedDist = false;
// nicer example - pull from primers/distributions.chpl

/*
This Replicated distribution causes a domain and its arrays
This ``replicatedDist`` distribution causes a domain and its arrays
to be replicated across the desired locales (all the locales by default).
An array receives a distinct set of elements - a "replicand" -
allocated on each locale.
In other words, a Replicated-distributed domain has
In other words, a replicated-distributed domain has
an implicit additional dimension - over the locales,
making it behave as if there is one copy of its indices per locale.
Expand All @@ -77,7 +77,7 @@ referring to the domain or array.
.. code-block:: chapel
const Dbase = {1..5}; // A default-distributed domain
const Drepl = Dbase dmapped Replicated();
const Drepl = Dbase dmapped replicatedDist();
var Abase: [Dbase] int;
var Arepl: [Drepl] int;
Expand All @@ -96,13 +96,13 @@ distribution.
**Initializer Arguments**
The ``Replicated`` class initializer is defined as follows:
The ``replicatedDist`` class initializer is defined as follows:
.. code-block:: chapel
proc Replicated.init(
proc replicatedDist.init(
targetLocales: [] locale = Locales,
purposeMessage: string = "used to create a Replicated")
purposeMessage: string = "used to create a replicatedDist")
The optional ``purposeMessage`` may be useful for debugging
when the initializer encounters an error.
Expand All @@ -116,11 +116,11 @@ when the initializer encounters an error.


pragma "ignore noinit"
record Replicated {
record replicatedDist {
forwarding const chpl_distHelp: chpl_PrivatizedDistHelper(unmanaged ReplicatedImpl);

proc init(targetLocales: [] locale = Locales,
purposeMessage = "used to create a Replicated") {
purposeMessage = "used to create a replicatedDist") {
const value = new unmanaged ReplicatedImpl(targetLocales, purposeMessage);

this.chpl_distHelp = new chpl_PrivatizedDistHelper(
Expand All @@ -147,23 +147,23 @@ record Replicated {
// 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 : Replicated) {
proc init=(const ref other : replicatedDist) {
this.init(other._value.dsiClone());
}

proc clone() {
return new Replicated(this._value.dsiClone());
return new replicatedDist(this._value.dsiClone());
}

@chpldoc.nodoc
inline operator ==(d1: Replicated, d2: Replicated) {
inline operator ==(d1: replicatedDist, d2: replicatedDist) {
if (d1._value == d2._value) then
return true;
return d1._value.dsiEqualDMaps(d2._value);
}

@chpldoc.nodoc
inline operator !=(d1: Replicated, d2: Replicated) {
inline operator !=(d1: replicatedDist, d2: replicatedDist) {
return !(d1 == d2);
}

Expand All @@ -179,6 +179,11 @@ record Replicated {
}


@deprecated("'Replicated' is deprecated, please use 'replicatedDist' instead")
type Replicated = replicatedDist;



@chpldoc.nodoc
class ReplicatedImpl : BaseDist {
var targetLocDom : domain(here.id.type);
Expand All @@ -191,7 +196,7 @@ class ReplicatedImpl : BaseDist {
// initializer: replicate over the given locales
// (by default, over all locales)
proc ReplicatedImpl.init(targetLocales: [] locale = Locales,
purposeMessage: string = "used to create a Replicated")
purposeMessage: string = "used to create a replicatedDist")
{
init this;

Expand Down Expand Up @@ -442,9 +447,9 @@ iter ReplicatedDom.these(param tag: iterKind, followThis) where tag == iterKind.

proc ReplicatedDom.dsiGetDist() {
if _isPrivatized(dist) then
return new Replicated(dist.pid, dist, _unowned=true);
return new replicatedDist(dist.pid, dist, _unowned=true);
else
return new Replicated(nullPid, dist, _unowned=true);
return new replicatedDist(nullPid, dist, _unowned=true);
}

override proc ReplicatedDom.dsiDestroyDom() {
Expand Down
10 changes: 5 additions & 5 deletions modules/packages/ReplicatedVar.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Limitations:
.. code-block:: chapel
var replArray: [MyDomain dmapped Replicated()] real;
var replArray: [MyDomain dmapped replicatedDist()] real;
.. _ReplicatedVar_basic-usage:
Expand Down Expand Up @@ -84,7 +84,7 @@ modify the above variable declarations as follows:
.. code-block:: chapel
var myRepVar: [rcDomainBase dmapped Replicated(myLocales,
var myRepVar: [rcDomainBase dmapped replicatedDist(myLocales,
"over which to replicate 'myRepVar'")] MyType;
var collected: [myLocales.domain] MyType;
Expand All @@ -106,11 +106,11 @@ private const rcDomainIx = 1; // todo convert to param
as shown :ref:`above <ReplicatedVar_subset-of-locales>`. */
const rcDomainBase = {rcDomainIx..rcDomainIx};
private const rcLocales = Locales;
private const rcDomainMap = new Replicated(rcLocales);
private const rcDomainMap = new replicatedDist(rcLocales);
/* Use this domain to declare a user-level replicated variable,
as shown :ref:`above <ReplicatedVar_basic-usage>` . */
const rcDomain = rcDomainBase dmapped rcDomainMap;
private param _rcErr1 = " must be 'rcDomain' or 'rcDomainBase dmapped Replicated(an array of locales)'";
private param _rcErr1 = " must be 'rcDomain' or 'rcDomainBase dmapped replicatedDist(an array of locales)'";

private proc _rcTargetLocalesHelper(replicatedVar: [?D])
where isReplicatedArr(replicatedVar)
Expand Down Expand Up @@ -236,7 +236,7 @@ proc rcExampleOverLocales(initVal: ?MyType, newVal: MyType, newLocale: locale,

// declare a replicated variable
// DIFFERENT from rcExample(): the domain in myRepVar's type
var myRepVar: [rcDomainBase dmapped Replicated(localesToReplicateOver,
var myRepVar: [rcDomainBase dmapped replicatedDist(localesToReplicateOver,
"over which to replicate 'myRepVar' in rcExampleOverLocales()")] MyType;

// initialize all copies to 'initVal'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ operator R.=(ref lhs:R, rhs:R) {


proc makeInitialArray() {
var D = {1..1} dmapped Replicated();
var D = {1..1} dmapped replicatedDist();
var ret: [D] int;
return ret;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ record R {
}
proc deinit() {

// Replicated is the only distribution where a 1 element array will print
// replicatedDist is the only distribution where a 1 element array will print
// out more than one deinit call for the element (on a multilocale run
// with N locales, there are N elements, one for each replicand). Deinit
// order in such a situation is nondeterministic, so don't bother.
Expand Down Expand Up @@ -69,7 +69,7 @@ proc makeInitialArray() {
var ret: [D] int;
return ret;
} else if distType == DistType.replicated {
var D = {1..1} dmapped Replicated();
var D = {1..1} dmapped replicatedDist();
var ret: [D] int;
return ret;
} else if distType == DistType.stencil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ proc makeA() {
var ret: [D] int;
return ret;
} else if distType == DistType.replicated {
var D = {1..1} dmapped Replicated();
var D = {1..1} dmapped replicatedDist();
var ret: [D] int;
return ret;
} else if distType == DistType.stencil {
Expand Down
5 changes: 4 additions & 1 deletion test/deprecated/dmapType.good
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ dmapType.chpl:8: warning: 'Block' is deprecated, please use 'blockDist' instead
dmapType.chpl:14: warning: 'Cyclic' is deprecated, please use 'cyclicDist' instead
dmapType.chpl:18: warning: 'Cyclic' is deprecated, please use 'cyclicDist' instead
dmapType.chpl:18: warning: 'Cyclic' is deprecated, please use 'cyclicDist' instead
dmapType.chpl:24: warning: 'Replicated' is deprecated, please use 'replicatedDist' instead
dmapType.chpl:28: warning: 'Replicated' is deprecated, please use 'replicatedDist' instead
dmapType.chpl:28: warning: 'Replicated' is deprecated, please use 'replicatedDist' instead
dmapType.chpl:34: warning: 'Stencil' is deprecated, please use 'stencilDist' instead
dmapType.chpl:38: warning: 'Stencil' is deprecated, please use 'stencilDist' instead
dmapType.chpl:38: warning: 'Stencil' is deprecated, please use 'stencilDist' instead
Expand All @@ -20,6 +23,6 @@ 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
cyclicDist(1,int(64))
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
Replicated
replicatedDist
0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
stencilDist(1,int(64),false)
2 changes: 1 addition & 1 deletion test/distributions/bradc/ReplWithMultiDim.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ use ReplicatedDist;

const Space = {1..8, 1..8};
const OneLocOnly: [0..0, 0..0] locale = Locales[0];
const R2 = Space dmapped Replicated(targetLocales=OneLocOnly);
const R2 = Space dmapped replicatedDist(targetLocales=OneLocOnly);
writeln(R2);
6 changes: 3 additions & 3 deletions test/distributions/bradc/distEquality.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ writeln();

const OneLocOnly1D: [0..0] locale = Locales[0];

const R1 = Space dmapped Replicated();
const R2 = Space dmapped Replicated(targetLocales=OneLocOnly1D);
const R1 = Space dmapped replicatedDist();
const R2 = Space dmapped replicatedDist(targetLocales=OneLocOnly1D);

writeln("Replicated comparisons:");

Expand All @@ -97,4 +97,4 @@ writeln(R1.distribution == R2.distribution);

writeln(R2.distribution == R2.distribution);

writeln(R2.distribution == (Space dmapped Replicated(targetLocales=OneLocOnly1D)).distribution);
writeln(R2.distribution == (Space dmapped replicatedDist(targetLocales=OneLocOnly1D)).distribution);
2 changes: 1 addition & 1 deletion test/distributions/bradc/passDistDomsToFns.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ proc fooBC(X:[BlkCycSpace] int) {
}


const ReplicatedSpace = Space dmapped Replicated();
const ReplicatedSpace = Space dmapped replicatedDist();
var RA: [ReplicatedSpace] int;
fooR(RA);
proc fooR(X:[ReplicatedSpace] int) {
Expand Down
2 changes: 1 addition & 1 deletion test/distributions/dm/hplx.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use ReplicatedDist;
config const blk = 5, fac=10;
const n = blk*fac;

const Dist2D = new Replicated();
const Dist2D = new replicatedDist();

proc main() {
const AbD: domain(2) dmapped Dist2D = {1..n, 1..n};
Expand Down
2 changes: 1 addition & 1 deletion test/distributions/replicated/ReplicatedMemLeak.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ operator r.=(ref lhs: r, const ref rhs: r) {
rhs.ptr.x += 1;
}

var d1 = {0..0} dmapped Replicated();
var d1 = {0..0} dmapped replicatedDist();
var a1: [d1] r;

proc test() {
Expand Down
2 changes: 1 addition & 1 deletion test/distributions/replicated/ReplicatedNonCopyable.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use ReplicatedDist;
class C { var x = 0; }

proc test() {
var d = {0..0} dmapped Replicated();
var d = {0..0} dmapped replicatedDist();
var a: [d] owned C;
}
test();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var Grid: [GridD] locale = for i in 0..#numLocales do Locales[numLocales-1-i];

writeln("Grid is: ", Grid);

const D = {1..3} dmapped Replicated(Grid);
const D = {1..3} dmapped replicatedDist(Grid);
var A: [D] real;

coforall loc in Locales with (ref A) do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var Grid: [GridD] locale = for i in 0..#numLocales do Locales[numLocales-1-i];

writeln("Grid is: ", Grid);

const D = {1..3} dmapped Replicated(Grid);
const D = {1..3} dmapped replicatedDist(Grid);
var A: [D] real;

coforall loc in Locales with (ref A) do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var Grid = reshape(Locales, GridD);

writeln("Grid is: ", Grid);

const D = {1..3} dmapped Replicated(Grid);
const D = {1..3} dmapped replicatedDist(Grid);
var A: [D] real;

coforall loc in Locales with (ref A) do
Expand Down
2 changes: 1 addition & 1 deletion test/distributions/replicated/initStridedWithDense.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ use ReplicatedDist;
// Once upon a time this program would fail to compile due to an
// incorrectly-written 'dsiAssignDomain.'

var D : domain(1, strides=strideKind.any) dmapped Replicated() = {1..10};
var D : domain(1, strides=strideKind.any) dmapped replicatedDist() = {1..10};
writeln(D);
6 changes: 3 additions & 3 deletions test/distributions/replicated/remoteOwnership.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ config const n = 11;


// test a standard block distribution
const D = {1..n, 1..n} dmapped Replicated();
const D = {1..n, 1..n} dmapped replicatedDist();
var A: [D] real;

testit(D, A);
Expand All @@ -17,7 +17,7 @@ if (numLocales == 4) {
targetLocs[2,1] = Locales[0];
targetLocs[2,2] = Locales[2];

const D = {1..n, 1..n} dmapped Replicated(targetLocales = targetLocs);
const D = {1..n, 1..n} dmapped replicatedDist(targetLocales = targetLocs);
var A: [D] real;

testit(D, A);
Expand All @@ -34,7 +34,7 @@ if (numLocales == 4) {
targetLocs[1,1] = Locales[3];
targetLocs[1,2] = Locales[1];

const D = {1..n, 1..n} dmapped Replicated(targetLocales = targetLocs);
const D = {1..n, 1..n} dmapped replicatedDist(targetLocales = targetLocs);
var A: [D] real;

testit(D, A);
Expand Down
2 changes: 1 addition & 1 deletion test/distributions/replicated/repl-int-error.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use ReplicatedDist;

config const n = 8;
const Space = {1..n, 1..n};
const ReplicatedSpace = Space dmapped Replicated();
const ReplicatedSpace = Space dmapped replicatedDist();
var RA: [ReplicatedSpace] int;

coforall loc in Locales with (ref RA) do
Expand Down
2 changes: 1 addition & 1 deletion test/distributions/replicated/scanReplicated.chpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use ReplicatedDist;

var D = {1..5} dmapped Replicated();
var D = {1..5} dmapped replicatedDist();
var A: [D] int;

for loc in Locales do
Expand Down
2 changes: 1 addition & 1 deletion test/distributions/replicated/testReplWrites.chpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use ReplicatedDist;

const D = {1..3, 1..3} dmapped Replicated();
const D = {1..3, 1..3} dmapped replicatedDist();

var A: [D] real;

Expand Down
2 changes: 1 addition & 1 deletion test/distributions/replicated/testReplicand.chpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use ReplicatedDist;

var locD = {1..5};
var D = locD dmapped Replicated();
var D = locD dmapped replicatedDist();

var A: [D] int;

Expand Down
2 changes: 1 addition & 1 deletion test/distributions/replicated/testUserAPI.chpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require "../../domains/userAPI/domainAPItest.chpl";
use domainAPItest only testDomainAPI2D as doTestDomainAPI2D;

proc testDomainAPI2D(param lbl, DR: domain(?), idx, OOBidx1, OOBidx2, intDom) {
doTestDomainAPI2D(lbl, DR dmapped Replicated(), idx, OOBidx1, OOBidx2, intDom);
doTestDomainAPI2D(lbl, DR dmapped replicatedDist(), idx, OOBidx1, OOBidx2, intDom);
}

proc main {
Expand Down
Loading

0 comments on commit cd18649

Please sign in to comment.