-
Notifications
You must be signed in to change notification settings - Fork 3
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
Use ArrayPartition
from RecursiveArrayTools.jl
#118
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #118 +/- ##
==========================================
+ Coverage 96.75% 96.93% +0.18%
==========================================
Files 17 17
Lines 1233 1176 -57
==========================================
- Hits 1193 1140 -53
+ Misses 40 36 -4 ☔ View full report in Codecov by Sentry. |
Thanks!
How often do you use this functionality? I would expect that this kind of slicing returns a
Maybe something weird is going on in the ODE solver? Could you maybe post a profile of the
While it's technically not breaking since no public API was changed, the change is big enough (and some people like you may have used this internal API). Since I don't really see a big cost of making a breaking release, I would label it as breaking. |
The profile shows that the time is spent within broadcasting of vector_of_array.jl. I think I'm hitting SciML/RecursiveArrayTools.jl#199. I will try to use an
👍 |
I switched to an |
VectorOfArray
from RecursiveArrayTools.jlArrayPartition
from RecursiveArrayTools.jl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good to me 👍
I have not looked at everything in detail - should I?
I think it would be nice to add some tests for allocations of a full solve
call to catch possible regressions like the one for VectorOfArrays
Do you have a timing similar to the one in your first post for the latest version? |
No, I think you don't need to look at everything in detail. Maybe a brief look in
I've added such tests in e94e833. Maybe something along those lines could also be interesting for a potential future package TrixiTest.jl, cf. trixi-framework/TrixiBase.jl#9?
Sure! this branch with ArrayPartition ──────────────────────────────────────────────────────────────────────────────
DispersiveSWE Time Allocations
─────────────────────── ────────────────────────
Tot / % measured: 191ms / 94.6% 254MiB / 99.6%
Section ncalls time %tot avg alloc %tot avg
──────────────────────────────────────────────────────────────────────────────
rhs! 5.60k 169ms 93.7% 30.2μs 248MiB 98.3% 45.4KiB
deta hyperbolic 5.60k 42.8ms 23.7% 7.64μs 90.3MiB 35.7% 16.5KiB
deta elliptic 5.60k 42.1ms 23.3% 7.52μs 22.6MiB 8.9% 4.12KiB
dv elliptic 5.60k 41.6ms 23.0% 7.42μs 22.6MiB 8.9% 4.12KiB
dv hyperbolic 5.60k 40.9ms 22.7% 7.31μs 113MiB 44.7% 20.6KiB
~rhs!~ 5.60k 1.74ms 1.0% 311ns 3.67KiB 0.0% 0.67B
source terms 5.60k 87.9μs 0.0% 15.7ns 0.00B 0.0% 0.00B
analyze solution 94 11.5ms 6.3% 122μs 4.38MiB 1.7% 47.7KiB
──────────────────────────────────────────────────────────────────────────────
|
The failing test on mac looks pretty weird and unrelated - but it failed consistently in this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
The CI failure is some homebrew failing stuff, so it's not your fault. I would just go ahead and merge this PR 👍 |
This simplifies the code as no wrapping between different data structures is necessary anymore.
I opted for a
VectorOfArray
instead of anArrayPartition
because, as I understand,VectorOfArray
s allow for something likeq[i, :]
orview(q, i, :)
, i.e. picking the values at one node for all variables, which would be more cumbersome for anArrayPartition
if I understand correctly. Are there any drawbacks of aVectorOfArray
compared toArrayPartition
, @ranocha?Unfortunately, there is still a huge performance bottleneck. Interestingly, this is outside of
rhs!
, see the timings belowOn main
On this branch
I'm not sure whether or not to consider this PR as breaking since it deletes the
wrap_array
, which was more or less internally. However, it would, e.g., break https://github.com/JoshuaLampert/2024_dispersive_shallow_water/blob/f62c32de647c2f9d6425130302d6ce7ae1d7de0a/code/traveling_wave/solution_k_0_8.jl#L38.Closes #111.