I’m trying to use DistributedArrays (per the example), but it seems like the package needs to be added to every processor. Is this right?
When I first start Julia, and run
using Distributed
addprocs()
@everywhere using DistributedArrays
it tells me
On worker 2:
ArgumentError: Package DistributedArrays [aaf54ef3-cdf8-58ed-94cc-d582ad619b94] is required but does not seem to be installed:
- Run
Pkg.instantiate()
to install all recorded dependencies._require at .\loading.jl:982
require at .\loading.jl:911
#2 at C:\Users\julia\AppData\Local\Julia-1.2.0\share\julia\stdlib\v1.2\Distributed\src\Distributed.jl:78
#116 at C:\Users\julia\AppData\Local\Julia-1.2.0\share\julia\stdlib\v1.2\Distributed\src\process_messages.jl:307
run_work_thunk at C:\Users\julia\AppData\Local\Julia-1.2.0\share\julia\stdlib\v1.2\Distributed\src\process_messages.jl:79
run_work_thunk at C:\Users\julia\AppData\Local\Julia-1.2.0\share\julia\stdlib\v1.2\Distributed\src\process_messages.jl:88
#102 at .\task.jl:268
#remotecall_wait#154(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(remotecall_wait), ::Function, ::Distributed.Worker) at C:\Users\julia\AppData\Local\Julia-1.2.0\share\julia\stdlib\v1.2\Distributed\src\remotecall.jl:421
remotecall_wait(::Function, ::Distributed.Worker) at C:\Users\julia\AppData\Local\Julia-1.2.0\share\julia\stdlib\v1.2\Distributed\src\remotecall.jl:412
#remotecall_wait#157(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(remotecall_wait), ::Function, ::Int64) at C:\Users\julia\AppData\Local\Julia-1.2.0\share\julia\stdlib\v1.2\Distributed\src\remotecall.jl:433
remotecall_wait at C:\Users\julia\AppData\Local\Julia-1.2.0\share\julia\stdlib\v1.2\Distributed\src\remotecall.jl:433 [inlined]
(::getfield(Distributed, Symbol(“##1#3”)){Base.PkgId,Int64})() at .\task.jl:268…and 3 more exception(s).
sync_end(::Array{Any,1}) at task.jl:235
_require_callback(::Base.PkgId) at task.jl:254
#invokelatest#1 at essentials.jl:790 [inlined]
invokelatest at essentials.jl:789 [inlined]
require(::Base.PkgId) at loading.jl:914
require(::Module, ::Symbol) at loading.jl:906
top-level scope at macros.jl:181
If I run the the last line
@everywhere using DistributedArrays
a second time (even without calling Pkg.instantiate()) it then tells me
On worker 2:
ArgumentError: Package DistributedArrays not found in current path:
- Run
import Pkg; Pkg.add("DistributedArrays")
to install the DistributedArrays package.require at .\loading.jl:876
eval at .\boot.jl:330
#116 at C:\Users\julia\AppData\Local\Julia-1.2.0\share\julia\stdlib\v1.2\Distributed\src\process_messages.jl:307
run_work_thunk at C:\Users\julia\AppData\Local\Julia-1.2.0\share\julia\stdlib\v1.2\Distributed\src\process_messages.jl:79
run_work_thunk at C:\Users\julia\AppData\Local\Julia-1.2.0\share\julia\stdlib\v1.2\Distributed\src\process_messages.jl:88
#102 at .\task.jl:268
#remotecall_wait#154(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(remotecall_wait), ::Function, ::Distributed.Worker, ::Module, ::Vararg{Any,N} where N) at C:\Users\julia\AppData\Local\Julia-1.2.0\share\julia\stdlib\v1.2\Distributed\src\remotecall.jl:421
remotecall_wait(::Function, ::Distributed.Worker, ::Module, ::Vararg{Any,N} where N) at C:\Users\julia\AppData\Local\Julia-1.2.0\share\julia\stdlib\v1.2\Distributed\src\remotecall.jl:412
#remotecall_wait#157(::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::typeof(remotecall_wait), ::Function, ::Int64, ::Module, ::Vararg{Any,N} where N) at C:\Users\julia\AppData\Local\Julia-1.2.0\share\julia\stdlib\v1.2\Distributed\src\remotecall.jl:433
remotecall_wait at C:\Users\julia\AppData\Local\Julia-1.2.0\share\julia\stdlib\v1.2\Distributed\src\remotecall.jl:433 [inlined]
(::getfield(Distributed, Symbol(“##161#163”)){Module,Expr,Int64})() at .\task.jl:268…and 7 more exception(s).
sync_end(::Array{Any,1}) at task.jl:235
macro expansion at task.jl:254 [inlined]
remotecall_eval(::Module, ::Array{Int64,1}, ::Expr) at macros.jl:199
top-level scope at macros.jl:183
EDIT: Okay. So if I don’t include addprocs(4)
, then it works??
using Distributed
using DistributedArrays
@everywhere using DistributedArrays
Doesn’t produce any errors. Why is this?