Skip to content

xp.diff is slow for distributed arrays #4230

Closed
Closed

Description

@ShreyasKhandekar

xp.diff is pretty slow in Arkouda. It uses no parallelism for the 1st order difference and that makes it really slow for distributed arrays.
Also it is written in a way that adds a lot of overhead for 1D arrays and should probably be optimized for that case.

Activity

  1. added
    Array API
    Chapel
    enhancement
    on Apr 8, 2025
  2. ShreyasKhandekar commented on Apr 10, 2025

    @ShreyasKhandekar
    ContributorAuthor

    This is due to the following lines of code:

    arkouda/src/UtilMsg.chpl

    Lines 56 to 59 in 0a7850b

    const outDom = subDomain(x.shape, axis, n);
    if n == 1 {
    // 1st order difference: requires no temporary storage
    var y = makeDistArray(outDom, t);

    Here we pass the domain we get from subDomain which returns a DefaultRectangular domain to makeDistArray and we hit the bug where makeDistArray does not really make a distributed array: #4233

  3. e-kayrakli commented on Apr 11, 2025

    @e-kayrakli
    Contributor

    Without digging too deep, that subDomain call there also looks a bit less than ideal to me. Why does it take .shape of an array/domain and not simply a domain? The "shape" of a domain does not have any distribution info, whereas I would expect a call named subDomain to generate a subdomain with the same distribution such that it is aligned with its parent domain.

    This is definitely not to say that what makeDistArray does is right, though.

  4. ShreyasKhandekar commented on Apr 11, 2025

    @ShreyasKhandekar
    ContributorAuthor

    a call named subDomain to generate a subdomain with the same distribution such that it is aligned with its parent domain.

    I agree that the subDomain would have the same distribution, but I'm not sure if it should be aligned with the parent domain in Arkouda since Arkouda may expect arrays of a certain size to all have the same distribution for good performance. That can be hurt by this. Brad had similar thoughts where aligning the domains would lead to good performance in this function, but problems in subsequent operations. I am open to changing my mind on this, but it would require a good amount of bookkeeping/structural setup to manage this cleanly.

  5. e-kayrakli commented on Apr 11, 2025

    @e-kayrakli
    Contributor

    That's a good point.

  6. ShreyasKhandekar commented on Apr 17, 2025

    @ShreyasKhandekar
    ContributorAuthor

    Resolved by #4242

  7. e-kayrakli commented on May 9, 2025

    @e-kayrakli
    Contributor

    @ShreyasKhandekar should we close this?

  8. ShreyasKhandekar commented on May 9, 2025

    @ShreyasKhandekar
    ContributorAuthor

    Yes, thanks! I thought it would auto-close once the PR was merged.

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

Metadata

Metadata

Labels

Array APIChapelenhancement

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions