Preallocating Matrix

Barry Smith bsmith at mcs.anl.gov
Mon Apr 27 13:14:53 CDT 2009


On Apr 27, 2009, at 1:08 PM, Andreas Grassl wrote:

> Satish Balay schrieb:
>> Not sure what you mean by "numbers of zero per row"
>
> I actually meant "number of nonzeros per row", but providing the  
> nnz[]-array to
> MatSeqAIJSetPreallocation brought only very little speed-up, by the  
> same factor
> as preallocating just with nz.

    It is almost 100% sure that you are NOT correctly providing enough  
size per row.
Run the code with -info (save the output in a file) and then send petsc-maint at mcs.anl.gov
  that file.

    Barry

>
>
> I suppose that I have to provide already the assembled sparse matrix  
> to the
> PETSc-routines instead of calculating it element by element, as long  
> as I don't
> distribute this calculation over many cpu's.
>
> cheers,
>
> ando
>
>>
>> Do you mean "number of zeros per row" or "column indices of zeros for
>> each row"?. Either way - you should be able to write a single loop
>> over this thingy - to compute the required nnz[]
>>
>> Satish
>>
>> On Thu, 23 Apr 2009, Andreas Grassl wrote:
>>
>>> Hello,
>>>
>>> I'm assembling large matrices giving just the numbers of zero per  
>>> row and
>>> wondering if it is possible to extract the nonzero-structure in  
>>> array-format it
>>> can be fed again into
>>>
>>> MatSeqAIJSetPreallocation(Mat B,PetscInt nz,const PetscInt nnz[])
>>>
>>> to detect the bottleneck?
>>>
>>> cheers
>>>
>>> ando
>>>
>
>
> -- 
> /"\                               Grassl Andreas
> \ /    ASCII Ribbon Campaign      Uni Innsbruck Institut f. Mathematik
>  X      against HTML email        Technikerstr. 13 Zi 709
> / \                               +43 (0)512 507 6091



More information about the petsc-users mailing list