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_cman_tcp.jl
using Test
using MPI
using Distributed

# This uses TCP to communicate with the workers
mgr = MPI.start_main_loop(MPI.TCP_TRANSPORT_ALL)

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

refs = []
for w in workers()
    push!(refs, @spawnat w MPI.Comm_rank(MPI.COMM_WORLD))
end
ids = falses(size)
for r in refs
    id = fetch(r)
    @test !ids[id+1]
    ids[id+1] = true
end
@test ids[1] == (length(procs()) == 1)
ids[1] = true
for id in ids
    @test id
end

s = @distributed (+) for i in 1:10
    i^2
end
@test s == 385

MPI.stop_main_loop(mgr)
back to top