Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/test/test_mpi.jl
2055 views
1
module TestExamplesMPI
2
3
using Test
4
using Trixi
5
6
include("test_trixi.jl")
7
8
# Start with a clean environment: remove Trixi.jl output directory if it exists
9
outdir = "out"
10
Trixi.mpi_isroot() && isdir(outdir) && rm(outdir, recursive = true)
11
Trixi.MPI.Barrier(Trixi.mpi_comm())
12
13
# CI with MPI and some tests fails often on Windows. Thus, we check whether this
14
# is the case here. We use GitHub Actions, so we can check whether we run CI
15
# in the cloud with Windows as follows, see also
16
# https://docs.github.com/en/actions/learn-github-actions/environment-variables
17
CI_ON_WINDOWS = (get(ENV, "GITHUB_ACTIONS", false) == "true") && Sys.iswindows()
18
19
@testset "MPI" begin
20
# TreeMesh tests
21
include("test_mpi_tree.jl")
22
23
# P4estMesh and T8codeMesh tests
24
include("test_mpi_p4est_2d.jl")
25
include("test_mpi_t8code_2d.jl")
26
if !CI_ON_WINDOWS # see comment on `CI_ON_WINDOWS` above
27
include("test_mpi_p4est_3d.jl")
28
include("test_mpi_t8code_3d.jl")
29
end
30
end # MPI
31
32
@trixi_testset "MPI supporting functionality" begin
33
using Trixi: Trixi, ode_norm, SVector
34
t = 0.5
35
let u = 1.0
36
@test ode_norm(u, t) Trixi.DiffEqBase.ODE_DEFAULT_NORM(u, t)
37
end
38
let u = [1.0, -2.0]
39
@test ode_norm(u, t) Trixi.DiffEqBase.ODE_DEFAULT_NORM(u, t)
40
end
41
let u = [SVector(1.0, -2.0), SVector(0.5, -0.1)]
42
@test ode_norm(u, t) Trixi.DiffEqBase.ODE_DEFAULT_NORM(u, t)
43
end
44
end # MPI supporting functionality
45
46
# Clean up afterwards: delete Trixi.jl output directory
47
Trixi.mpi_isroot() && @test_nowarn rm(outdir, recursive = true)
48
Trixi.MPI.Barrier(Trixi.mpi_comm())
49
50
end # module
51
52