-
Notifications
You must be signed in to change notification settings - Fork 1
Lazy evaluation #582
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
base: master
Are you sure you want to change the base?
Lazy evaluation #582
Conversation
Won’t yet handle multiple expressions.
so we don’t have to deal with multiple return values.
|
This is ready for a look @kwmsmith. |
Conflicts: distarray/globalapi/context.py distarray/globalapi/tests/test_context.py
|
Closes #301 |
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.
Here and below, looks like some pprints made it through.
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.
Fixed.
|
There are 21 skips in the IPython test run -- is that normal? |
|
I did add a bunch of MPI-only tests to test lazy-eval... |
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.
So does this allow you to create a context that is always lazy?
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.
Yeah, or at least lazy from the get-go. It really just sets <context>.lazy = True right off the bat. You can still set it to False later if you want.
|
Postponing to 0.7. |
Based on #580.
For example:
Our implementation
On the client, when
<context>.lazy == True:<context>._sendq)<context>.sync()is called, the both queues are sent to the engines (one queue per engine actually), and a realrecvis blocked upon.On the engines, when a
'process_message_queue'message is received (containing the queues):sendqis processed, one at a time, and the placeholder values from therecvqare used to feed values forward into the engine-side computationOn the client:
A note on my names
There's a
Contextattribute calledlazy, and aContextmethod calledlazy_eval()that is a context manager (decorated bycontextlib.contextmanager) that sets and unsetslazyunder the hood. If you have better ideas for those names, let me know.Benchmark
I also added a simple benchmark in
examples/lazy_eval. I time a loop that computestanhon a DistArray for a settable number of iterations, both in lazy mode or in the default eager mode. Lazy mode seems to beat eager, but it's not as dramatic as I would have expected. I should probably think through the benchmark more.