https://github.com/JuliaParallel/MPI.jl
Raw File
Tip revision: 69ce0bf5c15e4a29cb4a4c3df3e8d02f3e9ba0ad authored by Simon Byrne on 23 January 2023, 18:49:26 UTC
Tag v0.20.8 (#712)
Tip revision: 69ce0bf
test_neighbor_allgatherv.jl
using Test
using MPI

MPI.Init()
try
    comm = MPI.COMM_WORLD
    size = MPI.Comm_size(comm)
    rank = MPI.Comm_rank(comm)

    sources      = Cint.(0:rank)
    destinations = Cint.(rank:(size-1))
    graph_comm = MPI.Dist_graph_create_adjacent(comm, sources, destinations)

    send = Array{Int}(undef, rank+1)
    fill!(send, rank)

    recv_count = Cint.(collect(1:(rank+1)))
    recv = Array{Int}(undef, sum(recv_count))
    fill!(recv,-1)
    
    MPI.Neighbor_allgatherv!(send, VBuffer(recv, recv_count), graph_comm)

    @test sort(recv) == [j for j ∈ 0:rank for i ∈ 0:j]
catch e
    if isa(e, MPI.FeatureLevelError)
        @test_broken e.min_version <= MPI.Get_version()
    else
        rethrow(e)
    end
end

MPI.Finalize()
@test MPI.Finalized()
back to top