Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/src/solvers/solvers.jl
5586 views
1
# By default, Julia/LLVM does not use fused multiply-add operations (FMAs).
2
# Since these FMAs can increase the performance of many numerical algorithms,
3
# we need to opt-in explicitly.
4
# See https://ranocha.de/blog/Optimizing_EC_Trixi for further details.
5
@muladd begin
6
#! format: noindent
7
8
function set_zero!(du, dg, cache)
9
set_zero!(trixi_backend(du), du, dg, cache)
10
11
return nothing
12
end
13
14
# Used by both `dg::DGSEM` and `dg::FDSBP`
15
function set_zero!(::Nothing, du, dg, cache)
16
# du .= zero(eltype(du)) doesn't scale when using multiple threads.
17
# See https://github.com/trixi-framework/Trixi.jl/pull/924 for a performance comparison.
18
@threaded for element in eachelement(dg, cache)
19
du[.., element] .= zero(eltype(du))
20
end
21
22
return nothing
23
end
24
25
function set_zero!(::Backend, du, dg, cache)
26
# Broadcasting is parallel on the GPU
27
du .= zero(eltype(du))
28
return nothing
29
end
30
31
# define types for parabolic solvers
32
include("solvers_parabolic.jl")
33
34
include("dg.jl")
35
include("dgmulti/dgmulti.jl")
36
end # @muladd
37
38