-
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
Add macro trixi_include_changeprecision
to make a double precision elixir run with single precision
#35
base: main
Are you sure you want to change the base?
Conversation
Pull Request Test Coverage Report for Build 12471675311Details
💛 - Coveralls |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #35 +/- ##
===========================================
- Coverage 95.00% 82.97% -12.03%
===========================================
Files 5 5
Lines 80 94 +14
===========================================
+ Hits 76 78 +2
- Misses 4 16 +12 ☔ View full report in Codecov by Sentry. |
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.
Fine by me, though I do not really understand most of the changes 😅. Would be good if @ranocha could give the final green light :-)
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! Why do you need this functionality?
Base.include(ex -> replace_assignments(insert_maxiters(mapexpr(ex)); kwargs...), | ||
mod, elixir) |
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.
Base.include(ex -> replace_assignments(insert_maxiters(mapexpr(ex)); kwargs...), | |
mod, elixir) | |
Base.include(replace_assignments ∘ insert_maxiters ∘ mapexpr; kwargs...), | |
mod, elixir) |
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.
Well, the Trixi style guide says:
Executable code should only use ASCII characters.
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.
@sloede? Composing functions is only available using ∘
. From my point of view, ∘
makes it easier to read the code in this case.
I want to add a macro I could also add this macro to TrixiBase, but so far it will only be used by TrixiParticles. https://github.com/trixi-framework/TrixiParticles.jl/blob/ef/more-gpu-support/src/util.jl#L138-L163 |
This would be nice to have here |
trixi_include
more flexible by allowing a mapping to be passedtrixi_include_changeprecision
to make a double precision elixir run with single precision
I now moved the macro from TrixiParticles to this PR. |
The purpose of this function is to conveniently run a full simulation with `Float32`, | ||
which is orders of magnitude faster on most GPUs than `Float64`, by just including | ||
the elixir with `trixi_include_changeprecision(Float32, elixir)`. | ||
Most code in the Trixi framework is written in a way that changing all floating-point |
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.
Most code in the Trixi framework is written in a way that changing all floating-point | |
Most code in the Trixi.jl framework is written in a way that changing all floating-point |
Most code in the Trixi framework is written in a way that changing all floating-point | ||
numbers in the elixir to `Float32` manually will run the full simulation with single precision. |
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.
I'm not susosure about this. For example, in Trixi.jl, we need to specify additional stuff like RealT = Float32
etc. at several places, e.g.,
This is similar to how
Base.include
is defined: