[petsc-dev] MatTransposeMatMult

Hong hzhang at mcs.anl.gov
Thu Sep 21 10:43:50 CDT 2017


Jed,
I reproduced what you observed.
30x time is spent on numerical C = At*B.
We compute A^T*B using outer product C=(A^T)[:,i]*B[i,:].
For your large matrix A: rows=574902, cols=184446,
outer product takes long long time to insert values to C.

We may use At=A^T and C=At*B instead.

Hong

On Thu, Sep 21, 2017 at 9:59 AM, Hong <hzhang at mcs.anl.gov> wrote:

> Jed :
>
>> ~jedbrown/ceres_solver_iteration_001_A.petsc on mcs.anl.gov.
>>
> I got this file. How many  matrices in this file? How to load them?
> It seems the first matrix is rectangular.
>
> Hong
>
>>
>> The issue is that MatTransposeMatMult is implemented using sparse outer
>> products which is quite inefficient compared to the standard MatMatMult
>> algorithm.
>>
>> Barry Smith <bsmith at mcs.anl.gov> writes:
>>
>> >   Send the runable case so that we can determine the cause of the slow
>> down and find possible cures. It could be that the "optimized" version was
>> optimized for a particular size of problems or matrix structure.
>> >
>> >    Barry
>> >
>> >> On Sep 20, 2017, at 4:32 PM, Jed Brown <jed at jedbrown.org> wrote:
>> >>
>> >> I have a simple SeqAIJ example where MatTransposeMatMult is 30x slower
>> >> than MatTranspose followed by MatMatMult.  This is embarrassing when
>> >> people try to compare performance.  Are there any cases where these
>> >> custom implementations provide value rather than just confusing people
>> >> or turning them away from PETSc?
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20170921/cb38359c/attachment.html>


More information about the petsc-dev mailing list