JunoLab / Juno.jl

MIT License
144 stars 23 forks source link

[BUG] Cannot load Turing model on workers #563

Open itsdfish opened 4 years ago

itsdfish commented 4 years ago

I am unable to use Turing models with pmap from Atom. However, the code below works if executed directly from the REPL. Here is the error message:

On worker 2:
UndefVarError: ###my_model#336 not defined
deserialize_datatype at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/Serialization/src/Serialization.jl:1211
handle_deserialize at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/Serialization/src/Serialization.jl:788

Details

Steps to reproduce

In order to reproduce the error, execute the code below using Atom.

using Distributed, Turing
addprocs(4)
@everywhere using Turing
@everywhere begin 
    @model my_model() = begin
    end
end
pmap(x->my_model, 1:4)