Repository navigation
compiler: Minor tweaks for improved MPI modes #3123
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
Changes from all commits
254b518
578f61b
f515f91
ca72ed4
c180154
954cada
cf12071
d96b640
a9a6853
5e7730d
76784a1
b0e64a1
4429dca
a1ec76e
e6c4de1
6e3d9a9
ddbc175
921d178
5bd6e65
53315e8
d4f44b0
330f6b0
041ecc5
b2d2ada
ac6c9fe
26ad428
411aab5
8abdeef
9233059
4ac1b1b
292b778
d80e2ab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -92,6 +92,19 @@ def union(self, other): | |
| OMapper = namedtuple('OMapper', 'core owned') | ||
|
|
||
|
|
||
| class HasNeighbor(sympy.Function): | ||
|
|
||
| """ | ||
| Flag indicating whether a receive can cross this root bound. | ||
|
|
||
| MPIRegion binds it from the runtime Grid's neighborhood when packing bounds. | ||
| """ | ||
|
|
||
| nargs = 1 | ||
| is_integer = True | ||
| is_nonnegative = True | ||
|
|
||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this just be extracted from
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I simplified everything now, take a new look, but short answer yes |
||
| class HaloScheme: | ||
|
|
||
| """ | ||
|
|
@@ -261,6 +274,8 @@ def omapper(self): | |
|
|
||
| The computed OMapper takes into account: | ||
|
|
||
| * The receive neighbors on the runtime Grid. CORE extends to faces | ||
| with no neighbor. | ||
| * The offsets induced by SubDomains/SubDimensions ("thickness"); | ||
| * Any data alignment requirement of the underlying expressions | ||
| (`_alignment` attribute). | ||
|
|
@@ -280,7 +295,7 @@ def omapper(self): | |
| In this example, the "cumulative" OWNED size is (left=4, right=4), that is | ||
| the max on each DataSide across all Functions, namely ``u`` and ``v``. | ||
|
|
||
| The ``omapper`` will contain the following entries: | ||
| For a rank with neighbors on both sides, the bounds are: | ||
|
|
||
| [(((d, CORE, CENTER),), {d: (d_m + 4, d_M - 4)}), | ||
| (((d, OWNED, LEFT),), {d: (d_m, min(d_m + 3, d_M))}), | ||
|
|
@@ -362,13 +377,12 @@ def omapper(self): | |
| the max point is ``d_M = 1``, which implies that there is exactly one | ||
| point in this region, and this point is redundantly computed as it's | ||
| logically the same as that in the (OWNED, LEFT) region. | ||
|
|
||
| Notes | ||
| ----- | ||
| For each Function, the '^' and 'o' are exactly the same on *all MPI | ||
| ranks*, so the output of this method is guaranteed to be consistent | ||
| across *all MPI ranks*. | ||
| """ | ||
| owned_size = { | ||
| d: (left * HasNeighbor(d.root.symbolic_min), | ||
| right * HasNeighbor(d.root.symbolic_max)) | ||
| for d, (left, right) in self.owned_size.items() | ||
| } | ||
| items = [((d, CENTER), (d, LEFT), (d, RIGHT)) | ||
| for d in filter_sorted(self.dimensions)] | ||
|
|
||
|
|
@@ -377,7 +391,7 @@ def omapper(self): | |
| where = [] | ||
| mapper = {} | ||
| for d, s in item: | ||
| osl, osr = self.owned_size[d] | ||
| osl, osr = owned_size[d] | ||
|
|
||
| # Handle SubDomain/SubDimensions to-honor offsets | ||
| nl = Max(0, *[i for i, _ in self.honored.get(d, [])]) | ||
|
|
@@ -437,7 +451,10 @@ def omapper(self): | |
| except KeyError: | ||
| continue | ||
|
|
||
| aligned_m = IntDiv(m, self._alignment) * self._alignment | ||
| # Preserve empty regions when rounding down a start index | ||
| aligned_m = sympy.Piecewise( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that's a bug fix: empty regions have inverted bounds. For example, rounding the start of [2, 1] down to a multiple of four would turn it into [0, 1], causing two iterations. Piecewise preserves the inverted bounds in that case. |
||
| (IntDiv(m, self._alignment) * self._alignment, m <= M), (m, True) | ||
| ) | ||
|
|
||
| processed[i] = (where, frozendict({**mapper, fvd: (aligned_m, M)})) | ||
|
|
||
|
|
||
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.
Frozendict?