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

Add (downstream) test to assess if the MPI rank was saved correctly in a Trixi parallel simulation #100

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
ReadVTK = "dc215faf-f008-4882-a9f7-a79a826fadc3"
Expand All @@ -11,6 +12,7 @@ UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
[compat]
Documenter = "0.27, 1"
Downloads = "1"
MPI = "0.20.6"
OrdinaryDiffEq = "6"
ReadVTK = "0.1, 0.2"
Trixi = "0.5, 0.6, 0.7, 0.8, 0.9"
27 changes: 27 additions & 0 deletions test/test_3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module Test3D

using Test
using Trixi2Vtk
using MPI: mpiexec

include("test_trixi2vtk.jl")

Expand Down Expand Up @@ -102,6 +103,32 @@ end
end
end

@testset "Parallel Trixi.jl" begin
# Clean output directory
isdir(outdir) && rm(outdir, recursive=true)

# Run trixi in parallel with 2 ranks
mpiexec() do cmd
run(`$cmd -n 2 $(Base.julia_cmd()) --threads=1 --project=@. -e 'using Trixi; trixi_include(@__MODULE__, joinpath(examples_dir(), "p4est_3d_dgsem", "elixir_mhd_alfven_wave_nonconforming.jl"), trees_per_dimension=(1, 1, 1), maxiters=4)'`)
end
Comment on lines +111 to +113
Copy link
Author

Choose a reason for hiding this comment

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

What would be the right way to run Trixi in parallel from a Trixi2Vtk test, @sloede?
I'm getting the error:

ERROR: ERROR: ArgumentError: Package Trixi [a7f1ee26-1774-49b1-8366-f1abc58fbfcb] is required but does not seem to be installed:

... And I don't know how to fix it.

Copy link
Member

Choose a reason for hiding this comment

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

I haven't checked, but is this the same way we run the MPI tests in Trixi.jl?


# Get output file name
filename = joinpath(outdir, "solution_" * LEADING_ZEROS * "000004.h5")

# Read data from file
(labels, data, n_elements, n_nodes, element_variables, node_variables, time) = Trixi2Vtk.read_datafile(filename)

# Create reference for mpi_rank
mpi_rank_ref = zeros(n_elements)
mpi_rank_ref[50:end] .= 1.0

# Compare read-in mpi_rank with reference
@test element_variables["mpi_rank"] == mpi_rank_ref

# Finally, test if we can generate the output file without warnings
@test_nowarn trixi2vtk(filename, output_directory=outdir)
end

if !Sys.iswindows() && get(ENV, "CI", nothing) == "true"
# OBS! Only `TreeMesh` results are tested on Windows runners due to memory limits.
# All remaining mesh types are tested on Ubuntu and Mac
Expand Down
Loading