[petsc-users] Will using SBAIJ to solve for all eigenvalues and eigenvectors of a symmetric sparse matrix produced one row at a time be beneficial ?
Matthew Knepley
knepley at gmail.com
Sat Jul 30 11:26:55 CDT 2011
On Sat, Jul 30, 2011 at 11:11 AM, Shitij Bhargava <shitij.cse at gmail.com>wrote:
> Hi !!
>
> I have just started using SLEPc/PETSc.
>
> The problem that I am trying to solve is that I have some routines
> calculating one row at a time of a matrix, which I want to insert in some
> sparse matrix representation, and then find the next row, insert it, and so
> on. (This is being done to avoid the need to have one big NxN matrix in
> memory).The matrix is also symmetric, so the row that the subroutines
> produce is such that any non-zero element can be present only in that part
> of the row corresponding to the upper triangle of the matrix. (all others
> are zero). After I have the matrix in sparse format, I want to find all the
> eigenvalues and eigenvectors.
>
> Till now I have been using the SeqAij matrix and MatSetValues method with
> preallocation set appropriately, but I am not satisfied with its performance
> (the way I am doing it). When one row is produced, I insert it into the AIJ
> matrix, so there are total of N calls to MatSetValues. Also even though the
> matrix is symmetric, i have to enter the full matrix, as otherwise the
> eigensolver doesnt seem to produce the right answer (Why ? I set the problem
> type to EPS_HEP, but still it requires me to store the full matrix ? It is
> written in documentation that problem type should always be specified so
> that the eigensolver can take advantage of it (symmetry in this case), but
> considering that I still have to store the full matrix, it meant 'advantage'
> only in time, not memory ?....when I set the problem type to EPS_HEP, it
> means that it will take only the upper or lower triangle right ? why should
> it require both ? Is this because the matrix type is not symmetric, unlike
> SBAIJ ?)
>
You must set the type to SBAIJ in order to enter only the symmetric part.
> So, if I use SBAIJ and say, enter some bs rows at a time into the SBAIJ
> matrix, will it be faster ? Also, in that case would I still have to enter
> both upper and lower triangle or only one (I hope only one, otherwise the
> 'S' doesnt make sense to me, but in that case, which one ? The eigensolver
> doesnt give me an option to specify if the upper or lower triangle is stored
> in the matrix in case the problem type is EPS_HEP). Will the eigensolver
> produce the right answers in this case ? (say, storing only upper triangle
> in SBAIJ, instead of both)
>
I do not think it will be noticeably faster. Value entry is usually not a
large part of the time. YOu can check this using -log_summary.
http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MATSEQSBAIJ.html#MATSEQSBAIJ
show that only the upper triangle is stored.
> Otherwise, while using AIJ, if I insert multiple rows at a time instead of
> just one (thus reducing the number of calls to MatSetValues, at the cost of
> more memory), will this be much beneficial ? (Please note that the matrix is
> not very sparse)
>
I cannot say anything until we see the timing from -log_summary. It is very
rare that matrix construction is a factor,
if it has been properly allocated, which you can check using -info.
Matt
> Thank you very much in advance !!!
>
>
> Shitij
>
--
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110730/988b89f5/attachment.htm>
More information about the petsc-users
mailing list