Skip to content

Commit

Permalink
Update src/trixi_include.jl
Browse files Browse the repository at this point in the history
Co-authored-by: Erik Faulhaber <44124897+efaulhaber@users.noreply.github.com>
  • Loading branch information
ranocha and efaulhaber authored Jan 15, 2025
1 parent f720829 commit 7b903a9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/trixi_include.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ See the documentation of ChangePrecision.jl for more details.
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
numbers in the elixir to `Float32` manually will run the full simulation with single precision.
Many constructors in the Trixi.jl framework are written in a way that changing all floating-point
arguments to `Float32` will change the element type to `Float32` as well.
In TrixiParticles.jl, including an elixir with this macro should be sufficient
to run the full simulation with single precision.
"""
function trixi_include_changeprecision(T, mod::Module, filename::AbstractString; kwargs...)
trixi_include(expr -> ChangePrecision.changeprecision(T, replace_trixi_include(T, expr)),
Expand Down

0 comments on commit 7b903a9

Please sign in to comment.