Skip to content

Commit 6a376d1

Browse files
authored
Merge pull request #148 from tkelman/piracy
Don't import recvfrom from Base
2 parents 3bbb0c2 + 00e3050 commit 6a376d1

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/spmd.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
module SPMD
22

33
import DistributedArrays: gather, next_did, close
4-
import Base.recvfrom # UDP socket
54
export sendto, recvfrom, recvfrom_any, barrier, bcast, scatter, gather
65
export context_local_storage, context, spmd, close
76

@@ -260,4 +259,4 @@ function close(ctxt::SPMDContext)
260259
ctxt.release = false
261260
end
262261

263-
end
262+
end

test/spmd.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
barrier(;tag=:b1)
33

44
if myid() == 1
5-
@assert recvfrom(2) == "Hello from 2"
5+
@assert SPMD.recvfrom(2) == "Hello from 2"
66
println("SPMD: Passed send/recv")
77
elseif myid() == 2
88
data = "Hello from 2"
@@ -22,7 +22,7 @@
2222
bcast_val = bcast(bcast_val, 1)
2323

2424
if myid() == 1
25-
@assert bcast_val == recvfrom(2)
25+
@assert bcast_val == SPMD.recvfrom(2)
2626
println("SPMD: Passed broadcast")
2727
elseif myid() == 2
2828
sendto(1, bcast_val)
@@ -37,7 +37,7 @@
3737
lp = scatter(scatter_data, 1, tag=1)
3838

3939
if myid() == 1
40-
@assert scatter_data[2:2] == recvfrom(2)
40+
@assert scatter_data[2:2] == SPMD.recvfrom(2)
4141
println("SPMD: Passed scatter 1")
4242
elseif myid() == 2
4343
sendto(1, lp)
@@ -50,7 +50,7 @@
5050
lp = scatter(scatter_data, 1, tag=2)
5151

5252
if myid() == 1
53-
@assert scatter_data[3:4] == recvfrom(2)
53+
@assert scatter_data[3:4] == SPMD.recvfrom(2)
5454
println("SPMD: Passed scatter 2")
5555
elseif myid() == 2
5656
sendto(1, lp)
@@ -91,8 +91,8 @@ spmd(spmd_test1)
9191
sendto(pids[n_pididx], mylp[2])
9292
sendto(pids[p_pididx], mylp[1])
9393

94-
mylp[2] = recvfrom(pids[p_pididx])
95-
mylp[1] = recvfrom(pids[n_pididx])
94+
mylp[2] = SPMD.recvfrom(pids[p_pididx])
95+
mylp[1] = SPMD.recvfrom(pids[n_pididx])
9696

9797
# println(mylp)
9898

@@ -138,8 +138,8 @@ println("SPMD: Passed testing of spmd function run concurrently")
138138
sendto(pids[n_pididx], mylp[2])
139139
sendto(pids[p_pididx], mylp[1])
140140

141-
mylp[2] = recvfrom(pids[p_pididx])
142-
mylp[1] = recvfrom(pids[n_pididx])
141+
mylp[2] = SPMD.recvfrom(pids[p_pididx])
142+
mylp[1] = SPMD.recvfrom(pids[n_pididx])
143143

144144
barrier(;pids=pids)
145145
localsum = localsum + mylp[1] + mylp[2]

0 commit comments

Comments
 (0)