2

I am trying to reproduce the results from the Schelling's segregation model in the Agents.jl package. Single runs using the run function work well, but trying the parameter scan by calling

adf, _ = paramscan(parameters, initialize; adata, agent_step!, n = 3)

results in following error messages:

On worker 1:

KeyError: key ProgressMeter [92933f4c-e287-5a05-a399-4b506db050ca] not found

Stacktrace:

[1] getindex

@ ./dict.jl:481 [inlined]

[2] root_module

@ ./loading.jl:1056 [inlined]

[3] deserialize_module

@ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Serialization/src/Serialization.jl:981

[4] handle_deserialize

@ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Serialization/src/Serialization.jl:883

[5] deserialize

@ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Serialization/src/Serialization.jl:801

[6] deserialize_datatype

@ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Serialization/src/Serialization.jl:1331

[7] handle_deserialize

@ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Serialization/src/Serialization.jl:854

[8] deserialize

@ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Serialization/src/Serialization.jl:801

[9] handle_deserialize

@ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Serialization/src/Serialization.jl:861

[10] deserialize

@ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Serialization/src/Serialization.jl:801

[11] #5

@ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Serialization/src/Serialization.jl:960

[12] ntupleany

@ ./ntuple.jl:43

[13] deserialize_tuple

@ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Serialization/src/Serialization.jl:960

[14] handle_deserialize

@ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Serialization/src/Serialization.jl:844

[15] deserialize

@ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Serialization/src/Serialization.jl:801 [inlined]

[16] deserialize_msg

@ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Distributed/src/messages.jl:87

[17] #invokelatest#2

@ ./essentials.jl:716 [inlined]

[18] invokelatest

@ ./essentials.jl:714 [inlined]

[19] message_handler_loop

@ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Distributed/src/process_messages.jl:169

[20] process_tcp_streams

@ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/Distributed/src/process_messages.jl:126

[21] #103

@ ./task.jl:429

var"#remotecall_fetch#159"(::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, ::typeof(remotecall_fetch), ::Function, ::Distributed.Worker, ::Function, ::Vararg{Any})@remotecall.jl:469
remotecall_fetch@remotecall.jl:461[inlined]
#remotecall_fetch#162@remotecall.jl:496[inlined]
remotecall_fetch@remotecall.jl:496[inlined]
RemoteChannel@remotecall.jl:131[inlined]
var"#progress_map#53"(::Function, ::ProgressMeter.Progress, ::Int64, ::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, ::typeof(ProgressMeter.progress_map), ::Function, ::Vararg{Any})@ProgressMeter.jl:1005
var"#paramscan#180"(::Bool, ::Bool, ::Function, ::Function, ::Int64, ::Base.Pairs{Symbol, Vector{Tuple{Symbol, typeof(Main.workspace#55.happyperc)}}, Tuple{Symbol}, NamedTuple{(:adata2,), Tuple{Vector{Tuple{Symbol, typeof(Main.workspace#55.happyperc)}}}}}, ::typeof(Agents.paramscan), ::Dict{Symbol, Any}, ::typeof(Main.workspace#17.initialize))@paramscan.jl:95
top-level scope@Local: 1[inlined]

I am running this on an M1 MacBook Pro with Julia 1.7.3. I have checked that all packages are up to date. I also tested another ABM, and got the same error message.

CTP
  • 21
  • 2
  • The error seems to be related to Distributed computing. Did you run this right after the `ensemblerun!` example with `@everywhere`s? Could you try this again in a fresh Julia session and see if you're able to reproduce it? – Sundar R Jun 27 '22 at 18:02
  • 1
    Thanks Sundar. I have looked more into the Distributed package, and found that the issue lies with Pluto that I have been using. When I run the code in the REPL, everything works. For Pluto, starting it with `import Pluto; Pluto.run(workspace_use_distributed=false)` (see [here](https://discourse.julialang.org/t/q-is-distributed-not-supported-in-pluto/56277/2)) allows to run the ensemble sampler and parameter scan (although there still seems to be a problem with parallelisation using @everywhere in Pluto). – CTP Jun 28 '22 at 10:47

0 Answers0