On Mon, Jun 27, 2011 at 9:54 AM, Alexander Grayver <span dir="ltr">&lt;<a 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<u></u>

  
    
  
  <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>  <a 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>  Thanks,</div><div><br></div><div>    Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;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  4 10:10:06 2011<br></div>
    [0]PETSC ERROR: Configure options --with-cc=&quot;win32fe cl&quot;
    --with-fc=&quot;win32fe ifort&quot; --with-cxx=&quot;win32fe cl&quot;
    --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]&quot;
    --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></div><div class="h5"><br>
    <br>
    On <a 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 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>   Matt</div>
        <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>
            [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  4 10:10:06 2011<br>
            [0]PETSC ERROR: Configure options --with-cc=&quot;win32fe cl&quot;
            --with-fc=&quot;win32fe ifor<br>
            t&quot; --with-cxx=&quot;win32fe cl&quot; --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=&quot;[/cygdrive/d/Dev<br>
            /HPC_2008_SDK/Lib/amd64/msmpi.lib,/cygdrive/d/Dev/HPC_2008_SDK/Lib/amd64/msmpife<br>
            c.lib]&quot; --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 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>   You should pass H as third argument to
                KSPSetOperators() as well as the second.<br>
                <br>
                  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&#39;m using matrix-free formulation and KSPLSQR to solve
                  normal equations system:<br>
                  <br>
                  (A&#39;*A)b = -g<br>
                  <br>
                  I managed to write all necessary code:<br>
                  <br>
                   call MatCreateShell(MPI_COMM_WORLD,m,N,N,N,PETSC_NULL_INTEGER,H,ierr)<br>
                   call MatShellSetOperation(H,MATOP_MULT,MFMatMult,ierr)<br>
                  <br>
                   call KSPCreate(MPI_COMM_WORLD,ksp,ierr);CHKERRQ(ierr)<br>
                   call KSPSetType(ksp,KSPLSQR,ierr);CHKERRQ(ierr)<br>
                   call KSPGetPC(ksp,pc,ierr);CHKERRQ(ierr)<br>
                   call PCSetType(pc,PCNONE,ierr);CHKERRQ(ierr)<br>
                   call KSPSetOperators(ksp,H,PETSC_NULL_OBJECT,SAME_PRECONDITIONER,ierr);CHKERRQ(ierr)<br>
                   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&#39;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  4 10:10:06
                2011<br>
                [0]PETSC ERROR: Configure options --with-cc=&quot;win32fe cl&quot;
                --with-fc=&quot;win32fe ifor<br>
                t&quot; --with-cxx=&quot;win32fe cl&quot; --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=&quot;[/cygdrive/d/Dev<br>
                /HPC_2008_SDK/Lib/amd64/msmpi.lib,/cygdrive/d/Dev/HPC_2008_SDK/Lib/amd64/msmpife<br>
                c.lib]&quot; --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>