Skip to content

Commit

Permalink
fix multi-threaded parabolic terms on ARM
Browse files Browse the repository at this point in the history
On ARM, the previous versions resulted in
  cfunction: closures are not supported on this platform
With this change, everything seems to work fine locally.
At least test/test_threaded.jl runs fine with two threads.
  • Loading branch information
ranocha committed Sep 12, 2023
1 parent 953f88a commit dffec18
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
5 changes: 3 additions & 2 deletions src/solvers/dgmulti/dg_parabolic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ end
function transform_variables!(u_transformed, u, mesh,
equations_parabolic::AbstractEquationsParabolic,
dg::DGMulti, parabolic_scheme, cache, cache_parabolic)
transformation = gradient_variable_transformation(equations_parabolic)

@threaded for i in eachindex(u)
u_transformed[i] = gradient_variable_transformation(equations_parabolic)(u[i],
equations_parabolic)
u_transformed[i] = transformation(u[i], equations_parabolic)
end
end

Expand Down
5 changes: 3 additions & 2 deletions src/solvers/dgsem_tree/dg_1d_parabolic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,13 @@ end
function transform_variables!(u_transformed, u, mesh::TreeMesh{1},
equations_parabolic::AbstractEquationsParabolic,
dg::DG, parabolic_scheme, cache, cache_parabolic)
transformation = gradient_variable_transformation(equations_parabolic)

@threaded for element in eachelement(dg, cache)
# Calculate volume terms in one element
for i in eachnode(dg)
u_node = get_node_vars(u, equations_parabolic, dg, i, element)
u_transformed_node = gradient_variable_transformation(equations_parabolic)(u_node,
equations_parabolic)
u_transformed_node = transformation(u_node, equations_parabolic)
set_node_vars!(u_transformed, u_transformed_node, equations_parabolic, dg,
i, element)
end
Expand Down
7 changes: 4 additions & 3 deletions src/solvers/dgsem_tree/dg_2d_parabolic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,13 @@ end
function transform_variables!(u_transformed, u, mesh::Union{TreeMesh{2}, P4estMesh{2}},
equations_parabolic::AbstractEquationsParabolic,
dg::DG, parabolic_scheme, cache, cache_parabolic)
transformation = gradient_variable_transformation(equations_parabolic)

@threaded for element in eachelement(dg, cache)
# Calculate volume terms in one element
for j in eachnode(dg), i in eachnode(dg)
u_node = get_node_vars(u, equations_parabolic, dg, i, j, element)
u_transformed_node = gradient_variable_transformation(equations_parabolic)(u_node,
equations_parabolic)
u_transformed_node = transformation(u_node, equations_parabolic)
set_node_vars!(u_transformed, u_transformed_node, equations_parabolic, dg,
i, j, element)
end
Expand Down Expand Up @@ -608,7 +609,7 @@ function prolong2mortars!(cache, flux_viscous::Tuple{AbstractArray, AbstractArra
end

# NOTE: Use analogy to "calc_mortar_flux!" for hyperbolic eqs with no nonconservative terms.
# Reasoning: "calc_interface_flux!" for parabolic part is implemented as the version for
# Reasoning: "calc_interface_flux!" for parabolic part is implemented as the version for
# hyperbolic terms with conserved terms only, i.e., no nonconservative terms.
function calc_mortar_flux!(surface_flux_values,
mesh::TreeMesh{2},
Expand Down
7 changes: 4 additions & 3 deletions src/solvers/dgsem_tree/dg_3d_parabolic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,13 @@ end
function transform_variables!(u_transformed, u, mesh::Union{TreeMesh{3}, P4estMesh{3}},
equations_parabolic::AbstractEquationsParabolic,
dg::DG, parabolic_scheme, cache, cache_parabolic)
transformation = gradient_variable_transformation(equations_parabolic)

@threaded for element in eachelement(dg, cache)
# Calculate volume terms in one element
for k in eachnode(dg), j in eachnode(dg), i in eachnode(dg)
u_node = get_node_vars(u, equations_parabolic, dg, i, j, k, element)
u_transformed_node = gradient_variable_transformation(equations_parabolic)(u_node,
equations_parabolic)
u_transformed_node = transformation(u_node, equations_parabolic)
set_node_vars!(u_transformed, u_transformed_node, equations_parabolic, dg,
i, j, k, element)
end
Expand Down Expand Up @@ -820,7 +821,7 @@ function prolong2mortars!(cache,
end

# NOTE: Use analogy to "calc_mortar_flux!" for hyperbolic eqs with no nonconservative terms.
# Reasoning: "calc_interface_flux!" for parabolic part is implemented as the version for
# Reasoning: "calc_interface_flux!" for parabolic part is implemented as the version for
# hyperbolic terms with conserved terms only, i.e., no nonconservative terms.
function calc_mortar_flux!(surface_flux_values,
mesh::TreeMesh{3},
Expand Down

0 comments on commit dffec18

Please sign in to comment.