Skip to content

Cache bilinear form action on the Matrix#250

Merged
kynan merged 4 commits into
masterfrom
performance/cache-ufl-action-on-matrix
Apr 11, 2014
Merged

Cache bilinear form action on the Matrix#250
kynan merged 4 commits into
masterfrom
performance/cache-ufl-action-on-matrix

Conversation

@kynan
Copy link
Copy Markdown
Contributor

@kynan kynan commented Apr 10, 2014

This saves us from having to go through compile_form repeatedly for the form
action of the bilinear form of a matrix on a function, which is required for
solving linear systems with boundary conditions.

Comment thread firedrake/types.py
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please make it explicit in the docs that this is the form without BCs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

This saves us from having to go through compile_form repeatedly for
the form action of the bilinear form of a matrix on a function, which
is required for solving linear systems with boundary conditions.
@kynan
Copy link
Copy Markdown
Contributor Author

kynan commented Apr 10, 2014

@dham I think this is now correct.

Comment thread firedrake/types.py Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this prevent all of the preprocessing and other things from happening every time? That was, after all, the goal.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It does, because the first time we call _assemble, we stash the kernels on the form, and since we're reusing the same form (just with the coefficients replace) these are getting picked up. I can make a not of that to make the code more understandable.

kynan added 3 commits April 11, 2014 10:45
Replace the coefficient in the cached form action by the currently
passed in Function. Otherwise we'd keep using the Function from the
first call to _form_action.
@kynan
Copy link
Copy Markdown
Contributor Author

kynan commented Apr 11, 2014

Now with test. Is this good to go?

@dham
Copy link
Copy Markdown
Member

dham commented Apr 11, 2014

Yes. Go for it.

kynan added a commit that referenced this pull request Apr 11, 2014
…ction-on-matrix

Cache bilinear form action on the Matrix

This saves us from having to go through compile_form repeatedly for the form
action of the bilinear form of a matrix on a function, which is required for
solving linear systems with boundary conditions.
@kynan kynan merged commit 29e05b7 into master Apr 11, 2014
@kynan kynan deleted the performance/cache-ufl-action-on-matrix branch April 11, 2014 10:22
connorjward pushed a commit that referenced this pull request Dec 4, 2024
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