Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DynRankView: make layout() return the same as a corresponding static View #5026

Merged
merged 2 commits into from
Jul 19, 2022

Conversation

PhilMiller
Copy link
Contributor

No description provided.

@PhilMiller
Copy link
Contributor Author

Replaces #4775

@PhilMiller PhilMiller marked this pull request as draft May 25, 2022 15:14
@PhilMiller
Copy link
Contributor Author

This got opened because I needed to move away from branches in the NGA repository to a personal fork, so maintainers can push changes on PRs if needed. The comments on the predecessor PR indicate why this shouldn't be merged as is.

@PhilMiller
Copy link
Contributor Author

#5188 potentially unblocks this

@PhilMiller
Copy link
Contributor Author

This test code that I needed to pass now passes:

    Kokkos::View<double****> u("foo", 1, 2, 3, 4);

    auto ulayout = u.layout();
    ASSERT_EQ(ulayout.dimension[0], 1);
    ASSERT_EQ(ulayout.dimension[1], 2);
    ASSERT_EQ(ulayout.dimension[2], 3);
    ASSERT_EQ(ulayout.dimension[3], 4);
    ASSERT_EQ(ulayout.dimension[4], KOKKOS_INVALID_INDEX);
    ASSERT_EQ(ulayout.dimension[5], KOKKOS_INVALID_INDEX);
    ASSERT_EQ(ulayout.dimension[6], KOKKOS_INVALID_INDEX);
    ASSERT_EQ(ulayout.dimension[7], KOKKOS_INVALID_INDEX);

@PhilMiller PhilMiller marked this pull request as ready for review July 14, 2022 02:11
@PhilMiller
Copy link
Contributor Author

retest this please

Copy link
Contributor

@masterleinad masterleinad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it advantageous for DynRankView to return the layout of the corresponding View instead of what it does currently?

@PhilMiller
Copy link
Contributor Author

It allows easy construction of a View or DRV with matching rank and extent, and thus deep_copy between them.

@PhilMiller
Copy link
Contributor Author

Also, generally, it's weird that the rank of the DRV doesn't match the rank described by its layout

Copy link
Contributor

@masterleinad masterleinad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think this makes more sense than always returning a 7-dim layout.

@crtrott crtrott merged commit 296be8c into kokkos:develop Jul 19, 2022
Developer: Phil Miller automation moved this from In Review to Done, pending release Jul 19, 2022
@PhilMiller PhilMiller deleted the drv-layout branch July 27, 2022 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Developer: Phil Miller
Done in Release 3.7
Development

Successfully merging this pull request may close these issues.

None yet

5 participants