Are p3eccentricity and eccentricity defined on all workers? If they are in a module, the module must be loaded on all workers. If the module has been loaded try calling it as @spawn <Module>.eccentricity .....
On Tue, Feb 3, 2015 at 11:52 PM, Seth <[email protected]> wrote: > I've got a function that calculates the eccentricity of a vertex in a > graph. This is a relatively expensive operation, so when one wants to get > the eccentricities of ALL vertices, it seems perfect for parallelization: > > function p3eccentricity( > g::AbstractGraph, > vs::AbstractArray{Int, 1}=vertices(g); > edge_dists::AbstractArray{Float64, 2} = Array( > Float64,(0,0)) > ) > refs = RemoteRef[] > for i = 1:length(vs) > x = @spawn eccentricity(g,vs[i], edge_dists=edge_dists) > push!(refs, x) > println("pushing ref $i"); > end > println("Done pushing refs"); > a = Float64[] > for r in refs > append!(a,fetch(r)) > println("Appended"); > end > return a > end > p3eccentricity (generic function with 2 methods) > > > > When I run this, I get the following (the failures occur at various > points): > > julia> @time z = p3eccentricity(g); > pushing ref 1 > pushing ref 2 > pushing ref 3 > pushing ref 4 > pushing ref 5 > pushing ref 6 > pushing ref 7 > pushing ref 8 > pushing ref 9 > pushing ref 10 > pushing ref 11 > pushing ref 12 > pushing ref 13 > pushing ref 14 > pushing ref 15 > pushing ref 16 > pushing ref 17 > pushing ref 18 > ERROR: write: bad address in system call argument (EFAULT) > in wait at /usr/local/julia-latest/lib/julia/sys.dylib > in stream_wait at /usr/local/julia-latest/lib/julia/sys.dylib > in write at stream.jl:790 > in send_msg_ at multi.jl:181 > in remote_do at multi.jl:720 > in flush_gc_msgs at /usr/local/julia-latest/lib/julia/sys.dylib > in send_msg_ at multi.jl:179 > in remotecall at multi.jl:667 > in remotecall at multi.jl:671 > in p3eccentricity at none:8 > in p3eccentricity at none:6 > > > julia> fatal error on 2: ERROR: TypeError: deserialize: in typeassert, > expected Module, got Symbol > in deserialize at serialize.jl:499 > in handle_deserialize at serialize.jl:352 > in deserialize at serialize.jl:435 > in handle_deserialize at serialize.jl:352 > in deserialize at serialize.jl:473 > in handle_deserialize at serialize.jl:352 > in deserialize at serialize.jl:559 > in deserialize at serialize.jl:514 > in handle_deserialize at serialize.jl:352 > in deserialize at serialize.jl:335 > in anonymous at serialize.jl:355 > in ntuple at tuple.jl:30 > in deserialize_tuple at serialize.jl:355 > in handle_deserialize at serialize.jl:347 > in deserialize at serialize.jl:405 > in handle_deserialize at serialize.jl:352 > in anonymous at task.jl:838 > Worker 2 terminated. > > What am I doing wrong? Is it even possible to parallelize complex > functions like eccentricity using @spawn and fetch in a simple manner? > > Thanks. >
