Revision fb94cc59c598ba13db693fec344a0282d373b88e authored by Simon Byrne on 26 June 2019, 04:58:42 UTC, committed by Simon Byrne on 26 June 2019, 04:58:48 UTC
1 parent f689ed5
Raw File
test_alltoall.jl
using Test

using MPI

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

for typ in Base.uniontypes(MPI.MPIDatatype)

    # Allocating version
    a = fill(convert(typ, rank),size)
    b = MPI.Alltoall(a, 1, comm)
    @test b == convert.(typ, collect(0:(size-1)))

    # Non Allocating version
    a = fill(convert(typ, rank),size)
    b = Array{typ}(undef, size*1)
    MPI.Alltoall!(a, b, 1, comm)
    @test b == convert.(typ, collect(0:(size-1)))

    # IN_PLACE version
    a = fill(convert(typ, rank),size)
    MPI.Alltoall!(MPI.IN_PLACE, a, 1, comm)
    @test a == convert.(typ, collect(0:(size-1)))

end

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