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

Symbolic ConservedVars and _cls_has_array_context_attr=True #672

Open
majosm opened this issue May 25, 2022 · 3 comments
Open

Symbolic ConservedVars and _cls_has_array_context_attr=True #672

majosm opened this issue May 25, 2022 · 3 comments

Comments

@majosm
Copy link
Collaborator

majosm commented May 25, 2022

Some of the tests construct ConservedVars instances containing pymbolic expressions, and thus don't have array contexts. This is causing warnings to be emitted, e.g.:

mirgecom/fluid.py:235: DeprecationWarning: No array context was found. This will be an error starting in July of 2022. If you would like the function to return None if no array context was found, use get_container_context_recursively_opt.
    return get_container_context_recursively(self.mass)

This comes from the ConservedVars.array_context attribute. I don't think we can use get_container_context_recursively_opt here without changing how we set _cls_has_array_context_attr (which IIRC is not something we want to do?)

Not sure exactly how to avoid this. Do we need something like a pymbolic array context?

cc @inducer

@inducer
Copy link
Contributor

inducer commented May 26, 2022

IMO, this is further evidence that inducer/arraycontext#162 should happen.

Where is get_container_context_recursively_opt called, and how come it's not a big deal that it returns None?

@MTCam
Copy link
Member

MTCam commented May 27, 2022

IMO, this is further evidence that inducer/arraycontext#162 should happen.

Where is get_container_context_recursively_opt called, and how come it's not a big deal that it returns None?

We don't call get_container_context_recursively_opt, the warning is telling us that we should if the container sometimes won't have an array context. We call get_container_context_recursively here:

@property

and we set this:

_cls_has_array_context_attr=True,

The main concern that I had is that there must be some performance implication of setting things up to use get_container_context_recursively_op, otherwise why not just always return None when the container doesn't have one? In real runs, we always have a context afaik, and I didn't want to just switch it up to use get_container_context_recursively_opt until we had spoken with you about it.

Do you have any guidance on that?

@inducer
Copy link
Contributor

inducer commented Jun 9, 2022

The performance concern is just for the traversal of the container structure, which doesn't happen at execution time when we're using lazy eval, so I think that's a minor concern.

Do we need something like a pymbolic array context?

I'm not sure that makes sense.

I'm still thinking that inducer/arraycontext#162 should happen soon-ish. That means the overload logic that @MTCam is asking about will have to be a bit more generous in terms of what it accepts, but I think that's an OK price to pay for the removal of something that ostensibly makes no sense.

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

No branches or pull requests

3 participants