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

Implement to_mdspan #244

Open
jefffaust opened this issue Mar 7, 2023 · 3 comments
Open

Implement to_mdspan #244

jefffaust opened this issue Mar 7, 2023 · 3 comments

Comments

@jefffaust
Copy link

This proposal describes to_mdspan.

I would find this quite useful, especially if it would work when dequeu is the underlying mdarray container.

@mhoemmen
Copy link
Contributor

mhoemmen commented Mar 8, 2023

@jefffaust Thanks for your interest! The mdarray class template requires that the container be contiguous. deque is not a contiguous container.

The main benefit of deque is that insertion or deletion at its beginning or end does not invalidate pointers or references to the other elements. However, mdarray cannot be resized after creation, so this benefit does not apply.

One could write a custom mdspan accessor to view the elements of a deque.

@jefffaust
Copy link
Author

jefffaust commented Mar 9, 2023 via email

@mhoemmen
Copy link
Contributor

mhoemmen commented Mar 9, 2023

@jefffaust wrote:

...we're getting a lot of benefit from mdspan and mdarray.

We're delighted to hear that! Thank you for the feedback! : - )

Regarding mdarray requiring a contiguous container: the general principle is that views are more general than containers. span can represent any 1-D contiguous array view, while vector represents a more specific use case (dynamic allocation, $O(1)$ move, can be resized, resizing may invalidate iterators). Other people may want other contiguous containers with different properties (e.g., array with its compile-time size and aggregate initialization, or static_vector with its compile-time capacity but run-time size), but span can represent a view of any of these. Similarly, mdspan can represent just about any multidimensional array view (it doesn't even require that elements exist in memory, let alone that the memory be contiguous), while mdarray covers the more specific use case of multidimensional arrays with an underlying contiguous container. Just as vector doesn't serve all contiguous container use cases, mdarray doesn't serve all multidimensional array container use cases. However, mdspan can view the elements of just about any multidimensional array container a user might want to write.

mhoemmen added a commit to mhoemmen/mdspan that referenced this issue Jul 26, 2023
The sequential implementation of triangular_matrix_matrix_solve
for the lower triangular, right side case had a j loop that was
counting in the wrong direction: up, instead of down.

This commit fixes that, and adds a regression test.
The test also uncovered a compilation bug that this commit fixes.

Fixes kokkos#244.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants