-
Notifications
You must be signed in to change notification settings - Fork 159
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
BUG: Decreased performance when assembling expressions with new constants #2999
Comments
Is this fixed by #2996? |
That raises an exception:
After adding:
to the
|
The hash of a constant as implemented in #2996 depends on its |
The previous performance is restored if |
A related issue:
leads to, with an empty cache,
EDIT: When run on more than one process. |
Yeah, this is definitely a consequence of not relabeling constants before handing off to the compilation pipeline.
|
I suspect this means that UFL's ConstantValue needs to be relabelled in form preprocessing (or else Firedrake's use of it is wrong). |
Whether or not new compilation is triggered also depends on the order in which forms are assembled. I'm seeing this when running individual tests -- even if the whole test suite has been run, running a single test can lead to new compilation. |
This is a consequence of the same thing: if a |
I am not in the picture for the meshfree Constant you are preparing, but if you want more stable signature it must have rules for renumbering implemented here https://github.com/FEniCS/ufl/blob/main/ufl/form.py#L631 Upstream UFL only renumbers Domains, Coefficients and |
I have added this to the agenda for the next Firedrake meeting. Clearly a renumbering is required but we need to be careful about how we do this. |
I think you are abusing the UFL type hierarchy here. |
We chose this approach because we thought that UFL shouldn't care whether or not values are provided at compile-time or runtime. The distinction is more of a Firedrake/TSFC implementation detail. |
Ah, I see. I suppose it speaks to, in some senses, a bit of a misdesign in the way UFL handles domains. Why does a UFL |
That seems like a reasonable approach. |
The following workaround seems to work:
with timings (with an empty cache)
Is this a bad idea? |
Describe the bug
Assembly of expressions using constants can be slow if new
Constant
objects are instantiated.Steps to Reproduce
Example code:
With revision c5cd37a and an empty cache:
With revision a94b01c and an empty cache:
Environment:
Ubuntu 22.04
The text was updated successfully, but these errors were encountered: