Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests stuff to fix mpi error for macos and windows runs #134

Open
wants to merge 8 commits into
base: t8codemesh-fv
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 35 additions & 35 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,52 +60,52 @@ jobs:
arch:
- x64
trixi_test:
- tree_part1
- tree_part2
- tree_part3
- tree_part4
- tree_part5
- tree_part6
- structured
- p4est_part1
- p4est_part2
- t8code_part1
- t8code_part2
# - tree_part1
# - tree_part2
# - tree_part3
# - tree_part4
# - tree_part5
# - tree_part6
# - structured
# - p4est_part1
# - p4est_part2
# - t8code_part1
# - t8code_part2
- t8code_fv
- unstructured_dgmulti
- parabolic
- paper_self_gravitating_gas_dynamics
- misc_part1
- misc_part2
- performance_specializations_part1
- performance_specializations_part2
# - unstructured_dgmulti
# - parabolic
# - paper_self_gravitating_gas_dynamics
# - misc_part1
# - misc_part2
# - performance_specializations_part1
# - performance_specializations_part2
- mpi
- threaded
# - threaded
include:
- version: '1.8'
os: ubuntu-latest
arch: x64
trixi_test: threaded_legacy
- version: '1.9'
os: ubuntu-latest
arch: x64
trixi_test: threaded_legacy
# - version: '1.8'
# os: ubuntu-latest
# arch: x64
# trixi_test: threaded_legacy
# - version: '1.9'
# os: ubuntu-latest
# arch: x64
# trixi_test: threaded_legacy
- version: '1.10'
os: macos-13
arch: x64
trixi_test: mpi
- version: '1.10'
os: macos-latest
arch: aarch64
trixi_test: threaded
# - version: '1.10'
# os: macos-latest
# arch: aarch64
# trixi_test: threaded
- version: '1.10'
os: windows-latest
arch: x64
trixi_test: mpi
- version: '1.10'
os: windows-latest
arch: x64
trixi_test: threaded
# - version: '1.10'
# os: windows-latest
# arch: x64
# trixi_test: threaded
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
Expand Down
8 changes: 5 additions & 3 deletions examples/t8code_2d_fv/elixir_advection_basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ mesh = T8codeMesh(trees_per_dimension, element_class,

semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)

tspan = (0.0, 1.0)
tspan = (0.0, 0.0)
ode = semidiscretize(semi, tspan);

summary_callback = SummaryCallback()
Expand All @@ -87,10 +87,12 @@ callbacks = CallbackSet(summary_callback, analysis_callback, alive_callback,

###############################################################################
# run the simulation

println("Directly before solve")
sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),
dt = 1.0, # solve needs some value here but it will be overwritten by the stepsize_callback
save_everystep = false, callback = callbacks);
save_everystep = false, callback = callbacks, maxiters = 0);
println("Directly after solve")
summary_callback()
println("Directly after summary_callback")

GC.enable(true)
8 changes: 4 additions & 4 deletions examples/t8code_2d_fv/elixir_advection_gauss.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ mesh = T8codeMesh(cmesh, solver, initial_refinement_level = initial_refinement_l

semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)

ode = semidiscretize(semi, (0.0, 20.0));
ode = semidiscretize(semi, (0.0, 0.0));

summary_callback = SummaryCallback()

analysis_interval = 100
analysis_callback = AnalysisCallback(semi, interval = analysis_interval)
# analysis_callback = AnalysisCallback(semi, interval = analysis_interval)

alive_callback = AliveCallback(analysis_interval = analysis_interval)

Expand All @@ -33,7 +33,7 @@ save_solution = SaveSolutionCallback(interval = 10,

stepsize_callback = StepsizeCallback(cfl = 0.5)

callbacks = CallbackSet(summary_callback, save_solution, analysis_callback, alive_callback,
callbacks = CallbackSet(#=summary_callback,=# save_solution, #=analysis_callback,=# alive_callback,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
callbacks = CallbackSet(#=summary_callback,=# save_solution, #=analysis_callback,=# alive_callback,
callbacks = CallbackSet(save_solution, alive_callback, #=analysis_callback,=#

stepsize_callback)

###############################################################################
Expand All @@ -42,4 +42,4 @@ callbacks = CallbackSet(summary_callback, save_solution, analysis_callback, aliv
sol = solve(ode, CarpenterKennedy2N54(williamson_condition = false),#Euler(),
dt = 5.0e-2, # solve needs some value here but it will be overwritten by the stepsize_callback
save_everystep = false, callback = callbacks);
summary_callback()
# summary_callback()
1 change: 1 addition & 0 deletions src/callbacks_step/analysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ end
# This method gets called internally as the main entry point to the AnalysiCallback
# TODO: Taal refactor, allow passing an IO object (which could be devnull to avoid cluttering the console)
function (analysis_callback::AnalysisCallback)(u_ode, du_ode, integrator, semi)
println("Start of analysis_callback")
mesh, equations, solver, cache = mesh_equations_solver_cache(semi)
@unpack dt, t = integrator
iter = integrator.stats.naccept
Expand Down
19 changes: 10 additions & 9 deletions src/solvers/fv_t8code/fv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -162,43 +162,44 @@ end
function rhs!(du, u, t, mesh::T8codeMesh, equations,
boundary_conditions, source_terms::Source,
solver::FV, cache) where {Source}
println("1. Start of actual rhs!")
# Reset du
@trixi_timeit timer() "reset ∂u/∂t" du.=zero(eltype(du))

println("2. actual rhs!")
# Exchange solution between MPI ranks
@trixi_timeit timer() "exchange_solution_data!" exchange_solution_data!(u, mesh,
equations,
solver,
cache)

println("3. of actual rhs!")
@trixi_timeit timer() "gradient reconstruction" calc_gradient_reconstruction!(u,
mesh,
equations,
solver,
cache)

println("4. of actual rhs!")
# Prolong solution to interfaces
@trixi_timeit timer() "prolong2interfaces" begin
prolong2interfaces!(cache, mesh, equations, solver)
end

println("5. of actual rhs!")
# Calculate interface fluxes
@trixi_timeit timer() "interface flux" begin
calc_interface_flux!(du, mesh, have_nonconservative_terms(equations), equations,
solver, cache)
end

println("6. of actual rhs!")
# Prolong solution to boundaries
@trixi_timeit timer() "prolong2boundaries!" begin
prolong2boundaries!(cache, mesh, equations, solver)
end

println("7. of actual rhs!")
# Calculate boundary fluxes
@trixi_timeit timer() "calc boundary flux" begin
calc_boundary_flux!(du, cache, t, boundary_conditions, mesh,
equations, solver)
end

println("8. of actual rhs!")
@trixi_timeit timer() "volume" begin
for element in eachelement(mesh, solver, cache)
volume = cache.elements.volume[element]
Expand All @@ -207,12 +208,12 @@ function rhs!(du, u, t, mesh::T8codeMesh, equations,
end
end
end

println("9. of actual rhs!")
# Calculate source terms
@trixi_timeit timer() "source terms" begin
calc_sources!(du, u, t, source_terms, mesh, equations, solver, cache)
end

println("10. End of actual rhs!")
return nothing
end

Expand Down
6 changes: 3 additions & 3 deletions test/test_mpi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ CI_ON_WINDOWS = (get(ENV, "GITHUB_ACTIONS", false) == "true") && Sys.iswindows()

@testset "MPI" begin
# TreeMesh tests
include("test_mpi_tree.jl")
# include("test_mpi_tree.jl")

# P4estMesh and T8codeMesh tests
include("test_mpi_p4est_2d.jl")
# include("test_mpi_p4est_2d.jl")
include("test_mpi_t8code_2d.jl")
include("test_mpi_t8code_fv_2d.jl")
if !CI_ON_WINDOWS # see comment on `CI_ON_WINDOWS` above
include("test_mpi_p4est_3d.jl")
# include("test_mpi_p4est_3d.jl")
include("test_mpi_t8code_3d.jl")
include("test_mpi_t8code_fv_3d.jl")
end
Expand Down
48 changes: 24 additions & 24 deletions test/test_mpi_t8code_fv_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,30 @@ const EXAMPLES_DIR = pkgdir(Trixi, "examples", "t8code_2d_fv")
@trixi_testset "elixir_advection_basic.jl" begin
@trixi_testset "first-order FV" begin
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_basic.jl"),
order=1,
l2=[0.08551397247817498],
linf=[0.12087467695430498])
order=1,)
# l2=[0.08551397247817498],
# linf=[0.12087467695430498])
Comment on lines +20 to +21

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
# l2=[0.08551397247817498],
# linf=[0.12087467695430498])
# l2=[0.08551397247817498],
# linf=[0.12087467695430498])

# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
t = sol.t[end]
u_ode = sol.u[end]
du_ode = similar(u_ode)
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
end
# let
# t = sol.t[end]
# u_ode = sol.u[end]
# du_ode = similar(u_ode)
# @test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
# end
end
@trixi_testset "second-order FV" begin
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_basic.jl"),
l2=[0.008142380494734171],
linf=[0.018687916234976898])
@test_trixi_include(joinpath(EXAMPLES_DIR, "elixir_advection_basic.jl"),)
# l2=[0.008142380494734171],
# linf=[0.018687916234976898])
Comment on lines +33 to +34

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
# l2=[0.008142380494734171],
# linf=[0.018687916234976898])
# l2=[0.008142380494734171],
# linf=[0.018687916234976898])

# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
t = sol.t[end]
u_ode = sol.u[end]
du_ode = similar(u_ode)
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
end
# let
# t = sol.t[end]
# u_ode = sol.u[end]
# du_ode = similar(u_ode)
# @test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
# end
end
# The extended reconstruction stencil is currently not mpi parallel.
# The current version runs through but an error occurs on some rank.
Expand All @@ -49,9 +49,9 @@ const EXAMPLES_DIR = pkgdir(Trixi, "examples", "t8code_2d_fv")
@trixi_testset "first-order FV" begin
@test_trixi_include(joinpath(EXAMPLES_DIR,
"elixir_advection_gauss.jl"),
order=1,
l2=[0.5598148317954682],
linf=[0.6301130236005371])
order=1,)
# l2=[0.5598148317954682],
# linf=[0.6301130236005371])
Comment on lines +53 to +54

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
# l2=[0.5598148317954682],
# linf=[0.6301130236005371])
# l2=[0.5598148317954682],
# linf=[0.6301130236005371])

# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
Expand All @@ -63,9 +63,9 @@ const EXAMPLES_DIR = pkgdir(Trixi, "examples", "t8code_2d_fv")
end
@trixi_testset "second-order FV" begin
@test_trixi_include(joinpath(EXAMPLES_DIR,
"elixir_advection_gauss.jl"),
l2=[0.5899077806567905],
linf=[0.8972489222157533])
"elixir_advection_gauss.jl"),)
# l2=[0.5899077806567905],
# linf=[0.8972489222157533])
Comment on lines +67 to +68

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
# l2=[0.5899077806567905],
# linf=[0.8972489222157533])
# l2=[0.5899077806567905],
# linf=[0.8972489222157533])

# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
Expand Down
Loading