> On Jul 19, 2017, at 10:55 AM, Richard Tran Mills <[email protected]> wrote:
>
> Fellow PETSc developers,
>
> I'm trying to figure out what my MatDuplicate() implementation for AIJMKL
> should do when the sparse inspector-executor model is being used. I think
> that the behavior should be
>
> * If MAT_COPY_VALUES has been specified, then mkl_sparse_optimize() should be
> executed for the new matrix inside MatDuplicate_SeqAIJMKL().
> * If MAT_COPY_VALUES has not been specified, then don't do the
> mkl_sparse_optimize(), as the user is going to have to specify the nonzero
> entries at some point, and then do MatAssemblyBegin/End (which calls
> mkl_sparse_optimize).
Richard,
I don't think it matters. MatDuplicate() is always called after the matrix
has been assembled so you do have the nonzero structure so presumably the
mkl_sparse_optimize() can be called at the time of MatDuplicate(). Or you can
wait until the next MatAssemblyEnd().
Note that when this value is changed between MatAssemblys
PetscObjectState nonzerostate; /* each time new nonzeros locations
are introduced into the matrix this is updated */
the nonzero structure has changed so you likely need to free the MKL optimize
information and rebuild it with mkl_sparse_optimize.
When state is changed the nonzero values have changed between MatAssembly
PetscObjectState state;
but not the nonzero structure. I don't know if the MKL optimized sparse
matrices have optimizations for changing just the nonzeros vs changing the
nonzero structure.
Barry
>
> I'm a little unclear on all of the situations in which MatDuplicate gets
> used, however, so let me know if I'm misunderstanding something.
>
> Thanks,
> Richard