The bug is strange. When I increase or reduce the processors, the bug will appear with certain processors number :(.<br><br><div class="gmail_quote">On Tue, Jan 20, 2009 at 5:34 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">That fixes a bug since the the data is actually stored with leading<br>
dimension lda, rather<br>
than nlrows.<br>
<br>
Matt<br>
<div><div class="Wj3C7c"><br>
On Tue, Jan 20, 2009 at 7:27 PM, Yujie <<a href="mailto:recrusader@gmail.com">recrusader@gmail.com</a>> wrote:<br>
> Dear Barry and Matthew:<br>
><br>
> I always fingure out what's wrong with MatGetSubMatrix_MPIDense() in my<br>
> application. Because I use other pacakges based on PETSc, it is difficult to<br>
> change my PETSc2.3.3 to 3.0.0. I have to debug my codes to find something.<br>
><br>
> Now, I have confirmed the question is in "*bv++ = av[irow[j] - rstart];" of<br>
><br>
> (PETSC2.3.3)<br>
><br>
> /* Now extract the data pointers and do the copy, column at a time */<br>
> 245: newmatd = (Mat_MPIDense*)newmat->data;<br>
> 246: bv = ((Mat_SeqDense *)newmatd->A->data)->v;<br>
> 247:<br>
> 248: for (i=0; i<ncols; i++) {<br>
> 249: av = v + nlrows*icol[i];<br>
> 250: for (j=0; j<nrows; j++) {<br>
> 251: *bv++ = av[irow[j] - rstart];<br>
> 252: }<br>
> 253: }<br>
><br>
> The codes generate an error of segmentation violation.<br>
><br>
> I have checkec PETsc3.0.0 version. the corresponding codes are:<br>
><br>
> 220: /* Now extract the data pointers and do the copy, column at a time */<br>
> 221: newmatd = (Mat_MPIDense*)newmat->data;<br>
> 222: bv = ((Mat_SeqDense *)newmatd->A->data)->v;<br>
> 223:<br>
> 224: for (i=0; i<ncols; i++) {<br>
> 225: av = v + ((Mat_SeqDense *)newmatd->A->data)->lda*icol[i];<br>
> 226: for (j=0; j<nrows; j++) {<br>
> 227: *bv++ = av[irow[j] - rstart];<br>
> 228: }<br>
> 229: }<br>
><br>
> why change "nlrows" to "((Mat_SeqDense *)newmatd->A->data)->lda"? After I<br>
> revise the codes in PETsc2.3.3, the error disappears. However, the results<br>
> from my codes become wrong. Could you give me some advice? thanks a lot.<br>
><br>
> Regards,<br>
><br>
> Yujie<br>
><br>
><br>
<br>
<br>
<br>
</div></div><font color="#888888">--<br>
What most experimenters take for granted before they begin their<br>
experiments is infinitely more interesting than any results to which<br>
their experiments lead.<br>
-- Norbert Wiener<br>
</font></blockquote></div><br>