On 23/11/14 12:11, Eike Mueller wrote:
Dear firedrakers,
can I somehow check whether a dat/function has been written to since I last performed a given operation on it?
I have a banded matrix A stored in each cell on mesh, and whenever I solve the equation A.x = b (separately in each column, of course) I want to do this in two steps:
(1) calculate the LU decomposition (lapack dgbtrf) (2) solve based on that LU decomposition (lapack dgbtrs)
I have to do a lot of solves, so for efficiency I want to only do (1) if my matrix A has changed. So when I do a solve, I check if a flag lu_decomp is True (and this flag is set to False upon matrix creation). If it is, then I go straight to (2), otherwise I do (1) first. But I need to make sure that whenever my banded matrix has been written to lu_decomp is set back to False.
I'm not exactly sure I understand what you're trying to do. Are those matrices represented by firedrake.Matrix/pyop2.Mat? If so, they're only ever written to when you call assemble on the Matrix object. You can check the assembled property to see whether the Matrix is assembled and _needs_reassembly to check whether it needs to be reassembled. If you're interested whether or not PETSc has written to the matrix during solve I'm not sure. I don't think an assembled matrix is written to at all, but maybe Lawrence can clarify. Hope this helps, Florian
Thanks,
Eike