Distributed.jl icon indicating copy to clipboard operation
Distributed.jl copied to clipboard

Think about simplified scoping rules for parallel macros

Open malmaud opened this issue 10 years ago • 4 comments

There seems to be some general confusion amongst the user base for exactly how variable references in an expression passed to one of the parallel macros are resolved and when the value of variables is transferred vs treated as a reference to a global variable on some module defined on the worker.

Part of the problem could be resolved with better documentation, but I also wonder if we can find a set of rules that is more intuitive and robust in the Julia 0.5 timeframe.

Here are some specific issues concerning symbol resolution in parallel macros issues already brought up that we could maybe make some headway on:

  • [x] https://github.com/JuliaLang/julia/issues/2669
  • [x] https://github.com/JuliaLang/julia/issues/5930
  • [x] https://github.com/JuliaLang/julia/issues/6760
  • [x] https://github.com/JuliaLang/julia/issues/9118
  • [ ] https://github.com/JuliaLang/Distributed.jl/issues/19
  • [x] https://github.com/JuliaLang/julia/issues/12367
  • [ ] https://github.com/JuliaLang/Distributed.jl/issues/20
  • [x] https://github.com/JuliaLang/julia/issues/11228
  • [x] https://github.com/JuliaLang/julia/issues/14399

malmaud avatar Oct 16 '15 20:10 malmaud

Some short examples that show how fragile the current situation is:

module M
x=1
y=@fetch x
end
# Worker will crash here
x=1
@fetch x+1  # Works
@fetch Main.x+1 # Fails

malmaud avatar Oct 16 '15 22:10 malmaud

here's another one for the list: https://github.com/JuliaLang/julia/issues/13810 in that issue, the @fetchfrom 2 v macro is fetching the value of v on process 1, by copying it through process 2.

vtjnash avatar Nov 01 '15 17:11 vtjnash

It's speculative at this point, but considering the number of related issues, can this be added to the 0.6.0 milestone?

JohnHBrock avatar Jul 15 '16 21:07 JohnHBrock

The two open issues are related to treatment of module globals and module loading on workers. The main reported issue i.e., scoping w.r.t. parallel macros has been largely addressed by JuliaLang/julia#19594

Should we close this issue?

amitmurthy avatar Jan 26 '17 04:01 amitmurthy