Skip to content

Stash computed form on tensor for re-assembly - #244

Merged
kynan merged 3 commits into
masterfrom
stash-computed-form-on-tensor
Apr 9, 2014
Merged

Stash computed form on tensor for re-assembly#244
kynan merged 3 commits into
masterfrom
stash-computed-form-on-tensor

Conversation

@kynan

@kynan kynan commented Apr 8, 2014

Copy link
Copy Markdown
Contributor

When passing in a tensor to assemble, stash the form and computed kernels on
the tensor such that if we reassemble the same form on the same tensor we save
having to preprocess/split the form again.

When passing in a tensor to assemble, stash the form and computed
kernels on the tensor such that if we reassemble the same form on
the same tensor we save having to preprocess/split the form again.
Comment thread firedrake/solving.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this safe? I would have thought that we can use the same tensor to assemble a different form as long as the function spaces match. I think this means the following would fail:

v = TestFunction(V)

f = assemble(v*dx)

# do stuff with f

f = assemble(Constant(2)*v*dx, tensor=f)

Now the second time f is v_dx, not 2_v*dx

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You could check by:

if blah and form is tensor._form:
   ...

I think

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.

Isn't that exactly what I'm doing? Note that the check in line 389 is identical to this:

if hasattr(tensor, "_form") and hasattr(tensor, "_kernels") and tensor._form is f

@wence-

wence- commented Apr 8, 2014

Copy link
Copy Markdown
Contributor

Ah. I misread the first getattr as hasattr

@kynan

kynan commented Apr 8, 2014

Copy link
Copy Markdown
Contributor Author

I've added the test you mentioned and another one assembling a bilinear form into a pre-existing tensor.

@dham

dham commented Apr 9, 2014

Copy link
Copy Markdown
Member

I think this can land.

kynan added a commit that referenced this pull request Apr 9, 2014
…tensor

Stash computed form on tensor for re-assembly
@kynan
kynan merged commit 82a7d42 into master Apr 9, 2014
@kynan
kynan deleted the stash-computed-form-on-tensor branch April 9, 2014 14:05
connorjward added a commit that referenced this pull request Dec 4, 2024
* Don't help loopy scheduling with priorities

The API for accessing instructions changed and keeping this optimisation
has been deemed unnecessary.

API Change details:

A Program is a collection of
LoopKernels now where you specify which kernel's instructions you intend
to query:

So instead of

program.instructions[0]

it would be

program["kernel_name"].instructions[0]

* Save names of kernels that tsfc generates

* Fix failing test due to API change

* Use make_function to build loopy kernel

* translate gem.Inverse to "inverse", not "inv" in loopy

* set lang_version when generating loopy kernel

* COFFEE kernelbuilder sets name

* Testing: set loopy to correct branch.

* Testing: Fix egg information of loopy?

* Jenkins

* Drop package branches.

* Update docstring

Co-authored-by: Lawrence Mitchell <lawrence@wence.uk>
Co-authored-by: Connor Ward <c.ward20@imperial.ac.uk>
Co-authored-by: Sophia Vorderwuelbecke <sv2518@ic.ac.uk>
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.

3 participants