-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize remotecall pattern used in distributed loading #21745
Conversation
base/loading.jl
Outdated
for (id, ref) in refs | ||
m = fetch(ref) | ||
|
||
results = Any[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sizehint!(Vector{Tuple{Int,Any}}(), nprocs())
?
Looks like others
is not required, should be ok to just skip myid()
before @async
block. One allocation less :)
I'm not sure I follow. Why is |
for pids (2,3,4,5) :
In the first case, the results of the |
Will merge after a green CI |
why the rush? it's been open less than a day, give people a chance to see it |
Sure, no issues. |
for r in refs; wait(r); end | ||
@sync begin | ||
for p in filter(x -> x != 1, procs()) | ||
@async remotecall_fetch(p) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should use remotecall_wait
, since the old version called wait
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to use a remotecall_fetch
(after ensuring that the remote execution returns nothing
) when we we do not need the result of the remote computation. Will avoid unnecessary storage and and clean-up of the result on the remote node.
Will merge in a short while. |
* Optimize remotecall pattern used in distributed loading (cherry picked from commit 9694de7)
Came across this possible optimization while I was looking at the messages sent between workers in #21718
Currently the fetch/wait calls are 1) executed serially and 2) are an extra network call as compared with using a
@sync for p in pids; @async remotecall_fetch....
pattern.Have replaced the
@spawnat followed by fetch/wait
calls with an asyncremotecall_fetch