<!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">
    It works! Great, Matt.<br>
    <br>
    I guess there is no other way to know all these small issues but to
    get all possible errors? :)<br>
    <br>
    Jed, Matt, thank you a lot! <br>
    <br>
    On 07.03.2011 15:35, Matthew Knepley wrote:
    <blockquote
      cite="mid:AANLkTikRwEma8oSpS27Xz88QtET4e7YRQLNYojZykRfm@mail.gmail.com"
      type="cite">On Mon, Mar 7, 2011 at 8:04 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"> Jed, but why do I get
            in line 3003 in src/mat/impls/aij/seq/aij.c at all? As far
            as understand, if I don't pass nnz (NULL in C/C++ or
            PETSC_NULL in fortran) I have to avoid this loop in aij.c
            code. <br>
          </div>
        </blockquote>
        <div><br>
        </div>
        <div>This is the problem. Fortran does not allow this kind of
          flexible checking, so there are different kinds of "NULL"s.
          You</div>
        <div>need to pass PETSC_NULL_INTEGER for nnz.</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"> I don't have much
            experience with valgrind. Could you provide me with right
            parameters to run my code under valgrind?<br>
            Thanks a lot for your help.
            <div>
              <div class="h5"><br>
                <br>
                On 07.03.2011 14:59, Jed Brown wrote:
                <blockquote type="cite">
                  <p>Looks like a memory error. Best bet is to run in
                    Valgrind.</p>
                  <blockquote type="cite">On Mar 7, 2011 5:52 AM,
                    "Alexander Grayver" &lt;<a moz-do-not-send="true"
                      href="mailto:agrayver@gfz-potsdam.de"
                      target="_blank">agrayver@gfz-potsdam.de</a>&gt;
                    wrote:<br>
                    <br>
                    <div bgcolor="#ffffff" text="#000000"> Hi Jed,<br>
                      <br>
                      It's getting even stranger. <br>
                      <br>
                      When I run this code under linux I've got error:<br>
                      <br>
                      [0]PETSC ERROR: --------------------- Error
                      Message ------------------------------------<br>
                      [0]PETSC ERROR: Argument out of range!<br>
                      [0]PETSC ERROR: nnz cannot be greater than row
                      length: local row 98 value 1455203639 rowlength
                      343!<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>
                      [0]PETSC ERROR:
                      /home/mt/agrayver/mt-soft/multiem/INV3D/_tiger/em_model
                      on a openmpi-i named glic by agrayver Mon Mar&nbsp; 7
                      14:49:43 2011<br>
                      [0]PETSC ERROR: Libraries linked from
/panfs/panfs.gfz-hpcc.cluster/home/mt/agrayver/lib/petsc-3.1-p7/openmpi-intel-complex-debug/lib<br>
                      [0]PETSC ERROR: Configure run at Fri Mar&nbsp; 4
                      12:43:58 2011<br>
                      [0]PETSC ERROR: Configure options
                      --with-petsc-arch=openmpi-intel-complex-debug
                      --with-mpi-dir=/opt/mpi/intel/openmpi-1.4.2
                      --with-scalar-type=complex
                      --with-blas-lapack-dir=/opt/intel/Compiler/11.1/072/mkl/lib/em64t
                      --with-precision=double --with-x=0<br>
                      [0]PETSC ERROR:
                      ------------------------------------------------------------------------<br>
                      [0]PETSC ERROR: MatSeqAIJSetPreallocation_SeqAIJ()
                      line 3003 in src/mat/impls/aij/seq/aij.c<br>
                      [0]PETSC ERROR: MatCreateSeqAIJ() line 2906 in
                      src/mat/impls/aij/seq/aij.c<br>
                      <br>
                      <br>
                      Then I traced it under debugger both on Windows
                      and Linux and realized that it doesn't crash under
                      Windows only by luck. <br>
                      <br>
                      The call stack if the folowing:<br>
                      [C] MatSeqAIJSetPreallocation_SeqAIJ,
                      FP=7fffb4513880<br>
                      [C] MatCreateSeqAIJ,&nbsp;&nbsp;&nbsp;&nbsp; FP=7fffb4513900<br>
                      [C] matcreateseqaij_,&nbsp;&nbsp;&nbsp; FP=7fffb4513960<br>
                      [F90] MODELING_MOD`modeling, FP=7fffb4517740<br>
                      <br>
                      As far as I understand after debugging the problem
                      is that nnz in MatSeqAIJSetPreallocation isn't 0
                      and I go through this code:<br>
                      &nbsp;&nbsp; if (nnz) {<br>
                      &nbsp;&nbsp;&nbsp;&nbsp; for (i=0; i&lt;B-&gt;rmap-&gt;n; i++) {<br>
                      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (nnz[i] &lt; 0)
                      SETERRQ2(PETSC_ERR_ARG_OUTOFRANGE,"nnz cannot be
                      less than 0: local row %d value %d",i,nnz[i]);<br>
                      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (nnz[i] &gt; B-&gt;cmap-&gt;n)
                      SETERRQ3(PETSC_ERR_ARG_OUTOFRANGE,"nnz cannot be
                      greater than row length: local row %d value %d
                      rowlength %d",i,nnz[i],B-&gt;cmap-&gt;n);<br>
                      &nbsp;&nbsp;&nbsp;&nbsp; }<br>
                      &nbsp;&nbsp; }<br>
                      <br>
                      But why is nnz nonzero? I passed PETSC_NULL. It
                      seems like macros CHKFORTRANNULLINTEGER&nbsp; in
                      matcreateseqaij_ should set it to zero, but it
                      doesn't. <br>
                      <p><font color="#500050"><br>
                          Thanks. <br>
                          <br>
                          On 06.03.2011 16:49, Jed Brown wrote:</font></p>
                      <p><font color="#500050"><br>
                          &gt;<br>
                          &gt; On Sun, Mar 6, 2011 at 07:39, Alexander
                          Grayver &lt;<a moz-do-not-send="true"
                            href="mailto:agrayver@gfz-potsdam.de"
                            target="_blank">agrayver@gfz-potsdam.de</a>&gt;

                          wrote:<br>
                          &gt;&gt;<br>
                          &gt;&gt; Hello,<br>
                          &gt;...</font></p>
                    </div>
                  </blockquote>
                </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>