Skip to content

Commit 9f3c402

Browse files
add sentosimple test
1 parent 7a0b7db commit 9f3c402

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/ParallelDataTransfer.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,24 @@ module ParallelDataTransfer
1818
fetch(@spawnat(p,eval(mod,obj)))
1919
end
2020

21+
#=
22+
macro getfrom(p, obj,mod=Main)
23+
quote
24+
remotecall_fetch(eval,$(esc(p)),$(esc(mod)),$(esc(obj)))
25+
end
26+
end
27+
=#
28+
2129
getfrom(p::Int, nm::Symbol, mod::Module=Main) = fetch(@spawnat(p, getfield(mod, nm)))
2230

31+
#=
32+
macro defineat(p,name,val,mod=Main)
33+
quote
34+
remotecall_wait((nm,val)->eval($mod,:(nm=val)),$p,$name,$val)
35+
end
36+
end
37+
=#
38+
2339
macro defineat(p,name,val,mod=Main)
2440
wait(@spawnat p eval(mod,:($name=$val)))
2541
end

test/runtests.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ x = @getfrom(2, z)
1616
y = getfrom(2, :z)
1717
@test y==z
1818

19+
sendtosimple(2,:x,3)
20+
y = @getfrom 2 x
21+
@test y == 3
22+
1923
# pass variable named x from process 2 to all other processes
2024
@spawnat 2 eval(:(x=1))
2125
passobj(2, filter(x->x!=2, procs()), :x)

0 commit comments

Comments
 (0)