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