MatTranspose Question

Hong Zhang hzhang at mcs.anl.gov
Mon Jul 14 16:08:49 CDT 2008


Sarah,

You can use runtime option '-log_summary' to find
out which function calls dominate execution time.

For Large matrices, MatTranspose() is very expensive.
PETSc stores mpiaij format in row blocks.
Transposing it requires inserting matrix columns one by one and
redistributing the matrix entries among processors,
which should be avoied whenever possible.
You may peek into our implementation
MatTranspose_MPIAIJ() in src/mat/impls/aij/mpi/mpiaij.c.

If you know the processor distribution and matrix entries,
you may create Atranspose and call MatSetValues()
for inserting local rows of Atranspose directly.
In this way, the expensive processor communications can be avoided.

Good luck,

Hong

On Mon, 14 Jul 2008, Toby D. Young wrote:

>
> Hej Sarah,
>
>> The first thing I did was to run my code to check for correctness on
>> a matrix of size 202x200.  It  gave me, what looked to be, the
>> singular values i was expecting on that matrix.
>
> Ok, looks like good news - nothing is seriously wrong. So we can guess you
> are looking at a matrix "size-problem"(?)
>
>>  But at some point I think I will have to solve this
>> specific problem.
>
> Sure.   :-)
>
>> Theoretically I might be able to work around this problem by creating
>> the transpose of my matrix when I read in my original matrix from
>> several files.
>
> You may have misunderstood me. I meant, as a work around, can you recast
> your equations in a way that avoids performing the transpose of a matrix?
> Sometimes this is possible and is almost always desirable. Note: Are you
> able to use the "inline matrix transpose" rather than by creating a new
> matrix? If this is possible it will definately save you some time.
>
>> However, I am wondering if there is something I'm doing that is
>> really wrong in some way.
>
> I don't suppose you are doing anything particuarily wrong... I can
> not guess without first seeing your particular problem and code first.
>
> best,
> 	Toby
>
>
> -----
>
> Toby D. Young - Adiunkt (Assistant Professor)
> Department of Computational Science
> Institute of Fundamental Technological Research
> Polish Academy of Sciences
> Room 206, ul. Swietokrzyska 21
> 00-049 Warszawa, Polska
>
> +48 22 826 12 81 ext. 184
> http://rav.ippt.gov.pl/~tyoung
>
>




More information about the petsc-users mailing list