Skip to content

Array container support and batched (eager) communication#154

Merged
inducer merged 50 commits into
mainfrom
thg/array-containers
Dec 6, 2021
Merged

Array container support and batched (eager) communication#154
inducer merged 50 commits into
mainfrom
thg/array-containers

Conversation

@thomasgibson

@thomasgibson thomasgibson commented Aug 17, 2021

Copy link
Copy Markdown
Collaborator

This PR modifies existing grudge routines to work on arbitrary array containers and batches eager MPI communication of containers.

Requires: inducer/arraycontext#91

Comment thread grudge/trace_pair.py Outdated
Comment thread grudge/trace_pair.py Outdated

@alexfikl alexfikl left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Gave this a very quick look and left a few comments here and there, hope you don't mind!

The TracePair stuff seems a bit more complicated, so I mostly skipped it 😁

Comment thread examples/wave/wave-op-mpi.py
Comment thread examples/wave/wave-op-mpi.py Outdated
Comment thread examples/wave/wave-op-mpi.py Outdated
Comment thread examples/wave/wave-op-mpi.py Outdated
Comment thread grudge/op.py Outdated
Comment thread grudge/op.py Outdated
Comment thread grudge/op.py Outdated
Comment thread grudge/projection.py Outdated
@thomasgibson thomasgibson marked this pull request as ready for review September 16, 2021 19:09

@thomasgibson thomasgibson left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Some comments to help explain my thoughts.

Comment thread grudge/trace_pair.py Outdated
Comment thread grudge/trace_pair.py Outdated
@thomasgibson thomasgibson self-assigned this Sep 20, 2021
@thomasgibson

thomasgibson commented Sep 21, 2021

Copy link
Copy Markdown
Collaborator Author

The Mirgecom CI failure seems to be due to using the map_array_container in the operator application routines (not the distributed memory bits). Will investigate this...

Edit: I don't know if it's something fundamentally wrong with map_array_container, but for some reason, the map_array_container is attempting to serialize floats!?

@alexfikl

alexfikl commented Sep 21, 2021

Copy link
Copy Markdown
Collaborator

The Mirgecom CI failure seems to be due to using the map_array_container in the operator application routines (not the distributed memory bits). Will investigate this...

Edit: I don't know if it's something fundamentally wrong with map_array_container, but for some reason, the map_array_container is attempting to serialize floats!?

Looks like map_array_container is not catching the NotImplementedError for floats correctly and trying to deserialize them anyway. I'd say this is a bug in arraycontext.

I'll try to come up with a fix this afternoon. In the meantime, you can probably work around it by checking not isinstance(vec, DOFArray) and is_array_container(vec) before calling map_array_container (?).

EDIT: Actually, that check needs to be expanded anyway, otherwise it looks a lot like an infinite loop if you give it a float to start with?

@thomasgibson

Copy link
Copy Markdown
Collaborator Author

@alexfikl I think it was a very subtle type-checking issue! I managed to fix the mrigecom issue with this commit: 42adaf1

@thomasgibson thomasgibson changed the title Array container support Array container support and batched (eager) communication Sep 21, 2021

@inducer inducer left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for working on this! A few wrinkles (hopefully easy to answer/fix) in the communication bit, but otherwise this looks nice!

Comment thread grudge/trace_pair.py Outdated
Comment thread grudge/trace_pair.py Outdated
Comment thread grudge/trace_pair.py Outdated
Comment thread grudge/trace_pair.py Outdated
@inducer

inducer commented Sep 23, 2021

Copy link
Copy Markdown
Owner

Unsubscribing... @-mention or request review once it's ready for a look or needs attention.

Comment thread grudge/trace_pair.py Outdated
@thomasgibson thomasgibson added distributed Relating to distributed-memory support enhancement New feature or request labels Sep 27, 2021
@thomasgibson thomasgibson requested a review from inducer October 28, 2021 18:15
@thomasgibson

Copy link
Copy Markdown
Collaborator Author

@inducer when this lands, do not delete this branch; I will take care of it since I need to reset the base branch in #172

@inducer inducer left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks, and sorry again about the long wait on another review. Also sorry that I've uncovered a few more things. I hope most of this is easy. There are a lot of comments here, but most of them are just about consistency in doing the same thing in multiple places. I hope you'll be able to dispatch them quickly using the "apply suggestions" feature.

Comment thread grudge/op.py
Comment thread grudge/op.py
Comment thread grudge/op.py Outdated
a :class:`~meshmode.dof_array.DOFArray`\ s,
:arg vecs: an object array of
:class:`~meshmode.dof_array.DOFArray`\s or
:class:`~arraycontext.container.ArrayContainer` objects,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I don't think _div_helper deals with anything other than object arrays.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I believe this is all cleared up in a877340. _div_helper is intentionally only working on object arrays, as the container is expected to have vector (obj array) entries.

Comment thread grudge/op.py
Comment on lines +281 to +287
:arg vecs: an object array of
:class:`~meshmode.dof_array.DOFArray`\ s or
:class:`~arraycontext.container.ArrayContainer` objects,
where the last axis of the array must have length
matching the volume dimension.
:returns: a :class:`~meshmode.dof_array.DOFArray`.
:returns: a :class:`~meshmode.dof_array.DOFArray` or an
:class:`~arraycontext.container.ArrayContainer` of them.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I don't think _div_helper deals with anything other than object arrays.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I believe this is all cleared up in a877340. _div_helper is intentionally only working on object arrays, as the container is expected to have vector (obj array) entries.

Comment thread grudge/projection.py Outdated
Comment thread grudge/trace_pair.py Outdated
Comment thread grudge/trace_pair.py Outdated
Comment thread grudge/trace_pair.py Outdated
Comment thread grudge/trace_pair.py Outdated
Comment thread grudge/trace_pair.py Outdated
@inducer

inducer commented Nov 3, 2021

Copy link
Copy Markdown
Owner

Unsubscribing... @-mention or request review once it's ready for a look or needs attention.

@thomasgibson

Copy link
Copy Markdown
Collaborator Author

@inducer This is ready for another look

@thomasgibson thomasgibson requested a review from inducer November 12, 2021 00:24
@inducer

inducer commented Dec 1, 2021

Copy link
Copy Markdown
Owner

Thanks for working on this! Some proposed changes to this in #191. This LGTM (and is ready to land in my view) subject to those (or similar) changes.

* Refactor grad/weak grad to use the same helper, simplify div empty handling

* Factor out some redundant code in elementwise reductions
@inducer inducer enabled auto-merge (squash) December 6, 2021 22:56
@inducer

inducer commented Dec 6, 2021

Copy link
Copy Markdown
Owner

Thanks for seeing this through! In it goes. 🎉

@inducer inducer merged commit d48c9bc into main Dec 6, 2021
@inducer inducer deleted the thg/array-containers branch December 6, 2021 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

distributed Relating to distributed-memory support enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Eager distributed: Send array containers together Eager distributed: support array containers Teach grudge about array containers

4 participants