Skip to content

Commit 9938c84

Browse files
committed
add queries test
1 parent 5fbc444 commit 9938c84

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

test/integration/MPI/queries.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using MPI
2+
using Enzyme
3+
using Test
4+
5+
if !MPI.Initialized()
6+
MPI.Init()
7+
end
8+
9+
comm = MPI.COMM_WORLD
10+
11+
@test autodiff(ForwardWithPrimal, MPI.Comm_size, Const(comm)) == (MPI.Comm_size(comm),)
12+
@test autodiff(ForwardWithPrimal, MPI.Comm_rank, Const(comm)) == (MPI.Comm_rank(comm),)
13+
14+
@test autodiff(ReverseWithPrimal, MPI.Comm_size, Const(comm)) == ((nothing,), MPI.Comm_size(comm))
15+
@test autodiff(ReverseWithPrimal, MPI.Comm_rank, Const(comm)) == ((nothing,), MPI.Comm_rank(comm))

test/integration/MPI/runtests.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ using Test
1212
# - MPI_Gather/MPI_Scatter
1313
# - MPI_Allgather
1414

15+
# Query functions MPI_Comm_size/MPI_Comm_rank
16+
@testset "queries" for np in (1, 2, 4)
17+
run(`$(mpiexec()) -n $np $(Base.julia_cmd()) --project=$(@__DIR__) $(joinpath(@__DIR__, "queries.jl"))`)
18+
end
19+
1520
# Test MPI_Recv/MPI_Send with a blocking ring communication pattern
1621
@testset "blocking_ring" for np in (1, 2, 4)
1722
run(`$(mpiexec()) -n $np $(Base.julia_cmd()) --project=$(@__DIR__) $(joinpath(@__DIR__, "blocking_ring.jl"))`)

0 commit comments

Comments
 (0)