Skip to content

Commit

Permalink
Remove race condition in mpi testing (#1821)
Browse files Browse the repository at this point in the history
* remove race condition in mpi testing

* add additional barriers
  • Loading branch information
andrewwinters5000 authored Jan 31, 2024
1 parent d53fdb5 commit c7cee98
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions test/test_mpi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ include("test_trixi.jl")
# Start with a clean environment: remove Trixi.jl output directory if it exists
outdir = "out"
Trixi.mpi_isroot() && isdir(outdir) && rm(outdir, recursive = true)
Trixi.MPI.Barrier(Trixi.mpi_comm())

# CI with MPI and some tests fails often on Windows. Thus, we check whether this
# is the case here. We use GitHub Actions, so we can check whether we run CI
Expand Down Expand Up @@ -45,5 +46,6 @@ end # MPI supporting functionality

# Clean up afterwards: delete Trixi.jl output directory
Trixi.mpi_isroot() && @test_nowarn rm(outdir, recursive = true)
Trixi.MPI.Barrier(Trixi.mpi_comm())

end # module
3 changes: 2 additions & 1 deletion test/test_mpi_tree.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ CI_ON_WINDOWS = (get(ENV, "GITHUB_ACTIONS", false) == "true") && Sys.iswindows()
# Here, we also test that SaveSolutionCallback prints multiple mesh files with AMR
# Start with a clean environment: remove Trixi.jl output directory if it exists
outdir = "out"
isdir(outdir) && rm(outdir, recursive = true)
Trixi.mpi_isroot() && isdir(outdir) && rm(outdir, recursive = true)
Trixi.MPI.Barrier(Trixi.mpi_comm())
@test_trixi_include(joinpath(EXAMPLES_DIR,
"elixir_advection_amr_refine_twice.jl"),
l2=[0.00020547512522578292],
Expand Down
2 changes: 2 additions & 0 deletions test/test_threaded.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ include("test_trixi.jl")
# Start with a clean environment: remove Trixi.jl output directory if it exists
outdir = "out"
Trixi.mpi_isroot() && isdir(outdir) && rm(outdir, recursive = true)
Trixi.MPI.Barrier(Trixi.mpi_comm())

@testset "Threaded tests" begin
#! format: noindent
Expand Down Expand Up @@ -471,5 +472,6 @@ end

# Clean up afterwards: delete Trixi.jl output directory
Trixi.mpi_isroot() && isdir(outdir) && @test_nowarn rm(outdir, recursive = true)
Trixi.MPI.Barrier(Trixi.mpi_comm())

end # module

0 comments on commit c7cee98

Please sign in to comment.