[petsc-users] MatCreateMPIAIJWithSplitArrays for symmetric matrix?

Daniel Langr daniel.langr at gmail.com
Mon Nov 8 06:07:50 CST 2010


Dne 8.11.2010 12:45, Jed Brown napsal(a):
> On Mon, Nov 8, 2010 at 12:36, Daniel Langr <daniel.langr at gmail.com
> <mailto:daniel.langr at gmail.com>> wrote:
>
>     I am looking for several eigenvalues and eigenvectors with SLEPc.
>
>
> Presumably using methods that don't need a solve?

I don't use a linear solver, I use Lanczos or other iterative algorithm 
based on sparse matrix-vector multiplication.

>         Where does the sparsity of the matrix come from?
>
>
>     Lie algebra, Slater determinants, SU(3) groups, new bases... But I
>     don't understand all these things much, I just solve their
>     (physicist's) eigenproblems.
>
>
> This more likely explains what the entries are, but not what the
> sparsity is.  Sparse problems usually have some spatial locality (and/or
> locality in frequency or ensemble space).  It is usually much easier to
> find a reasonable upper bound for the sparsity than to figure out
> exactly what the entries are.  But I understand that this may be hard,
> such as if the support of the basis functions grew without bound due to
> some nonlinearity in the system.
>
>     I don't know the exact matrix structure, but I need some estimate
>     about the number of nonzeros, since the matrix needs to fit into a
>     memory. And I can simply use 85-90% of available memory for arrays,
>     and just left some space for vectors (but vectors are very small -
>     matrices are not much sparse). If I underestimate arrays' size, I
>     will abort a computation, cause I don't have any more memory.
>
>
> Why not use MatMPISBAIJSetPreallocation and MatSetOption
> MAT_NEW_NONZERO_ALLOCATION_ERR to abort if you have underestimated?  How
> would you do better than this yourself?

Ok, that's a good idea and I will try it. I can estimate total number of 
nonzeros (limited by the amount of memory), but I can hardly estimate 
number of nonzeros per particular rows (d_nnz, o_nnz). So I need to use 
d_nz and o_nz, right? And for symmetric matrix, what do d_nz and o_nz 
mean? Is it number of nonzeros for whole matrix row, or just upper 
triangular part? (I don't see this in manual page.)

(That was my point, through MatMPISBAIJSetPreallocation I need to 
estimate number of nonzeros per row. Not just number of nonzeros of 
whole local part. If I construct CSR arrays directly, I don't need this 
row-estimates.)

Daniel

> Jed



More information about the petsc-users mailing list