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

Multiple volumes #726

Merged
merged 25 commits into from
Sep 21, 2022
Merged

Multiple volumes #726

merged 25 commits into from
Sep 21, 2022

Conversation

majosm
Copy link
Collaborator

@majosm majosm commented Aug 15, 2022

Extracted out of #630. Depends on inducer/grudge#246 and inducer/meshmode#342.

Questions for the review @lukeolson:

  • Is the scope and purpose of the PR clear?
    • The PR should have a description.
      • Common updates include updating dcoll, BoundaryDomainTag (from grudge multi-volume), adding a dof descriptor dd, promoting the boundary tags.
    • The PR should have a guide if needed (e.g., an ordering).
  • Is every top-level method and class documented? Are things that should be documented actually so?
    • add a more complete description in the docstring of multiple-volumes-mpi.py to check this off.
  • Is the interface understandable? (I.e. can someone figure out what stuff does?) Is it well-defined?
  • Does the implementation do what the docstring claims?
  • Is everything that is implemented covered by tests?
  • Do you see any immediate risks or performance disadvantages with the design? Example: what do interface normals attach to?

kappa=1., s0=-6., time=0, operator_states_quad=None,
grad_cv=None, quadrature_tag=None, boundary_kwargs=None,
kappa=1., s0=-6., time=0, quadrature_tag=DISCR_TAG_BASE,
volume_dd=DD_VOLUME_ALL, boundary_kwargs=None,
Copy link
Contributor

Choose a reason for hiding this comment

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

Delete boundary_kwargs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can't yet, some of the drivers still use it (isolator and nozzle).

mirgecom/artificial_viscosity.py Outdated Show resolved Hide resolved
Comment on lines 163 to 159
kappa=1., s0=-6., time=0, quadrature_tag=DISCR_TAG_BASE,
volume_dd=DD_VOLUME_ALL, boundary_kwargs=None,
Copy link
Contributor

Choose a reason for hiding this comment

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

quadrature_tag and volume_dd both contain a discretization tag.

You could do volume_dd=None and then allow (with a deprecation warning) a quadrature_tag to be passed, otherwise raise.

(Here and elsewhere.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As we discussed elsewhere, the two discretization tags here are only sometimes redundant. I tried to remove those cases.

dd_base = volume_dd
dd_vol = dd_base.with_discr_tag(quadrature_tag)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm getting myself confused on how dd_base, dd_vol, volume_dd are intended to be different. (Add a comment?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did my best to clarify the naming. I'm now using dd for the function parameters, checking that they're volumes where required, and then using dd_vol and dd_vol_quad internally for the base and quadrature discretizations, respectfully (and using the same naming scheme for other dds like bdry/allfaces and arrays).

Comment on lines 268 to 269
dd_allfaces = dd_trace.with_domain_tag(
replace(dd_trace.domain_tag, tag=FACE_RESTR_ALL))
Copy link
Contributor

Choose a reason for hiding this comment

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

This is clunky. 🤷

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in inducer/grudge#280 with with_boundary_tag.



def grad_cv_operator(
discr, gas_model, boundaries, state, *, time=0.0,
numerical_flux_func=num_flux_central,
quadrature_tag=DISCR_TAG_BASE,
quadrature_tag=DISCR_TAG_BASE, volume_dd=DD_VOLUME_ALL,
Copy link
Contributor

Choose a reason for hiding this comment

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

Extra quadrature_tag

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Still needed.



def grad_t_operator(
discr, gas_model, boundaries, state, *, time=0.0,
numerical_flux_func=num_flux_central,
quadrature_tag=DISCR_TAG_BASE,
quadrature_tag=DISCR_TAG_BASE, volume_dd=DD_VOLUME_ALL,
Copy link
Contributor

Choose a reason for hiding this comment

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

Extra quadrature_tag

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Still needed.



def ns_operator(discr, gas_model, state, boundaries, *, time=0.0,
inviscid_numerical_flux_func=inviscid_facial_flux_rusanov,
gradient_numerical_flux_func=num_flux_central,
viscous_numerical_flux_func=viscous_facial_flux_central,
quadrature_tag=DISCR_TAG_BASE, return_gradients=False,
Copy link
Contributor

Choose a reason for hiding this comment

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

Extra quadrature_tag

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Still needed.

from meshmode.distributed import get_partition_by_pymetis
return get_partition_by_pymetis(mesh, num_ranks)

if comm.Get_rank() == 0:
Copy link
Contributor

Choose a reason for hiding this comment

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

This all looks pretty bureaucratic. Can we do this in grudge/meshmode? What's the background to this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed from this PR (still need to figure out how to clean it up, but we'll worry about that later.)

@@ -335,8 +337,9 @@ def viscous_facial_flux_central(discr, state_pair, grad_cv_pair, grad_t_pair,
def viscous_flux_on_element_boundary(
discr, gas_model, boundaries, interior_state_pairs,
domain_boundary_states, grad_cv, interior_grad_cv_pairs,
grad_t, interior_grad_t_pairs, quadrature_tag=None,
numerical_flux_func=viscous_facial_flux_central, time=0.0):
grad_t, interior_grad_t_pairs, quadrature_tag=DISCR_TAG_BASE,
Copy link
Contributor

Choose a reason for hiding this comment

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

Extra quadrature_tag

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Still needed.

@majosm majosm force-pushed the multi-volume branch 2 times, most recently from 3109bca to faf3717 Compare August 29, 2022 17:29
@majosm majosm force-pushed the multi-volume branch 2 times, most recently from 7200ebb to c0780b8 Compare September 1, 2022 17:57
@majosm
Copy link
Collaborator Author

majosm commented Sep 1, 2022

@matthiasdiener @inducer Am I correct in guessing that the current MPI communication tagging strategy isn't guaranteed to work when you call the same operator multiple times in a single compiled function? I ran into some trouble with the example I just set up (multiple-volumes.py), which creates multiple copies of the same mesh with different initial conditions and calls euler_operator on each of them in the RHS. It worked fine in eager, but when I ran it in lazy it looked like the volumes were getting the wrong data at the partition boundaries. I "fixed" it with c0780b8, though I imagine that solution isn't going to work in general. 🙂

@MTCam
Copy link
Member

MTCam commented Sep 1, 2022

@matthiasdiener @inducer Am I correct in guessing that the current MPI communication tagging strategy isn't guaranteed to work when you call the same operator multiple times in a single compiled function? (...)
I "fixed" it with c0780b8, though I imagine that solution isn't going to work in general. 🙂

I know I wasn't asked, but what about doing something like:

def euler_operator(..., cv_comm_tag=EulerCVCommTag, temperature_comm_tag=EulerTemperatureCommTag)

... after making those comm tags importable classes? That way the driver writer can override or pass different tags if needed/wanted?

@majosm
Copy link
Collaborator Author

majosm commented Sep 1, 2022

I know I wasn't asked, but what about doing something like:

def euler_operator(..., cv_comm_tag=EulerCVCommTag, temperature_comm_tag=EulerTemperatureCommTag)

... after making those comm tags importable classes? That way the driver writer can override or pass different tags if needed/wanted?

I guess so, but it would be nice if we didn't have to do that...

That version would also leave me with some (admittedly self-inflicted) challenges, since I made the number of volumes in that example a parameter. 🙂

@majosm majosm force-pushed the multi-volume branch 4 times, most recently from 5eaf339 to 87339e5 Compare September 7, 2022 22:45
@majosm
Copy link
Collaborator Author

majosm commented Sep 13, 2022

Ready for review again. I'm going to let the production CI fail until this gets pretty close to being ready to merge (and I think the doc CI will fail until inducer/grudge#280 goes in).

@majosm majosm marked this pull request as ready for review September 15, 2022 15:15
@majosm majosm requested a review from lukeolson September 16, 2022 14:07
@majosm
Copy link
Collaborator Author

majosm commented Sep 16, 2022

The doc CI failures are one thing getting in the way of merging this into main at the moment. @matthiasdiener and I looked at this a couple of weeks ago, and IIRC the conclusion was that it seems to be pulling doc references from grudge main, not the multi-volume branch. Maybe there's a way to work around this?

@inducer
Copy link
Contributor

inducer commented Sep 16, 2022

https://github.com/inducer/pytato/blob/69e2a6c29df691c529f55be44fab0d8f1d193c4c/doc/conf.py#L45-L49

make_fluid_state
)
from logpyle import IntervalTimer, set_dt
from mirgecom.euler import extract_vars_for_logging
Copy link
Contributor

Choose a reason for hiding this comment

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

Should group this import above. There are a couple that need grouping.

@majosm majosm merged commit 0a4a40a into illinois-ceesd:main Sep 21, 2022
@majosm majosm mentioned this pull request Sep 21, 2022
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants