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 XTensor support in core. #976

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Implement XTensor support in core. #976

wants to merge 4 commits into from

Conversation

1uc
Copy link
Collaborator

@1uc 1uc commented Apr 5, 2024

Adds support for xt::xtensor, both row and column major. We're missing xt::xarray and views. Views fail because they claim to have runtime variable rank.

@codecov-commenter
Copy link

codecov-commenter commented Apr 8, 2024

Codecov Report

Attention: Patch coverage is 88.52459% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 86.64%. Comparing base (5bd727d) to head (05491c5).
Report is 1 commits behind head on master.

Files Patch % Lines
include/highfive/bits/H5Inspector_misc.hpp 70.00% 6 Missing ⚠️
include/highfive/boost.hpp 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #976      +/-   ##
==========================================
+ Coverage   86.48%   86.64%   +0.15%     
==========================================
  Files          97       97              
  Lines        5951     5999      +48     
==========================================
+ Hits         5147     5198      +51     
+ Misses        804      801       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@1uc 1uc marked this pull request as ready for review April 8, 2024 10:56
@pramodk pramodk requested a review from alkino April 8, 2024 13:21
Comment on lines 37 to 45
val.resize(shape);
}
Copy link
Member

Choose a reason for hiding this comment

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

no recursivity here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

None of it works with non-trivial elements. I should check if they even allow anything non-trivial.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We're now asserting the fact. I propose we revisit, if we ever need to support them.

@1uc 1uc requested a review from alkino April 19, 2024 14:16
@1uc
Copy link
Collaborator Author

1uc commented May 6, 2024

@alkino The reason for not allowing non-trivial elements, is that this way we can use xt::adapt which also paves the way for implementing all other flavours of xt objects. With the same idea we will be able to take any xt object, and assign it to (read it from) memory we've wrapped with an xt::adapt. This idea works for row-/column-major and stridded/padded arrays.

It doesn't work for anything that contains non-trivial elements.

The commit removes the requirement for a constexpr rank. Instead
containers need a minimum and maximum constexpr rank.

The difficulties are:

  * Empty arrays can't figure out their runtime rank. This is an issue
    when deducing the dimension when writing to disk. The "solution" is
    to deduce with lowest rank possible.
1uc added 2 commits May 14, 2024 10:32
Adds support for `xt::xtensor`, `xt::xarray` and `xt::xview`, both row
and column major. This works by wrapping the internal row-major with
`xt::adapt`. Therefore, the `T` in `xt::xtensor<T, ...>` must be scalar
(trivial).
@1uc 1uc marked this pull request as draft May 14, 2024 10:27
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

Successfully merging this pull request may close these issues.

None yet

3 participants