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

Barry Smith bsmith at mcs.anl.gov
Thu Apr 22 12:27:58 CDT 2010


On Apr 22, 2010, at 9:22 AM, Jed Brown wrote:

> 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).
>

    Do you mean if (!mat->ops->setoption) SETERRQ..... ?

    Or something else.

    I agree that it is impractical at this point to cache such values  
and better to generate the "useful error message"

    Barry


> Jed



More information about the petsc-users mailing list