-
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: Support for C-level MPI_Allreduce #2344
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2344 +/- ##
==========================================
+ Coverage 86.81% 86.86% +0.04%
==========================================
Files 233 234 +1
Lines 43759 43886 +127
Branches 8076 8102 +26
==========================================
+ Hits 37990 38122 +132
+ Misses 5061 5059 -2
+ Partials 708 705 -3 ☔ View full report in Codecov by Sentry. |
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.
Overallm the reduction part looks good, but we need to think carefully about the sparse subfunc because the current changes I think just make our setup worse and harder to fix later.
Can discuss if we wanna proceed but tag an "urgent" issue on it
[dv.Inc(s, p), dv.Eq(mr.n[0], s)], | ||
name='sum') | ||
op.apply(**kwargs) | ||
op = dv.Operator([dv.Eq(s, 0.0)] + eqns + |
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: can probalby wrap (since everywhere in this file) the s=0, eqs, s+=expr, n[0]=s
into an make_reduction(eqns, expr)
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.
will do in my next PR
__all__ = ['DistReduce'] | ||
|
||
|
||
class DistReduce(sympy.Function, Reconstructable): |
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.
why do you need sympy.Function
?
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.
well it needs to be a sympy object and the most logical one is a Function in my opinion
__rkwargs__ = ('op', 'grid', 'ispace') | ||
|
||
def __new__(cls, var, op=None, grid=None, ispace=None, **kwargs): | ||
obj = sympy.Function.__new__(cls, var, **kwargs) |
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.
op.__new__
?
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.
no op
is a devito internal type
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, we should start adding types...)
mapper = { | ||
OpInc: 'MPI_SUM', | ||
OpMax: 'MPI_MAX', | ||
OpMin: 'MPI_MIN', |
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.
missing OpProd: MPI_PROD
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.
coming from ... ? we don't support reductions that aren't inc/max/min IIRC
devito/types/sparse.py
Outdated
"or iterable (e.g., list, np.ndarray)" % key) | ||
if d in key.dimensions and not self.alias: | ||
# From a reconstruction which leaves `dimensions` intact | ||
return key |
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 future reference, this is very problematic (both if and else case) because now key
's parent does not match the sparsefunction that uses it as a subfunction so can lead to very problematic runtime args/post_process so we may need to completely avoid this rebuild and always create a new subfunc using the key's data (need a '_local' initalizer
@@ -453,7 +453,7 @@ def test_sum_sparse(self): | |||
|
|||
def test_min_max_sparse(self): | |||
""" | |||
Test that mmin/mmax work on SparseFunction | |||
Test that mmin/mmax work on SparseFunction. |
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.
"SparseFunctions"
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.
will fix in my next PR
def _rcompile_wrapper(cls, **kwargs0): | ||
def wrapper(expressions, **kwargs1): | ||
return rcompile(expressions, {**kwargs0, **kwargs1}) | ||
def _rcompile_wrapper(cls, **kwargs): |
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.
This kwargs0 was recently changed as well right, now back to it, ok
No description provided.