[petsc-users] Newbie Question - Really slow - PetscMemCpy
Jed Brown
jed at 59A2.org
Thu Apr 22 09:22:41 CDT 2010
On Thu, 22 Apr 2010 15:15:12 +0100, "Parker, Andrew (UK Filton)" <Andrew.Parker2 at baesystems.com> wrote:
> Well that's a worry, no error from:
> MatSetOption(_storage,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_TRUE);
>
> Still slow as hell, same behaviour as before. I'm now using:
>
> MatCreate(PETSC_COMM_SELF,&_storage);
> MatSetType(_storage, MATSEQBAIJ);
> MatSetOption(_storage,MAT_NEW_NONZERO_ALLOCATION_ERR,PETSC_TRUE);
>
> MatSetSizes(_storage,PETSC_DECIDE,PETSC_DECIDE,numVars*numLocs,numVars*n
> umLocs);
> MatSetFromOptions(_storage);
> MatSeqBAIJSetPreallocation(_storage,numVars,PETSC_NULL,sparsityStart);
This should work if you call both MatSetSizes and MatSetType before
MatSetOption. There are technical reasons for this, mostly that it's
difficult to cache all the options and get them handled in a consistent
and debuggable manner once the implementation is chosen.
Unless someone disagrees, I'll make it an error to call MatSetOptions()
before the implementation is available (so you would get a useful error
with the usage above, instead of the option just being ignored).
Jed
More information about the petsc-users
mailing list