[petsc-users] Newbie Question - Really slow - PetscMemCpy

Jed Brown jed at 59A2.org
Thu Apr 22 08:11:46 CDT 2010

On Thu, 22 Apr 2010 14:06:23 +0100, "Parker, Andrew (UK Filton)" <Andrew.Parker2 at baesystems.com> wrote:
> Ok,
> Cheers guys.  I did find that strange, that it was using AIJ, can I set
> that in the code rather from an options file, what is the code
> equivalent to -mat_type seqbaij, is it MatSetType or something like
> that?

  MatSetType(A,MATBAIJ), put it before MatSetFromOptions().

> Could my error actually be that the sparsity is correct, but as you
> note below, the matrix type allocated with MatSeqBAIJSetPreallocation
> is of type AIJ, and in which case, for that matrix it has not be
> preallocated with the correct sparsity, or at all, and hence the
> speed?

Yes, if you call MatSeqBAIJSetPreallocation() with a MATSEQAIJ, then you
have not preallocated anything.  (This is behavior that I would like to
change eventually since this call has enough information to preallocate
AIJ correctly.)


More information about the petsc-users mailing list