Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/test/test_mpi.jl
5582 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
include("test_mpi_p4est_parabolic_2d.jl")
30
end
31
end # MPI
32
33
@trixi_testset "MPI supporting functionality" begin
34
using Trixi: Trixi, ode_norm, SVector
35
t = 0.5
36
let u = 1.0
37
@test ode_norm(u, t) Trixi.DiffEqBase.ODE_DEFAULT_NORM(u, t)
38
end
39
let u = [1.0, -2.0]
40
@test ode_norm(u, t) Trixi.DiffEqBase.ODE_DEFAULT_NORM(u, t)
41
end
42
let u = [SVector(1.0, -2.0), SVector(0.5, -0.1)]
43
@test ode_norm(u, t) Trixi.DiffEqBase.ODE_DEFAULT_NORM(u, t)
44
end
45
end # MPI supporting functionality
46
47
# Clean up afterwards: delete Trixi.jl output directory
48
Trixi.mpi_isroot() && @test_nowarn rm(outdir, recursive = true)
49
Trixi.MPI.Barrier(Trixi.mpi_comm())
50
51
end # module
52
53