pmap will keep process one as your "delegator", and run the function on a worker.
You'll recieve the same result in either of these cases: 1. Don't add any workers, pmap will use process 1. Returns 9223372036854775807 2. Run the remotecall on something other than process one: ref = remotecall(findAndReturn2, 2, 26) Returns: LoadError: On worker 2: BoundsError in findAndReturn2 at In[1]:8 in anonymous at multi.jl:904 in run_work_thunk at multi.jl:645 in run_work_thunk at multi.jl:654 in anonymous at task.jl:58 while loading In[1], in expression starting on line 13 in remotecall_fetch at multi.jl:731 in call_on_owner at multi.jl:777 in fetch at multi.jl:795 Cheers, Dan On Saturday, 19 December 2015 19:37:15 UTC-4, [email protected] wrote: > > Hi all, > > I'm using Julia 0.4.2 and I was playing around with pmap and the > DataStructures package when I found something weird: the same function call > when done through remotecall or pmap gives different results. > > Here's a code example: > > > @everywhere using DataStructures > > > > > > > > > @everywhere global const thresholds = collect(0:25) > > > > push!(thresholds, typemax(eltype(thresholds))) #last element is > 9223372036854775807 > > > > @everywhere global const sortedThresholds = SortedSet(thresholds) > > > > > > > global const warmup = round(Int64, rand(100) .* 26) > > > > > > > @everywhere function findAndReturn2(x::Int64) > > return deref((sortedThresholds, searchsortedfirst(sortedThresholds, x > ))) > > end > > > > > ref = remotecall(findAndReturn2, 1, 26) > > fetch(ref) #returns 9223372036854775807 > > > > > pmap(findAndReturn2, [26]) #returns > [RemoteException(2,CapturedException(BoundsError(#undef,#undef),Any[(:findAndReturn2,:none,2,symbol(""),-1,1),(:anonymous,symbol("multi.jl"),907,symbol(""),-1,1),(:run_work_thunk,symbol("multi.jl"),645,symbol(""),-1,1),(:anonymous,symbol("multi.jl"),907,symbol("task.jl"),63,1)]))] > > > > I would expect both calls to return the same thing (albeit wrapped in an > Array in the case of pmap and not in the case of remotecall) > > > Cheers, > > Louis > >
