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

Jed Brown jed at 59A2.org
Thu Apr 22 07:56:21 CDT 2010

On Thu, 22 Apr 2010 13:33:42 +0100, "Parker, Andrew (UK Filton)" <Andrew.Parker2 at baesystems.com> wrote:
> I'm using Seq_BAIJ.  My bets are that I've got the sparsity wrong, or
> the preallocation wrong, but I'm not sure why.

You are almost certainly correct.  You can


to get the debugger to break on the first entry that you have not
preallocated.  Then you can trace the index back through the stack to
the application.

Barry et al, why isn't this available as a runtime option?

> I set up the matrix like this
>   MatCreate(PETSC_COMM_SELF,&_storage);
> MatSetSizes(_storage,PETSC_DECIDE,PETSC_DECIDE,numVars*numLocs,numVars*n
> umLocs);
>   MatSetFromOptions(_storage);
>   MatSeqBAIJSetPreallocation(_storage,numVars,PETSC_NULL,sparsityStart);
> However, using this makes zero difference to the speed
>       numVars,
>       numVars*numLocs,
>       numVars*numLocs,
>       0,  
>        sparsityStart,
>       &_storage);

These two calls do the same thing underneath, the former is more
flexible and takes options from the command line.

> It is so slow that it has not even completed one cycle of the solver....

That will change when the preallocation is fixed.


More information about the petsc-users mailing list