[petsc-users] Newbie Question - Really slow - PetscMemCpy
Barry Smith
bsmith at mcs.anl.gov
Thu Apr 22 08:48:08 CDT 2010
On Apr 22, 2010, at 7:56 AM, Jed Brown wrote:
> 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
>
> MatSetOption(A,MAT_NEW_NONZERO_ALLOCATION_ERROR,PETSC_TRUE);
>
> 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?
Good suggestion. Now the question is do we put it in the "right"
place which is MatSetFromOptions(), but most people never call
MatSetFromOptions() so should we put in the "ideological wrong place"
MatCreate() since that means it will always be available?
Barry
>
>> 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
>>
>> MatCreateSeqBAIJ(PETSC_COMM_SELF,
>> 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.
>
> Jed
More information about the petsc-users
mailing list