Closed f-t-s closed 1 year ago
Hi @f-t-s! Can you please tell us which commands you executed exactly to run this example? Also, which Julia version did you use?
I used Julia 1.9 and just copy-pasted the example file into the REPL
Could you clarify which example file?
Sorry, I fixed the link, it's this example: https://github.com/trixi-framework/Trixi.jl/blob/main/examples/tree_1d_dgsem/elixir_burgers_shock.jl
I am on an M1 myself and the following works for me on both Julia v1.8 and v1.9:
# Create run dir
mkdir run && cd run
# Install packages
julia --project=. -e 'using Pkg; Pkg.add(["Trixi", "OrdinaryDiffEq"]); Pkg.precompile()'
# Run example
julia --project=. -e 'using Trixi; trixi_include(joinpath(examples_dir(), "tree_1d_dgsem", "elixir_burgers_shock.jl"))'
Could you please verify that this still breaks for you? (you can skip the install part if you already have the packages)
Thanks! I just tried that and I get the same result as before.
So still a failure? Hm... Which versions of Trixi.jl and OrdinaryDiffEq.jl are you using?
Yes,
(run) pkg> status Status
~/run/Project.toml
[1dea7af3] OrdinaryDiffEq v6.51.1 [a7f1ee26] Trixi v0.5.22``
That's still weird... can you give me the full output of the installed versions, i.e.,
(run) pkg> status -m
I guess the question is how many threads you use. What happens if you (both) start Julia with the flag --threads=1
and --threads=2
?
Good catch! When I force single-threaded execution the error goes away.
Sorry, I didn't check the original stack trace carefully enough: Yes, I can reproduce now and yes, it's a known bug in Polyester.jl.
For now, on M1 you either have to disable multithreading / start Julia with -t1
or (manually) change the @threaded
macro definition in Trixi.jl to use plain Julia threads. Note that Julia threads have some overhead compared to Polyester.jl, so they are not an optimal solution either.
If I find the time, I will try to look into this and see whether we can fix this problem at least for the shock capturing implementation.
I added a quick fix in #1462.
When running this example I get an error message beginning as below. It seems that there is an issue with the batch macro on M1 macs, presumably related to this?
Is there any workaround to get Trixi to work on an M1 mac?
ERROR: cfunction: closures are not supported on this platform Stacktrace: [1] macro expansion @ ~/.julia/packages/Polyester/qUpZt/src/batch.jl:25 [inlined] [2] batch_closure @ ~/.julia/packages/Polyester/qUpZt/src/batch.jl:18 [inlined] [3] macro expansion @ ~/.julia/packages/Polyester/qUpZt/src/batch.jl:127 [inlined] [4] _batch_no_reserve @ ~/.julia/packages/Polyester/qUpZt/src/batch.jl:111 [inlined] [5] batch @ ~/.julia/packages/Polyester/qUpZt/src/batch.jl:317 [inlined] [6] macro expansion @ ~/.julia/packages/Polyester/qUpZt/src/closure.jl:375 [inlined] [7] macro expansion @ ~/.julia/packages/Trixi/900xO/src/auxiliary/auxiliary.jl:250 [inlined] [8] (::IndicatorHennemannGassner{Float64, typeof(first), NamedTuple{(:alpha, :alpha_tmp, :indicator_threaded, :modal_threaded), Tuple{Vector{Float64}, Vector{Float64}, Vector{Vector{Float64}}, Vector{Vector{Float64}}}}})(u::StrideArraysCore.PtrArray{Float64, 3, (1, 2, 3), Tuple{Static.StaticInt{1}, Static.StaticInt{4}, Int64}, Tuple{Nothing, Nothing, Nothing}, Tuple{Static.StaticInt{1}, Static.StaticInt{1}, Static.StaticInt{1}}}, mesh::TreeMesh{1, Trixi.SerialTree{1}}, equations::InviscidBurgersEquation1D, dg::DGSEM{LobattoLegendreBasis{Float64, 4, SVector{4, Float64}, Matrix{Float64}, Matrix{Float64}, Matrix{Float64}}, Trixi.LobattoLegendreMortarL2{Float64, 4, Matrix{Float64}, Matrix{Float64}}, SurfaceIntegralWeakForm{FluxLaxFriedrichs{typeof(max_abs_speed_naive)}}, VolumeIntegralShockCapturingHG{FluxLaxFriedrichs{typeof(max_abs_speed_naive)}, FluxLaxFriedrichs{typeof(max_abs_speed_naive)}, IndicatorHennemannGassner{Float64, typeof(first), NamedTuple{(:alpha, :alpha_tmp, :indicator_threaded, :modal_threaded), Tuple{Vector{Float64}, Vector{Float64}, Vector{Vector{Float64}}, Vector{Vector{Float64}}}}}}}, cache::NamedTuple{(:elements, :interfaces, :boundaries, :element_ids_dg, :element_ids_dgfv, :fstar1_L_threaded, :fstar1_R_threaded), Tuple{Trixi.ElementContainer1D{Float64, Float64}, Trixi.InterfaceContainer1D{Float64}, Trixi.BoundaryContainer1D{Float64, Float64}, Vector{Int64}, Vector{Int64}, Vector{Matrix{Float64}}, Vector{Matrix{Float64}}}}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) @ Trixi ~/.julia/packages/Trixi/900xO/src/solvers/dgsem_tree/indicators_1d.jl:44 [9] IndicatorHennemannGassner @ ~/.julia/packages/Trixi/900xO/src/solvers/dgsem_tree/indicators_1d.jl:27 [inlined]