Skip to content

Commit

Permalink
fix IndicatorMax with multi-threading on ARM (#1723)
Browse files Browse the repository at this point in the history
  • Loading branch information
ranocha authored Nov 10, 2023
1 parent 63c6258 commit 910df76
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/solvers/dgsem_tree/indicators_1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -289,14 +289,15 @@ function (indicator_max::IndicatorMax)(u::AbstractArray{<:Any, 3},
kwargs...)
@unpack alpha, indicator_threaded = indicator_max.cache
resize!(alpha, nelements(dg, cache))
indicator_variable = indicator_max.variable

@threaded for element in eachelement(dg, cache)
indicator = indicator_threaded[Threads.threadid()]

# Calculate indicator variables at Gauss-Lobatto nodes
for i in eachnode(dg)
u_local = get_node_vars(u, equations, dg, i, element)
indicator[i] = indicator_max.variable(u_local, equations)
indicator[i] = indicator_variable(u_local, equations)
end

alpha[element] = maximum(indicator)
Expand Down
3 changes: 2 additions & 1 deletion src/solvers/dgsem_tree/indicators_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -323,14 +323,15 @@ function (indicator_max::IndicatorMax)(u::AbstractArray{<:Any, 4},
kwargs...)
@unpack alpha, indicator_threaded = indicator_max.cache
resize!(alpha, nelements(dg, cache))
indicator_variable = indicator_max.variable

@threaded for element in eachelement(dg, cache)
indicator = indicator_threaded[Threads.threadid()]

# Calculate indicator variables at Gauss-Lobatto nodes
for j in eachnode(dg), i in eachnode(dg)
u_local = get_node_vars(u, equations, dg, i, j, element)
indicator[i, j] = indicator_max.variable(u_local, equations)
indicator[i, j] = indicator_variable(u_local, equations)
end

alpha[element] = maximum(indicator)
Expand Down
3 changes: 2 additions & 1 deletion src/solvers/dgsem_tree/indicators_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,15 @@ function (indicator_max::IndicatorMax)(u::AbstractArray{<:Any, 5},
kwargs...)
@unpack alpha, indicator_threaded = indicator_max.cache
resize!(alpha, nelements(dg, cache))
indicator_variable = indicator_max.variable

@threaded for element in eachelement(dg, cache)
indicator = indicator_threaded[Threads.threadid()]

# Calculate indicator variables at Gauss-Lobatto nodes
for k in eachnode(dg), j in eachnode(dg), i in eachnode(dg)
u_local = get_node_vars(u, equations, dg, i, j, k, element)
indicator[i, j, k] = indicator_max.variable(u_local, equations)
indicator[i, j, k] = indicator_variable(u_local, equations)
end

alpha[element] = maximum(indicator)
Expand Down

0 comments on commit 910df76

Please sign in to comment.