<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Actually, I tried, but haven't managed to do this in fortran:<br>
    <br>
    test.exe -log_summary -ksp_view<br>
    [0]PETSC ERROR: MatShellSetOperation_Fortran() line 107 in
src/mat/impls/shell/ftn-custom/D:\dev\PETSC-~3.1-P\src\mat\impls\shell\FTN-CU~1\zshellf.c<br>
    <br>
    job aborted:<br>
    [ranks] message<br>
    <br>
    [0] application aborted<br>
    aborting MPI_COMM_WORLD, error 1, comm rank 0<br>
    <br>
    It seems that MATOP_NORM is not supported from Fortran. Why is that
    so?<br>
    <br>
    Regards,<br>
    Alexander<br>
    <br>
    On 27.06.2011 17:12, Matthew Knepley wrote:
    <blockquote
      cite="mid:BANLkTino8J9atf5aZ7Gn3AKKZ4FV7Ont6A@mail.gmail.com"
      type="cite">On Mon, Jun 27, 2011 at 9:54 AM, Alexander Grayver <span
        dir="ltr">&lt;<a moz-do-not-send="true"
          href="mailto:agrayver@gfz-potsdam.de">agrayver@gfz-potsdam.de</a>&gt;</span>
      wrote:<br>
      <div class="gmail_quote">
        <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
          0.8ex; border-left: 1px solid rgb(204, 204, 204);
          padding-left: 1ex;">
          <div bgcolor="#ffffff" text="#000000">
            <div class="im">
              <div>&gt;&gt; Please send the entire error message (this
                is missing the stack), but I am guessing you</div>
              <div>&gt;&gt; are not changed the default preconditioner
                (ILU) which cannot act on a shell matrix. Use</div>
              <div>&gt;&gt; -ksp_view to see what solver is begin used.</div>
              <br>
            </div>
            The full error message:<br>
            <br>
            test.exe -log_summary -ksp_view</div>
        </blockquote>
        <div><br>
        </div>
        <div>The LSQR solver uses the Frobenius norm of the matrix. In
          order to use a MATSHELL, you</div>
        <div>must implement MatNorm using</div>
        <div><br>
        </div>
        <div>&nbsp;&nbsp;<a moz-do-not-send="true"
href="http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-dev/docs/manualpages/Mat/MatShellSetOperation.html">http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-dev/docs/manualpages/Mat/MatShellSetOperation.html</a></div>
        <div><br>
        </div>
        <div>&nbsp; Thanks,</div>
        <div><br>
        </div>
        <div>&nbsp; &nbsp; Matt</div>
        <div>&nbsp;</div>
        <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
          0.8ex; border-left: 1px solid rgb(204, 204, 204);
          padding-left: 1ex;">
          <div bgcolor="#ffffff" text="#000000">
            <div class="im"> <br>
              [0]PETSC ERROR: --------------------- Error Message
              ------------------------------------<br>
              [0]PETSC ERROR: No support for this operation for this
              object type!<br>
              [0]PETSC ERROR: Mat type shell!<br>
              [0]PETSC ERROR:
              ------------------------------------------------------------------------<br>
              [0]PETSC ERROR: Petsc Release Version 3.1.0, Patch 7, Mon
              Dec 20 14:26:37 CST 2010<br>
              [0]PETSC ERROR: See docs/changes/index.html for recent
              updates.<br>
              [0]PETSC ERROR: See docs/faq.html for hints about trouble
              shooting.<br>
              [0]PETSC ERROR: See docs/index.html for manual pages.<br>
              [0]PETSC ERROR:
              ------------------------------------------------------------------------<br>
            </div>
            [0]PETSC ERROR: test.exe on a cygwin-cx named M0. by Unknown
            Mon Jun 27 16:51:32 2011<br>
            [0]PETSC ERROR: Libraries linked from
            /cygdrive/d/dev/petsc-3.1-p7/cygwin-cxx-debug/lib
            <div class="im"><br>
              [0]PETSC ERROR: Configure run at Fri Mar&nbsp; 4 10:10:06 2011<br>
            </div>
            [0]PETSC ERROR: Configure options --with-cc="win32fe cl"
            --with-fc="win32fe ifort" --with-cxx="win32fe cl"
            --with-windows-graphics=0<br>
            --with-precision=double --with-scalar-type=complex
            --with-clanguage=cxx
            --with-mpi-include=/cygdrive/d/Dev/HPC_2008_SDK/Include --wi<br>
            /HPC_2008_SDK/Lib/amd64/msmpi.lib,/cygdrive/d/Dev/HPC_2008_SDK/Lib/amd64/msmpifec.lib]"

            --useThreads=0 --useThreads=0
            <div class="im"><br>
              [0]PETSC ERROR:
              ------------------------------------------------------------------------<br>
              [0]PETSC ERROR: MatNorm() line 4512 in
              src/mat/interface/D:\dev\PETSC-~3.1-P\src\mat\INTERF~1\matrix.c<br>
            </div>
            <div class="im"> [0]PETSC ERROR: KSPSolve_LSQR() line 90 in
src/ksp/ksp/impls/lsqr/D:\dev\PETSC-~3.1-P\src\ksp\ksp\impls\lsqr\lsqr.c<br>
            </div>
            [0]PETSC ERROR: KSPSolve() line 396 in
            src/ksp/ksp/interface/D:\dev\PETSC-~3.1-P\src\ksp\ksp\INTERF~1\itfunc.c<br>
            <br>
            job aborted:<br>
            [ranks] message<br>
            <br>
            [0] application aborted<br>
            aborting MPI_COMM_WORLD, error 56, comm rank 0
            <div>
              <div class="h5"><br>
                <br>
                On <a moz-do-not-send="true" href="tel:27.06.2011%2016"
                  value="+12706201116" target="_blank">27.06.2011 16</a>:47,
                Matthew Knepley wrote:
                <blockquote type="cite">On Mon, Jun 27, 2011 at 9:34 AM,
                  Alexander Grayver <span dir="ltr">&lt;<a
                      moz-do-not-send="true"
                      href="mailto:agrayver@gfz-potsdam.de"
                      target="_blank">agrayver@gfz-potsdam.de</a>&gt;</span>
                  wrote:<br>
                  <div class="gmail_quote">
                    <blockquote class="gmail_quote" style="margin: 0pt
                      0pt 0pt 0.8ex; border-left: 1px solid rgb(204,
                      204, 204); padding-left: 1ex;"> Thanks Barry,<br>
                      <br>
                      Now I get this:</blockquote>
                    <div><br>
                    </div>
                    <div>Please send the entire error message (this is
                      missing the stack), but I am guessing you</div>
                    <div>are not changed the default preconditioner
                      (ILU) which cannot act on a shell matrix. Use</div>
                    <div>-ksp_view to see what solver is begin used.</div>
                    <div><br>
                    </div>
                    <div>&nbsp; &nbsp;Matt</div>
                    <div>&nbsp;</div>
                    <blockquote class="gmail_quote" style="margin: 0pt
                      0pt 0pt 0.8ex; border-left: 1px solid rgb(204,
                      204, 204); padding-left: 1ex;">
                      <div> [0]PETSC ERROR: --------------------- Error
                        Message ----------------------------<br>
                        --------<br>
                      </div>
                      [0]PETSC ERROR: No support for this operation for
                      this object type!<br>
                      [0]PETSC ERROR: Mat type shell!
                      <div><br>
                        [0]PETSC ERROR:
                        ----------------------------------------------------------------<br>
                        --------<br>
                        [0]PETSC ERROR: Petsc Release Version 3.1.0,
                        Patch 7, Mon Dec 20 14:26:37 CST 20<br>
                        10<br>
                        [0]PETSC ERROR: See docs/changes/index.html for
                        recent updates.<br>
                        [0]PETSC ERROR: See docs/faq.html for hints
                        about trouble shooting.<br>
                        [0]PETSC ERROR: See docs/index.html for manual
                        pages.<br>
                        [0]PETSC ERROR:
                        ----------------------------------------------------------------<br>
                        --------<br>
                      </div>
                      [0]PETSC ERROR: test.exe on a cygwin<br>
                      -cx named MT0. by Unknown Mon Jun 27 16:30:42 2011
                      <div><br>
                        [0]PETSC ERROR: Libraries linked from
                        /cygdrive/d/dev/petsc-3.1-p7/cygwin-cxx-de<br>
                        bug/lib<br>
                        [0]PETSC ERROR: Configure run at Fri Mar &nbsp;4
                        10:10:06 2011<br>
                        [0]PETSC ERROR: Configure options
                        --with-cc="win32fe cl" --with-fc="win32fe ifor<br>
                        t" --with-cxx="win32fe cl"
                        --with-windows-graphics=0
                        --download-f-blas-lapack=1<br>
                        --with-precision=double
                        --with-scalar-type=complex --with-clanguage=cxx
                        --with-m<br>
                        pi-include=/cygdrive/d/Dev/HPC_2008_SDK/Include
                        --with-mpi-lib="[/cygdrive/d/Dev<br>
/HPC_2008_SDK/Lib/amd64/msmpi.lib,/cygdrive/d/Dev/HPC_2008_SDK/Lib/amd64/msmpife<br>
                        c.lib]" --useThreads=0 --useThreads=0<br>
                        [0]PETSC ERROR:
                        ----------------------------------------------------------------<br>
                        --------<br>
                      </div>
                      [0]PETSC ERROR: MatNorm() line 4512 in
                      src/mat/interface/D:\dev\PETSC-3.1-P\src\mat\INTERF~1\matrix.c
                      <div>
                        <div><br>
                          <br>
                          On <a moz-do-not-send="true"
                            href="tel:27.06.2011%2016"
                            value="+12706201116" target="_blank">27.06.2011
                            16</a>:32, Barry Smith wrote:<br>
                        </div>
                      </div>
                      <blockquote class="gmail_quote" style="margin: 0pt
                        0pt 0pt 0.8ex; border-left: 1px solid rgb(204,
                        204, 204); padding-left: 1ex;">
                        <div>
                          <div> &nbsp; You should pass H as third argument to
                            KSPSetOperators() as well as the second.<br>
                            <br>
                            &nbsp; Barry<br>
                            <br>
                            On Jun 27, 2011, at 9:23 AM, Alexander
                            Grayver wrote:<br>
                            <br>
                          </div>
                        </div>
                        <blockquote class="gmail_quote" style="margin:
                          0pt 0pt 0pt 0.8ex; border-left: 1px solid
                          rgb(204, 204, 204); padding-left: 1ex;">
                          <div>
                            <div> Hello!<br>
                              <br>
                              I'm using matrix-free formulation and
                              KSPLSQR to solve normal equations system:<br>
                              <br>
                              (A'*A)b = -g<br>
                              <br>
                              I managed to write all necessary code:<br>
                              <br>
                              &nbsp;call
                              MatCreateShell(MPI_COMM_WORLD,m,N,N,N,PETSC_NULL_INTEGER,H,ierr)<br>
                              &nbsp;call
                              MatShellSetOperation(H,MATOP_MULT,MFMatMult,ierr)<br>
                              <br>
                              &nbsp;call
                              KSPCreate(MPI_COMM_WORLD,ksp,ierr);CHKERRQ(ierr)<br>
                              &nbsp;call
                              KSPSetType(ksp,KSPLSQR,ierr);CHKERRQ(ierr)<br>
                              &nbsp;call KSPGetPC(ksp,pc,ierr);CHKERRQ(ierr)<br>
                              &nbsp;call
                              PCSetType(pc,PCNONE,ierr);CHKERRQ(ierr)<br>
                              &nbsp;call
KSPSetOperators(ksp,H,PETSC_NULL_OBJECT,SAME_PRECONDITIONER,ierr);CHKERRQ(ierr)<br>
                              &nbsp;call KSPSolve(ksp,g,b,ierr);CHKERRQ(ierr)<br>
                              <br>
                              <br>
                              but fail in KSPSolve stage with that:<br>
                              [0]PETSC ERROR: ---------------------
                              Error Message ----------------------------<br>
                              --------<br>
                              [0]PETSC ERROR: Object is in wrong state!<br>
                              [0]PETSC ERROR: Mat object's type is not
                              set: Argument # 1!<br>
                              [0]PETSC ERROR:
                              ----------------------------------------------------------------<br>
                              --------<br>
                              [0]PETSC ERROR: Petsc Release Version
                              3.1.0, Patch 7, Mon Dec 20 14:26:37 CST 20<br>
                              10<br>
                              [0]PETSC ERROR: See
                              docs/changes/index.html for recent
                              updates.<br>
                              [0]PETSC ERROR: See docs/faq.html for
                              hints about trouble shooting.<br>
                              [0]PETSC ERROR: See docs/index.html for
                              manual pages.<br>
                              [0]PETSC ERROR:
                              ----------------------------------------------------------------<br>
                              --------<br>
                            </div>
                          </div>
                          [0]PETSC ERROR: test.exe on a cygwin
                          <div><br>
                            -cx named MT0. by Unknown Mon Jun 27
                            16:18:43 2011<br>
                            [0]PETSC ERROR: Libraries linked from
                            /cygdrive/d/dev/petsc-3.1-p7/cygwin-cxx-de<br>
                            bug/lib<br>
                            [0]PETSC ERROR: Configure run at Fri Mar &nbsp;4
                            10:10:06 2011<br>
                            [0]PETSC ERROR: Configure options
                            --with-cc="win32fe cl" --with-fc="win32fe
                            ifor<br>
                            t" --with-cxx="win32fe cl"
                            --with-windows-graphics=0
                            --download-f-blas-lapack=1<br>
                            --with-precision=double
                            --with-scalar-type=complex
                            --with-clanguage=cxx --with-m<br>
                            pi-include=/cygdrive/d/Dev/HPC_2008_SDK/Include

                            --with-mpi-lib="[/cygdrive/d/Dev<br>
/HPC_2008_SDK/Lib/amd64/msmpi.lib,/cygdrive/d/Dev/HPC_2008_SDK/Lib/amd64/msmpife<br>
                            c.lib]" --useThreads=0 --useThreads=0<br>
                            [0]PETSC ERROR:
                            ----------------------------------------------------------------<br>
                            --------<br>
                            [0]PETSC ERROR: MatNorm() line 4507 in
                            src/mat/interface/D:\dev\PETSC-3.1-P\src\mat\INTERF~1\matrix.c<br>
                            [0]PETSC ERROR: KSPSolve_LSQR() line 90 in
                            src/ksp/ksp/impls/lsqr/D:\dev\PETSC-3.1-P\src\ksp\ksp\impls\lsqr\lsqr.c<br>
                            <br>
                            Any suggestions? Do I have to set MATOP_NORM
                            operation? Then how?<br>
                            <br>
                            Regards,<br>
                            Alexander<br>
                          </div>
                        </blockquote>
                      </blockquote>
                      <br>
                    </blockquote>
                  </div>
                  <br>
                  <br clear="all">
                  <br>
                  -- <br>
                  What most experimenters take for granted before they
                  begin their experiments is infinitely more interesting
                  than any results to which their experiments lead.<br>
                  -- Norbert Wiener<br>
                </blockquote>
                <br>
              </div>
            </div>
          </div>
        </blockquote>
      </div>
      <br>
      <br clear="all">
      <br>
      -- <br>
      What most experimenters take for granted before they begin their
      experiments is infinitely more interesting than any results to
      which their experiments lead.<br>
      -- Norbert Wiener<br>
    </blockquote>
    <br>
  </body>
</html>