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

Signature computation speedup #94

Merged
merged 6 commits into from
Apr 24, 2022
Merged

Signature computation speedup #94

merged 6 commits into from
Apr 24, 2022

Conversation

michalhabera
Copy link
Contributor

@michalhabera michalhabera commented Mar 19, 2022

EDIT: See comments for updates. Current solution is based on unique post traversal and computing hash at each node during the traversal.

For complicated UFL forms signature computation easily dominates JIT compilation, often even assembly times. Expression signatures are fetched e.g. in FFCx for disk caching - which contributes a unique hash into binary file name.

This PR changes pre_traversal to unique_pre_traversal for expression hashdata, which has significant 700x speedup in some cases (see cProfiler images below). Additionally, operands (their ufl typecode) are added to the generated hashdata to make it unique.

ufl/algorithms/signature.py Outdated Show resolved Hide resolved
ufl/algorithms/signature.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@wence- wence- left a comment

Choose a reason for hiding this comment

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

Thanks!

@michalhabera michalhabera merged commit 2ad4ef1 into main Apr 24, 2022
@michalhabera michalhabera deleted the michal/signature-perf branch April 24, 2022 07:02
pbrubeck pushed a commit to firedrakeproject/ufl that referenced this pull request Nov 1, 2022
* Run unique traversal

* Remove commented old code

* Unique traversal with appended operands

* Unique post traversal with cached ops

* Apply hashing during post traversal

* Convert bytes to hex directly
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.

2 participants