I tried to make a self-contained MWE but can’t replicate the error.
For some reason it doesn’t like the @sync
:
@sync @distributed for d in 1:ndocs
thetaLoop!(Theta,Achain,J,d,n_burn,Alpha,verbose,nchains,startiter,niter,k)
end
thetaLoop!
refers to:
function getAllTheta(Achain,J,Alpha,startiter,niter,nchains,k;verbose=false)
n_burn = niter-startiter-1
ndocs = size(J)[2]
Theta = SharedArray(zeros(n_burn,k,nchains,ndocs))
@sync @distributed for d in 1:ndocs
thetaLoop!(Theta,Achain,J,d,n_burn,Alpha,verbose,nchains,startiter,niter,k)
end
Array(Theta)
end
function thetaLoop!(Theta,Achain,J,d,n_burn,Alpha,verbose,nchains,startiter,niter,k)
for j in 1:nchains
for i in 1:n_burn
verbose ? println(myid(),": doc $d, iter $i") : nothing
nji = getZ(Achain[startiter:niter,:,:][i,:,j],k)*J
Theta[i,:,j,d] .= vec((nji[:,d] .+ Alpha) ./ sum(nji[:,d] .+ Alpha))
end
end
end
Error:
ERROR: LoadError: TaskFailedException:
On worker 2:
Local instance of remote reference not found
channel_from_id at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Distributed/src/remotecall.jl:164
init_loc_flds at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/SharedArrays/src/SharedArrays.jl:426
deserialize at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/SharedArrays/src/SharedArrays.jl:483
handle_deserialize at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Serialization/src/Serialization.jl:842
deserialize at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Serialization/src/Serialization.jl:1350
handle_deserialize at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Serialization/src/Serialization.jl:837
deserialize at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Serialization/src/Serialization.jl:1350
handle_deserialize at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Serialization/src/Serialization.jl:837
deserialize at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Serialization/src/Serialization.jl:773 [inlined]
deserialize_msg at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Distributed/src/messages.jl:99
#invokelatest#1 at ./essentials.jl:710 [inlined]
invokelatest at ./essentials.jl:709 [inlined]
message_handler_loop at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Distributed/src/process_messages.jl:185
process_tcp_streams at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Distributed/src/process_messages.jl:142
#99 at ./task.jl:356