Skip to content

Add array::View interoperability with mdspan #304

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

Merged
merged 4 commits into from
Jul 18, 2025

Conversation

wdeconinck
Copy link
Member

@wdeconinck wdeconinck commented Jul 17, 2025

With this PR, following API is added to array::View:

  • array::View view{mdspan} constructor
  • auto mdspan = view.as_mdspan() function to create an mdspan.

Due to general assumptions of array::View, the as_mdspan() function creates a mdspan with layout_stride and fully dynamic extents:

mdspan<T, dextents<size_t,rank>, layout_stride, default_accessor<T>>

The array::IndexView follows a similar API, but the as_mdspan() function creates a mdspan with index_accessor, to convert contain values (indices) to base 1 when Fortran is used.

mdspan<T, dextents<size_t,rank>, layout_stride, index_accessor<T,ATLAS_HAVE_FORTRAN>>

💣💥☠️ Static Analyzer Report ☠️💥💣
https://sites.ecmwf.int/docs/atlas/static-analyzer/PR-304

@wdeconinck wdeconinck force-pushed the feature/mdspan_interoperability branch from 810b321 to 1ad3b48 Compare July 17, 2025 19:46
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 73.19588% with 26 lines in your changes missing coverage. Please review.

Project coverage is 79.58%. Comparing base (cdbb4dc) to head (1ad3b48).
Report is 6 commits behind head on develop.

Files with missing lines Patch % Lines
src/atlas/array/native/NativeArrayView.h 0.00% 12 Missing ⚠️
src/atlas/array/native/NativeIndexView.h 25.00% 12 Missing ⚠️
src/atlas/array/LocalView.h 88.88% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #304      +/-   ##
===========================================
+ Coverage    79.11%   79.58%   +0.46%     
===========================================
  Files          895      895              
  Lines        59956    68911    +8955     
===========================================
+ Hits         47435    54842    +7407     
- Misses       12521    14069    +1548     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wdeconinck wdeconinck merged commit 99a0b18 into develop Jul 18, 2025
206 of 207 checks passed
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.

2 participants