firedrakeproject / firedrake

Firedrake is an automated system for the portable solution of partial differential equations using the finite element method (FEM)
https://firedrakeproject.org
Other
517 stars 160 forks source link

ComponentTensor has no code generation #3834

Open miklos1 opened 8 years ago

miklos1 commented 8 years ago

They are all removed before code generation through renaming indices. Unfortunately this may cause some duplication in the generated code. One known case is the Jacobian inverse, but there may be others.

The UFL snippet for matrix inversion is to assemble the adjugate (ListTensor), and then element-wise divide it by the determinant (ComponentTensor). If the Jacobian inverse is applied several times, then the division step will happen several times due to the "inlining" of ComponentTensors. While this particular problem can be "fixed" by changing the UFL snippet, the same problem might arise in other cases as well.

wence- commented 8 years ago

I guess the refcounting of temporaries doesn't take care of this?

sv2518 commented 4 years ago

I have introduced code generation of ComponentTensors by translating them into loopy in the branch translation-of-comptensors. Currently I am not doing any optimisations on the expressions which are translated from Slate to gem. I am unsure if I will still need ComponentTensor code generation after including the optimisations.

wence- commented 4 years ago

ComponentTensor does now have code generation via firedrakeproject/tsfc#203. However the optimisation that needs to be applied in the original description is not yet applied.

miklos1 commented 4 years ago

I may write up the optimisations mentioned in the description as two separate issues, and then this issue could be closed.