Understanding pid and RRID in 'Future' objects (related to @spawn and @spawnat in documentation)

question
documentation

#1

In the documentation on Parallel Computing the first code example contains:

julia> r = remotecall(rand, 2, 2, 2)
Future(2, 1, 4, Nullable{Any}())

julia> s = @spawnat 2 1 .+ fetch(r)
Future(2, 1, 5, Nullable{Any}())

Which makes sense to me (I think) because the first number field of the Future object, the pid, is 2 because both belong to process 2 and fetch is a no-op.

However, the second example:

julia> r = @spawn rand(2,2)
Future(2, 1, 4, Nullable{Any}())

julia> s = @spawn 1 .+ fetch(r)
Future(3, 1, 5, Nullable{Any}())

The pid for the object s appears to be 3, which I interpret as it belonging to process 3. Is this correct? If so, the text below this second example does not make sense:

In this case, @spawn is smart enough to perform the computation on the process that owns r, so the fetch() will be a no-op (no work is done).


#2

I have checked the source code. It seems the @spawn is not that smart yet…

:joy: :joy: :joy:

Can anyone help clarify this ?


#3

Unfortunately I can’t edit the question anymore but in hindsight this doesn’t seem like a ‘first steps’ question as the answer may be quite involved :slight_smile:


#4

If there’s no response before, I will ask around at JuliaCon2018 regarding this and report back. If I can’t figure it out by then I’ll post an issue on Github.


#5

Update, decided to go ahead and put an issue on Github: