[firedrake] tracking write accesses to dats/functions

Eike Mueller e.mueller at bath.ac.uk
Sun Nov 23 18:47:01 GMT 2014


Hi Florian,

this is for an extruded mesh and I’m always working in a horizontal DG space, so that the assembled matrix has a block-structure (i.e. there are no couplings between different columns). In each block (i.e. column) the matrix is banded. Mathematically, I can invert the matrix in each column independently without assembling the global matrix. I need this for my multigrid smoother. In each column I create a dat which stores the banded matrix and assemble it locally by hand. I then write my own kernels (looping over the 2d grid) to, for example, apply the local banded matrix or do a LU decomposition and solve with LAPACK.

So in summary, I do not use the PyOP2 Mat() class, but represent my matrices by Functions (I create a DG0 space of size bandwidth*n on the base mesh).

Thanks,

Eike
--

Dr Eike Hermann Mueller
Research Associate (PostDoc)

Department of Mathematical Sciences
University of Bath
Bath BA2 7AY, United Kingdom

+44 1225 38 5803
e.mueller at bath.ac.uk
http://people.bath.ac.uk/em459/

> On 23 Nov 2014, at 17:19, Florian Rathgeber <florian.rathgeber at imperial.ac.uk> wrote:
> 
> 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
> 
> _______________________________________________
> firedrake mailing list
> firedrake at imperial.ac.uk <mailto:firedrake at imperial.ac.uk>
> https://mailman.ic.ac.uk/mailman/listinfo/firedrake <https://mailman.ic.ac.uk/mailman/listinfo/firedrake>
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the firedrake mailing list