<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>I have managed to simplify my example program, and removed the
dependencies on slepc and gsl (attached). <br>
</p>
<p>The program defines a 800x800 matrix with 3 non-zero entries per
row, which are all set to 1.0.</p>
<p>When I run the program on 1 processor, everything works
correctly. When I run it on 2+ processors, I get the following
error:</p>
<p>-----</p>
<p>first = 400 last = 800 <br>
[1]PETSC ERROR: --------------------- Error Message
-------------------------------------------------------------- <br>
[1]PETSC ERROR: Argument out of range <br>
[1]PETSC ERROR: New nonzero at (0,399) caused a malloc <br>
Use MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE)
to turn off this check <br>
[1]PETSC ERROR: See <a class="moz-txt-link-freetext" href="https://petsc.org/release/faq/">https://petsc.org/release/faq/</a> for trouble
shooting. <br>
[1]PETSC ERROR: Petsc Release Version 3.17.4, unknown <br>
[1]PETSC ERROR: Configure options --download-make --download-mpich
--download-scalapack --download-cmake --download-mumps <br>
[1]PETSC ERROR: #1 MatSetValues_MPIAIJ() at
/data/palken/petsc/src/mat/impls/aij/mpi/mpiaij.c:506 <br>
[1]PETSC ERROR: #2 MatSetValues() at
/data/palken/petsc/src/mat/interface/matrix.c:1343 <br>
first = 0 last = 400 <br>
[0]PETSC ERROR: --------------------- Error Message
-------------------------------------------------------------- <br>
[0]PETSC ERROR: Argument out of range <br>
[0]PETSC ERROR: New nonzero at (399,400) caused a malloc <br>
Use MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR, PETSC_FALSE)
to turn off this check <br>
[0]PETSC ERROR: See <a class="moz-txt-link-freetext" href="https://petsc.org/release/faq/">https://petsc.org/release/faq/</a> for trouble
shooting. <br>
[0]PETSC ERROR: Petsc Release Version 3.17.4, unknown <br>
[0]PETSC ERROR: Configure options --download-make --download-mpich
--download-scalapack --download-cmake --download-mumps <br>
[0]PETSC ERROR: #1 MatSetValues_MPIAIJ() at
/data/palken/petsc/src/mat/impls/aij/mpi/mpiaij.c:506 <br>
[0]PETSC ERROR: #2 MatSetValues() at
/data/palken/petsc/src/mat/interface/matrix.c:1343<br>
</p>
<p>-----</p>
<p>As far as I understand, processor 1 will have rows 1-400, while
processor 2 will have rows 401-800. From my reading of the
documentation, each processor will have all columns (1-800) for
their block of rows. So I am at a loss to understand why the
program is generating these errors. Any help is appreciated.</p>
<p>Patrick<br>
</p>
<div class="moz-cite-prefix">On 8/15/22 04:29, Mark Adams wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CADOhEh5PQ=G+xkkP9k11sHU7QQYWJhgMXkT4zvXM7u5-Oo7UKQ@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">You might need to fix this:
<div><br>
</div>
<div>
<pre class="gmail-aLF-aPX-K0-aPE" style="font-family:"Courier New",Courier,monospace,arial,sans-serif;margin-top:0px;margin-bottom:0px;white-space:pre-wrap;color:rgb(0,0,0);font-size:14px">if (i - j < m)</pre>
<pre class="gmail-aLF-aPX-K0-aPE" style="font-family:"Courier New",Courier,monospace,arial,sans-serif;margin-top:0px;margin-bottom:0px;white-space:pre-wrap;color:rgb(0,0,0);font-size:14px">
</pre>
<pre class="gmail-aLF-aPX-K0-aPE" style="font-family:"Courier New",Courier,monospace,arial,sans-serif;margin-top:0px;margin-bottom:0px;white-space:pre-wrap;color:rgb(0,0,0);font-size:14px">to </pre>
<pre class="gmail-aLF-aPX-K0-aPE" style="font-family:"Courier New",Courier,monospace,arial,sans-serif;margin-top:0px;margin-bottom:0px;white-space:pre-wrap;color:rgb(0,0,0);font-size:14px">
</pre>
<pre class="gmail-aLF-aPX-K0-aPE" style="font-family:"Courier New",Courier,monospace,arial,sans-serif;margin-top:0px;margin-bottom:0px;white-space:pre-wrap;color:rgb(0,0,0);font-size:14px"><pre class="gmail-aLF-aPX-K0-aPE" style="font-family:"Courier New",Courier,monospace,arial,sans-serif;margin-top:0px;margin-bottom:0px;white-space:pre-wrap">if (i - j < m && i - j >= 0)</pre><pre class="gmail-aLF-aPX-K0-aPE" style="font-family:"Courier New",Courier,monospace,arial,sans-serif;margin-top:0px;margin-bottom:0px;white-space:pre-wrap">
</pre><pre class="gmail-aLF-aPX-K0-aPE" style="font-family:"Courier New",Courier,monospace,arial,sans-serif;margin-top:0px;margin-bottom:0px;white-space:pre-wrap">Mark</pre></pre>
</div>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Mon, Aug 15, 2022 at 12:12
AM Patrick Alken <<a
href="mailto:patrick.alken@geomag.info"
moz-do-not-send="true" class="moz-txt-link-freetext">patrick.alken@geomag.info</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
am trying to assemble a matrix in parallel in Petsc, and it is
working <br>
for 1 processor, but when I try running it with 2 processors I
get <br>
errors like the following:<br>
<br>
----<br>
<br>
[1]PETSC ERROR: --------------------- Error Message <br>
--------------------------------------------------------------<br>
[1]PETSC ERROR: Argument out of range<br>
[1]PETSC ERROR: New nonzero at (0,207) caused a malloc<br>
Use MatSetOption(A, MAT_NEW_NONZERO_ALLOCATION_ERR,
PETSC_FALSE) to turn <br>
off this check<br>
[1]PETSC ERROR: See <a href="https://petsc.org/release/faq/"
rel="noreferrer" target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">https://petsc.org/release/faq/</a>
for trouble shooting.<br>
[1]PETSC ERROR: Petsc Release Version 3.17.4, unknown<br>
[1]PETSC ERROR: #1 MatSetValues_MPIAIJ() at <br>
/data/palken/petsc/src/mat/impls/aij/mpi/mpiaij.c:506<br>
<br>
----<br>
<br>
and then many MatSetValues errors follow.<br>
<br>
I have attached a minimal working example and a Makefile. My
code does <br>
depend on the GSL library also. I think there must be a
problem in how I <br>
set up the d_nnz and o_nnz arrays for the
MatMPIAIJSetPreallocation() <br>
function (lines 211-235 of mwe.c).<br>
<br>
I am building a matrix using radial basis functions with
compact <br>
support, so the matrix entries are zero when ||Xi - Xj|| >=
c, where c <br>
is the RBF shape parameter. This is accounted for on line 224
and 254 of <br>
the code. As far as I can tell I am consistent in the way I
define the <br>
nnz arrays and the way I call MatSetValues, so I don't know
why Petsc <br>
would need to malloc additional memory during the assembly
process.<br>
<br>
Any pointers would be greatly appreciated.<br>
<br>
Patrick<br>
</blockquote>
</div>
</blockquote>
</body>
</html>