-
Notifications
You must be signed in to change notification settings - Fork 229
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
compiler: Misc compiler fixes and improvements -- part II #2138
Conversation
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Codecov Report
@@ Coverage Diff @@
## master #2138 +/- ##
==========================================
- Coverage 87.09% 87.08% -0.02%
==========================================
Files 223 223
Lines 39689 39830 +141
Branches 5147 5168 +21
==========================================
+ Hits 34567 34685 +118
- Misses 4544 4567 +23
Partials 578 578
|
de9ace3
to
27fa6d3
Compare
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.
What was the problem with u.dx2? Is there an issue somewhere about this?
These were PRO issues, and all new tests therefore a in PRO That said, I can assure you that there's no new feature here in OSS territory that hasn't been equipped with at least one test. Most changes here are compilation-related generalisations and improvements which are stress-tested by what de-facto are higher-order regression tests in PRO |
3103a91
to
404339f
Compare
devito/ir/stree/algorithms.py
Outdated
# it doesn't need to wrap any subtree. Thus, a WaitLock acts like | ||
# a barrier to what follows inside `d` | ||
NodeSync(syncs, tip) | ||
return tip |
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.
nitpicking, Since this doesn't really return anything it'd me slightly more consistent to have
tip = NodeSync(syncs, tip)
return
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.
improved and fixed 👍
@@ -527,7 +527,9 @@ def function(self): | |||
def imask(self): | |||
return self._imask | |||
|
|||
@cached_property | |||
# TODO: cached_property here will break our pickling tests for reasons that |
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.
out of curiosity which test?
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.
PRO tests landing with the fix-udx2-MPI
branch in PRO. For future reference: they are test_layered_funcs.py::TestMisc::test_pickling
and test_composite_funcs.py::TestMisc::test_pickling
devito/types/array.py
Outdated
@@ -203,6 +211,13 @@ def _mem_shared(self): | |||
def _mem_constant(self): | |||
return self._scope == 'constant' | |||
|
|||
@property |
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.
Move to AbstractFunction
I'd say
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.
I will see how I can improve things. Note that DiscreteFunction has a _distributor
attribute too
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.
perhaps this should be hoisted to the superclass:
...
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.
I think so yes
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.
done
@@ -1,3 +1,5 @@ | |||
import cloudpickle as pickle |
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.
We might want to do both picklle
and cloudpickle
as parameters for all pickling tests
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.
AFAICT, cloudpickle >>> pickle though
Anyway, how would you implement it? Thinking about it, and it doesn't sound obvious... does it?
@@ -1343,6 +1350,25 @@ def test_npthreads(self): | |||
assert op.arguments(time_M=2, npthreads0=5) | |||
|
|||
|
|||
class TestMisc(object): | |||
|
|||
def test_pickling(self): |
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.
That should be in test_pickle
but I guess it's easier for gpu to dso it here
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.
mmhh in my view, the GPU tests are "more specific" than the pickling tests
Just like some MPI tests are found outside of test_mpi.py
tests/test_pickle.py
Outdated
@@ -1,7 +1,7 @@ | |||
import pytest | |||
import numpy as np | |||
from sympy import Symbol | |||
import pickle | |||
import cloudpickle as pickle |
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.
As above, import both and make all tests for each
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.
ah maybe i see what you mean now... are you saying something like
import pickle as pickle0
import cloudpickle as pickle1
@pytest.parametrize('pickle', [pickle0, pickle1])
def test_...(...):
...
?
isn't it overkill?
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.
Yes what I mean. Since there seems to be breaking difference between those two pickling implementation I think it would be safer to have it yeah. THese are very cheap tests so it shouldn't be an issue
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. The point, though, is that even if cloudpickle didn't work, then pickle still surely wouldn't, at least with PRO, because pickle can't pickle (sorry...) lambda functions
BTW, the other interesting candidate is dill
Anyway, since it's a minor change, I'm happy to test both cloudpickle and pickle here in OSS. Will try to do it tomorrow
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.
done. Please take a look, I've restructured a few things
404339f
to
9636366
Compare
@mloubout update: addressed your comments and rebased on latest master |
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.
Not sure I have something to comment. Should I look into something specific that you believe needs more attention?
@@ -338,35 +338,37 @@ def _make_all(self, f, hse, msg): | |||
|
|||
def _make_copy(self, f, hse, key, swap=False): | |||
dims = [d.root for d in f.dimensions if d not in hse.loc_indices] | |||
ofs = [Symbol(name='o%s' % d.root, is_const=True) for d in f.dimensions] |
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.
That's the same symbol as grid.origin
, doesn't seem to create an issue anywhere but seems risky
No description provided.