Skip to content

Switch VecOfArrays for RecursiveArrayTools's VectorOfArray#2952

Open
benegee wants to merge 10 commits into
mainfrom
bg/vec-of-arrays
Open

Switch VecOfArrays for RecursiveArrayTools's VectorOfArray#2952
benegee wants to merge 10 commits into
mainfrom
bg/vec-of-arrays

Conversation

@benegee

@benegee benegee commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Continuing #2491

@benegee benegee added refactoring Refactoring code without functional changes gpu labels Apr 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Review checklist

This checklist is meant to assist creators of PRs (to let them know what reviewers will typically look for) and reviewers (to guide them in a structured review process). Items do not need to be checked explicitly for a PR to be eligible for merging.

Purpose and scope

  • The PR has a single goal that is clear from the PR title and/or description.
  • All code changes represent a single set of modifications that logically belong together.
  • No more than 500 lines of code are changed or there is no obvious way to split the PR into multiple PRs.

Code quality

  • The code can be understood easily.
  • Newly introduced names for variables etc. are self-descriptive and consistent with existing naming conventions.
  • There are no redundancies that can be removed by simple modularization/refactoring.
  • There are no leftover debug statements or commented code sections.
  • The code adheres to our conventions and style guide, and to the Julia guidelines.

Documentation

  • New functions and types are documented with a docstring or top-level comment.
  • Relevant publications are referenced in docstrings (see example for formatting).
  • Inline comments are used to document longer or unusual code sections.
  • Comments describe intent ("why?") and not just functionality ("what?").
  • If the PR introduces a significant change or new feature, it is documented in NEWS.md with its PR number.

Testing

  • The PR passes all tests.
  • New or modified lines of code are covered by tests.
  • New or modified tests run in less then 10 seconds.

Performance

  • There are no type instabilities or memory allocations in performance-critical parts.
  • If the PR intent is to improve performance, before/after time measurements are posted in the PR.

Verification

  • The correctness of the code was verified using appropriate tests.
  • If new equations/methods are added, a convergence test has been run and the results
    are posted in the PR.

Created with ❤️ by the Trixi.jl community.

@benegee

benegee commented Apr 23, 2026

Copy link
Copy Markdown
Contributor Author

Still seems to work. CI failures are due to codecov issues.

@sloede

sloede commented Apr 23, 2026

Copy link
Copy Markdown
Member

I'm not sure I understand - you seem to have replaced some VecOfArray with VectorOfArray, but there is no additional using and nothing is removed. How is this possible 😉

@JoshuaLampert

JoshuaLampert commented Apr 23, 2026

Copy link
Copy Markdown
Member

I guess this file can now be removed, right @benegee? We already import VectorOfArray from RecursiveArrayTools.jl, see

using RecursiveArrayTools: VectorOfArray

@benegee

benegee commented Apr 23, 2026

Copy link
Copy Markdown
Contributor Author

Yes, exactly. I failed to delete the file while merging.

was re-added during merge

[skip ci]
@benegee benegee mentioned this pull request Apr 23, 2026
31 tasks

@sloede sloede left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As far as I can tell, the main difference is that now we have to wrap the outer vector of vectors in a VectorOfArray and then access the inner vector/array with val.u[i] instead of val[i], is that correct?

Have you verified (for at least one 3D run maybe) that there are no differences in performance and memory allocations (especially with multithreading)?

# Buffer to copy solution values of the large element in the correct orientation
# before interpolating
u_buffer = cache.u_threaded[Threads.threadid()]
u_buffer = cache.u_threaded.u[Threads.threadid()]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks a bit odd :D But I guess this is what we get from using VectorOfArray. The .u might be a bit confusing, though

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would it make sense to hide it? I.e., store the VectorOfArray in cache.__u_threaded and then cache.u_threaded = cache.__u_threaded.u?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't know, it is a bit unfortunate that both for us and VectorOfArray u plays such a central role

@benegee

benegee commented Apr 28, 2026

Copy link
Copy Markdown
Contributor Author

As far as I can tell, the main difference is that now we have to wrap the outer vector of vectors in a VectorOfArray and then access the inner vector/array with val.u[i] instead of val[i], is that correct?

Yes!

This is what happened:

Would it make sense to hide it? I.e., store the VectorOfArray in cache.__u_threaded and then cache.u_threaded = cache.__u_threaded.u?

Well, that could work!

Have you verified (for at least one 3D run maybe) that there are no differences in performance and memory allocations (especially with multithreading)?

No, I haven't. We would need to compare the old Vector{Vector} implementation with the new one.

@codecov

codecov Bot commented Apr 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.14%. Comparing base (295379b) to head (0f46cc1).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2952      +/-   ##
==========================================
+ Coverage   97.13%   97.14%   +0.01%     
==========================================
  Files         623      622       -1     
  Lines       48385    48367      -18     
==========================================
- Hits        46996    46985      -11     
+ Misses       1389     1382       -7     
Flag Coverage Δ
unittests 97.14% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

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

Labels

gpu refactoring Refactoring code without functional changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants