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
compare meshes, unify signatures, and improve performance #550
Conversation
…ured mesh solver for Euler 2D
Codecov Report
@@ Coverage Diff @@
## main #550 +/- ##
==========================================
- Coverage 93.87% 93.84% -0.03%
==========================================
Files 138 138
Lines 13799 13847 +48
==========================================
+ Hits 12954 12995 +41
- Misses 845 852 +7
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
We have a few questions, but otherwise everything looks good to us (and more tidied up than before).
@inline function calc_interface_flux!(surface_flux_values, left_element, right_element, | ||
orientation, u, | ||
mesh::CurvedMesh{3}, equations, | ||
dg::DG, cache) |
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.
Is there a convention how to split lines like this?
It seems like you had to change this everywhere in our code.
We would've tried to make the line lengths as similar as possible, for example:
@inline function calc_interface_flux!(surface_flux_values, left_element, right_element, | |
orientation, u, | |
mesh::CurvedMesh{3}, equations, | |
dg::DG, cache) | |
@inline function calc_interface_flux!(surface_flux_values, left_element, right_element, | |
orientation, u, mesh::CurvedMesh{3}, | |
equations, dg::DG, cache) |
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.
Making the line lengths similar is usually a good approach and I wouldn't say that your version before was somehow "wrong" in any sense. It was just much more convenient for me to shorten some lines a bit when working with multiple open files next to each other (which was helpful to keep consistency between different files).
A rough rule of thumb that I often use is
- not to split arguments belonging to each other such as
nonconservative_terms, equations
- to put arguments important for dispatch often at the beginning of lines to stress their importance
Co-authored-by: erik-f <44124897+erik-f@users.noreply.github.com>
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.
LGTM in general.
So what does this PR mean for numerical fluxes in curved meshes: flux_lax_friedrichs
can directly be used in a curved way, so does flux
, but all other numerical fluxes would have to be fixed?
Yes, exactly. Alternatively, other numerical fluxes can use |
This sounds like a good compromise to me. However, this should definitely be introduced at the next Trixi meeting and preferably also captured in the docs, as it is not 100% clear from reading the code alone |
Co-authored-by: Michael Schlottke-Lakemper <michael@sloede.com>
Thanks a lot for the docs, @ranocha! |
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.
LGTM! Maybe you need to add Downloads
to the [deps]
in benchmark/Project.toml
? If not, feel free to merge once all tests pass and coverage is ok
I used the following code to compare the performance of our different mesh types (running Julia v1.6 with
julia --check-bounds=no --threads=1
).Using the changes made in this PR, I get (showing only the benchmarks for
rhs!
)On
main
without the change fromFluxRotated(flux_lax_friedrichs)
toflux_lax_friedrichs
with a specialization offlux
tonormal::AbstractVector
instead oforientation::Integer
, theCurvedMesh
has an additional overhead of ca.25 μs
, which is roughly 25% of the total time forrhs!
.The
UnstructuredMesh
has the variant ofFluxRotated
hard-coded right now, so it didn't benefit immediately. Hence, we should switch to the same version used for theCurvedMesh
.Results from Rocinante using one thread at ccafced
["2d", "elixir_euler_nonperiodic_curved.jl", "p3_rhs!"]
["2d", "elixir_euler_nonperiodic_curved.jl", "p7_rhs!"]
["3d", "elixir_euler_nonperiodic_curved.jl", "p3_rhs!"]
["3d", "elixir_euler_nonperiodic_curved.jl", "p7_rhs!"]
TODO
rhs!
to dispatch on themesh
normal::AbstractVector
to improve performanceFluxRotated
in elixirs (but keep one example for CI)FluxRotated
, performance)TODO: Meshes
(also tracked in Consolidate mesh infrastructure after adding structured and unstructured ones #542)Closes #506, closes #515