[petsc-dev] MatCreateTranspose semantics

Jeff Hammond jeff.science at gmail.com
Mon Jun 1 19:58:30 CDT 2020


Jeff dumb.  Make copy paste error.  Sorry.

Jeff

On Mon, Jun 1, 2020 at 5:02 PM Jeff Hammond <jeff.science at gmail.com> wrote:

> I'm still unable to get a basic matrix transpose working.  I may be
> stupid, but I cannot figure out why the object is in the wrong state, no
> matter what I do.
>
> This is the full code:
>
>
> https://github.com/jeffhammond/PRK/commit/617973dfbe07d64cc2c0418a1702c418d51802c5
>
> jrhammon at jrhammon-nuc:~/PRK/C1z$ make petsc && ./transpose-petsc -i 10 -n
> 100
> make: Nothing to be done for 'petsc'.
> Parallel Research Kernels version 2020
> C11/PETSc Transpose: B += A^T
> Number of processes  = 1
> Number of iterations = 10
> Matrix order         = 100
> [0]PETSC ERROR: --------------------- Error Message
> --------------------------------------------------------------
> [0]PETSC ERROR: Object is in wrong state
> [0]PETSC ERROR: Not for unassembled matrix
> [0]PETSC ERROR: See https://www.mcs.anl.gov/petsc/documentation/faq.html
> for trouble shooting.
> [0]PETSC ERROR: Petsc Release Version 3.13.1, unknown
> [0]PETSC ERROR: ./transpose-petsc on a  named jrhammon-nuc by jrhammon Mon
> Jun  1 17:01:05 2020
> [0]PETSC ERROR: Configure options --prefix=/home/jrhammon/PRK/deps/petsc
> --with-blaslapack-dir=/opt/intel/inteloneapi/mkl/2021.1-beta06
> --with-mpi-dir=/opt/intel/inteloneapi/mpi/2021.1-beta06 --with-cxx=0
> --with-fc=0
> [0]PETSC ERROR: #1 MatTranspose() line 4878 in
> /home/jrhammon/PRK/deps/petsc-src/src/mat/interface/matrix.c
> [0]PETSC ERROR: #2 main() line 169 in transpose-petsc.c
> [0]PETSC ERROR: PETSc Option Table entries:
> [0]PETSC ERROR: -i 10
> [0]PETSC ERROR: -n 100
> [0]PETSC ERROR: ----------------End of Error Message -------send entire
> error message to petsc-maint at mcs.anl.gov----------
> Abort(169073) on node 0 (rank 0 in comm 16): application called
> MPI_Abort(MPI_COMM_SELF, 169073) - process 0
>
> Jeff
>
> On Mon, Jun 1, 2020 at 4:11 PM Jed Brown <jed at jedbrown.org> wrote:
>
>> I would just use MatTranspose here.  We've had limited demand for more
>> sophisticated operations on objects of type MATTRANSPOSE and there
>> probably isn't much benefit in fusing the parallel version here anyway.
>>
>> Jeff Hammond <jeff.science at gmail.com> writes:
>>
>> > I am trying to understand how to use a transposed matrix view along the
>> > lines of Numpy (
>> >
>> https://github.com/ParRes/Kernels/blob/master/PYTHON/transpose-numpy.py#L99
>> > ).
>> >
>> >
>> https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateTranspose.html
>> > says
>> >
>> > "Creates a new matrix object that behaves like A'"
>> >
>> > But later it seems to suggest that this is only true when performance a
>> > matrix-vector product:
>> >
>> > "Rather the new matrix object performs the matrix-vector product by
>> using
>> > the MatMultTranspose() on the original matrix"
>> >
>> > I got the idea to use this view concept from
>> >
>> https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatTranspose.html
>> ,
>> > which says:
>> >
>> > "Consider using MatCreateTranspose() instead if you only need a matrix
>> that
>> > behaves like the transpose, but don't need the storage to be changed."
>> >
>> > When I try to use the transpose view in MatAXPY using this code:
>> >     Mat AT;
>> >     ierr = MatCreateTranspose(A, &AT); // create transpose view of A
>> >     ierr = MatAXPY(B, one, AT, SAME_NONZERO_PATTERN);
>> >
>> > I get an error suggesting that I am doing something bad:
>> >
>> > [0]PETSC ERROR: --------------------- Error Message
>> > --------------------------------------------------------------
>> > [0]PETSC ERROR: Object is in wrong state
>> > [0]PETSC ERROR: Not for unassembled matrix (Y)
>> > [0]PETSC ERROR: See
>> https://www.mcs.anl.gov/petsc/documentation/faq.html
>> > for trouble shooting.
>> > [0]PETSC ERROR: Petsc Release Version 3.13.1, unknown
>> > [0]PETSC ERROR: ./transpose-petsc on a  named jrhammon-nuc by jrhammon
>> Mon
>> > Jun  1 15:38:20 2020
>> > [0]PETSC ERROR: Configure options --prefix=/home/jrhammon/PRK/deps/petsc
>> > --with-blaslapack-dir=/opt/intel/inteloneapi/mkl/2021.1-beta06
>> > --with-mpi-dir=/opt/intel/inteloneapi/mpi/2021.1-beta06 --with-cxx=0
>> > --with-fc=0
>> > [0]PETSC ERROR: #1 MatAXPY() line 74 in
>> > /home/jrhammon/PRK/deps/petsc-src/src/mat/utils/axpy.c
>> > [0]PETSC ERROR: #2 main() line 170 in transpose-petsc.c
>> > [0]PETSC ERROR: PETSc Option Table entries:
>> > [0]PETSC ERROR: -i 10
>> > [0]PETSC ERROR: -n 100
>> > [0]PETSC ERROR: ----------------End of Error Message -------send entire
>> > error message to petsc-maint at mcs.anl.gov----------
>> >
>> > What do I need to do to use a transpose view properly outside of M*V?
>> >
>> > Thanks,
>> >
>> > Jeff
>> >
>> > --
>> > Jeff Hammond
>> > jeff.science at gmail.com
>> > http://jeffhammond.github.io/
>>
>
>
> --
> Jeff Hammond
> jeff.science at gmail.com
> http://jeffhammond.github.io/
>


-- 
Jeff Hammond
jeff.science at gmail.com
http://jeffhammond.github.io/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20200601/8b7a5bde/attachment.html>


More information about the petsc-dev mailing list