-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Update parallel.rst #10277
Update parallel.rst #10277
Conversation
It was very confusing to me how to pass messages back and forth between processes, so I thought a complete example
Corrected so mistakes and used the array returned from addprocs
looks like this failed the whitespace test on CI |
Added white space to try to mimic the code in isready. When I preview the file though it just shows the top most outline, so I am unfortunately not sure how to make sure it will pass the built in whitespace test.
Changed @spawnat to use a variable instead of a hardcoded constant.
end | ||
@spawnat procList[1] f(rr) | ||
put!(rr, 8) | ||
@show( take!(rr) ) # => 64 |
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.
Though the chances of seeing a return value of 8 here is almost nil, julia does not guarantee that f
will execute on the remote worker before the take!
here.
Hence, a better example for message passing would be to have two remote refs, say r1 and r2. r1 is always written to from the local process and read from the remote process, while r2 is always written to at the remote process and read from the local.
@simeonbassett do you have time to squash and rebase? Also, it would be great if you could address @amitmurthy's comment. |
Old Doc PRs tend to be the most stale.....feel free to open additional issues/PRs around improvements on latest master. |
It was very confusing to me how to pass messages back and forth between processes, so I thought a complete example would help quite a bit.