Skip to content

makeDistArray can return a non-distributed array #4233

Closed

Description

@ShreyasKhandekar

Describe the bug
makeDistArray has overloads which accepts a domain, and do not check if the domain is distributed. Therefore the array we get from makeDistArray can be non-distributed. Which can lead to surprising behavior and bad performance.

See

proc makeDistArray(D: domain(?), type etype) throws
where D.rank == 1
{
var res = D.tryCreateArray(etype);
return res;
}
proc makeDistArray(D: domain(?), type etype) throws
where D.rank > 1
{
var res: [D] etype;
return res;
}
proc makeDistArray(D: domain(?), initExpr: ?t) throws
where D.rank == 1
{
return D.tryCreateArray(t, initExpr);
}
proc makeDistArray(D: domain(?), initExpr: ?t) throws
where D.rank > 1
{
var res: [D] t = initExpr;
return res;
}
for the source code of makeDistArray.

Proposed Solution

My recommendation here is that we should modify these overloads to check if D is distributed and if it isn't, call makeDistDom to get a distributed domain instead.

Is this a Blocking Issue

  • Are there any known work-arounds? No

Activity

  1. added
    bug
    Chapel
    performance
    important
    on Apr 10, 2025
  2. ShreyasKhandekar commented on Apr 10, 2025

    @ShreyasKhandekar
    ContributorAuthor

    This was exposed when working on #4230, where we pass a non distributed domain to makeDistArray which was leading to bad performance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Chapelbugimportantperformance

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions