-
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
mpi: Generate deterministic code for overlap mode #2303
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2303 +/- ##
=======================================
Coverage 86.69% 86.69%
=======================================
Files 229 229
Lines 43043 43043
Branches 7983 7983
=======================================
Hits 37318 37318
Misses 5034 5034
Partials 691 691 ☔ View full report in Codecov by Sentry. |
devito/passes/iet/misc.py
Outdated
@@ -138,6 +138,8 @@ def relax_incr_dimensions(iet, options=None, **kwargs): | |||
def generate_macros(iet): | |||
applications = FindApplications().visit(iet) | |||
headers = set().union(*[_generate_macros(i) for i in applications]) | |||
# Sort for deterministic code generation | |||
headers = sorted(headers) |
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.
same filter_sorted
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.
For this I think filter-sorted is redundant. What would it offer more?
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 this is conceptually wrong and useless:
Conceptually wrong because if all passes appending headers had to ensure uniquess it would be painful. BTW it's not even just the headers, it would be everything that can get passed to metadata
.
Which brings us to the second point, useless: see here:
https://github.com/devitocodes/devito/blob/master/devito/passes/iet/engine.py#L123
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.
obviously if you instead added it because it generates bad code, then there's a bug somewhere else
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.
Correct! Thanks, it was a side-effect of the compute regions non-determinism, catching the first (min/max) area to be computed
0c03f1a
to
bc63cc8
Compare
bc63cc8
to
892617d
Compare
@mloubout @FabioLuporini this should be ok? |
devito/passes/iet/misc.py
Outdated
@@ -138,6 +138,8 @@ def relax_incr_dimensions(iet, options=None, **kwargs): | |||
def generate_macros(iet): | |||
applications = FindApplications().visit(iet) | |||
headers = set().union(*[_generate_macros(i) for i in applications]) | |||
# Sort for deterministic code generation | |||
headers = sorted(headers) |
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 this is conceptually wrong and useless:
Conceptually wrong because if all passes appending headers had to ensure uniquess it would be painful. BTW it's not even just the headers, it would be everything that can get passed to metadata
.
Which brings us to the second point, useless: see here:
https://github.com/devitocodes/devito/blob/master/devito/passes/iet/engine.py#L123
892617d
to
81b677b
Compare
compiler: Switch to filter_sorted
81b677b
to
a272ba3
Compare
Thanks, merged |
Overlap mode did not have deterministic code generation.
compute0 calls could have random order.
Also, MIN/MAX macros could have random order. (this is a side-effect, not overlap specific)
To reproduce, you could run a script multiple times with DEVITO_MPI=overlap