Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

FabioLuporini
Copy link
Contributor

No description provided.

Copy link

codecov bot commented Apr 4, 2024

Codecov Report

Attention: Patch coverage is 84.43396% with 33 lines in your changes are missing coverage. Please review.

Project coverage is 79.44%. Comparing base (6e64c16) to head (a164a32).
Report is 14 commits behind head on master.

Files Patch % Lines
tests/test_error_checking.py 21.42% 11 Missing ⚠️
devito/core/gpu.py 33.33% 4 Missing ⚠️
devito/builtins/arithmetic.py 86.95% 2 Missing and 1 partial ⚠️
devito/mpi/reduction_scheme.py 87.50% 3 Missing ⚠️
devito/operator/operator.py 62.50% 2 Missing and 1 partial ⚠️
tests/test_builtins.py 57.14% 3 Missing ⚠️
tests/test_mpi.py 25.00% 3 Missing ⚠️
devito/ir/clusters/algorithms.py 95.34% 2 Missing ⚠️
devito/ir/support/basic.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2344      +/-   ##
==========================================
- Coverage   86.66%   79.44%   -7.23%     
==========================================
  Files         232      233       +1     
  Lines       43445    43698     +253     
  Branches     8063     8098      +35     
==========================================
- Hits        37653    34714    -2939     
- Misses       5087     8228    +3141     
- Partials      705      756      +51     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@mloubout mloubout left a 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 +
Copy link
Contributor

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)

__all__ = ['DistReduce']


class DistReduce(sympy.Function, Reconstructable):
Copy link
Contributor

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 ?

__rkwargs__ = ('op', 'grid', 'ispace')

def __new__(cls, var, op=None, grid=None, ispace=None, **kwargs):
obj = sympy.Function.__new__(cls, var, **kwargs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

op.__new__ ?

mapper = {
OpInc: 'MPI_SUM',
OpMax: 'MPI_MAX',
OpMin: 'MPI_MIN',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing OpProd: MPI_PROD

"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
Copy link
Contributor

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

i = dv.Dimension(name='mri',)
n = dv.Function(name='n', shape=(1,), dimensions=(i,), grid=grid,
dtype=dtype, space='host')
n.data[:] = 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this initialise to zero already? Also do you need to set the space order of n to 0 so that it doesn't assign a halo?

@@ -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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"SparseFunctions"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants