Skip to content

Commit

Permalink
mpi tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsch committed Jan 17, 2025
1 parent 5e48916 commit 1a9fa4f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/RimuIO.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,18 @@ end
save_state(file, dvec)
output, _ = load_state(file)
@test output == dvec
rm(file)

pdvec = ham * PDVec([BoseFS(1,1,1) => 1.0, BoseFS(0,3,0) => ℯ])
save_state(file, pdvec)
output, _ = load_state(file)
@test output == pdvec

@test load_state(PDVec, file)[1] isa PDVec
@test load_state(PDVec, file)[1] == pdvec
@test load_state(DVec, file)[1] isa DVec
@test load_state(DVec, file)[1] == pdvec
rm(file)
end

@testset "metadata" begin
Expand All @@ -106,5 +110,7 @@ end
@test meta.float === 2.3
@test meta.complex === 1.2 + 3im
@test meta.string === "a string"
rm(file)
end

end
29 changes: 29 additions & 0 deletions test/mpi_runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,35 @@ end
end
end

@testset "RimuIO" begin
@testset "save_state, load_state" begin
file = joinpath(mktempdir(), "tmp.arrow")
@mpi_root rm(file; force=true)

@testset "vectors" begin
ham = HubbardReal1D(BoseFS(1,1,1))
dvec = ham * DVec([BoseFS(1,1,1) => 1.0, BoseFS(2,1,0) => π])
save_state(file, dvec)
output, _ = load_state(file)
@test output == dvec

@mpi_root rm(file)

pdvec = ham * PDVec([BoseFS(1,1,1) => 1.0, BoseFS(0,3,0) => ℯ])
save_state(file, pdvec)
output, _ = load_state(file)
@test output == pdvec

@test load_state(PDVec, file)[1] isa PDVec
@test load_state(PDVec, file)[1] == pdvec
@test load_state(DVec, file)[1] isa DVec
@test load_state(DVec, file)[1] == pdvec

@mpi_root rm(file)
end
end
end

# Make sure all ranks came this far.
@testset "Finish" begin
# MPI.jl currently doesn't properly map logical operators (MPI v0.20.8)
Expand Down

0 comments on commit 1a9fa4f

Please sign in to comment.