Petsc Version is 3.0.0-p2.<br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Yujie</b> <span dir="ltr"><<a href="mailto:recrusader@gmail.com">recrusader@gmail.com</a>></span><br>
Date: Sat, Jan 31, 2009 at 4:33 PM<br>Subject: further about MatGetSubMatrix_MPIDense(), and MatTranspose() and MatGetSubMatrix()<br>To: PETSc users list <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>><br>
<br><br><p>Hi, PETSc Developers</p><p>I have sent the matrices and codes to you. However, the sizes of the matrices are a little big and reach your limit. If you need it. I will further send them to you. thanks a lot.</p>
<p>Regards,</p>
<p>Yujie <font color="#888888"><br></font></p><div><div class="Wj3C7c"><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Yujie</b> <span dir="ltr"><<a href="mailto:recrusader@gmail.com" target="_blank">recrusader@gmail.com</a>></span><br>
Date: Sat, Jan 31, 2009 at 4:25 PM<br>Subject: further about MatGetSubMatrix_MPIDense(), and MatTranspose() and MatGetSubMatrix()<br>To: PETSc users list <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br>
<br><br><p>Hi, PETSc Developers:<br></p><p>Recently, I try to find the bug in MatGetSubMatrix_MPIDense(). The problem should be in "av = v + ((Mat_SeqDense *)newmatd->A->data)->lda*icol[i];" of the following codes.</p>
<p>Since "av" and "v" are used for parent matrix, I think it should not be "newmatd" but "mat" in the codes. I have revised it. The results are correct. </p><p>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: }</p><p>Further problem is to use MatTranspose() and MatGetSubMatrix() when MPIAIJ*MPIDense. The attached files are the testing codes (I revised ex113.c). I have used Valgrind to test it. The errors are as follows. I obtain them from Valgrind output. The command is "valgrind -v --trace-children=yes --show-reachable=yes --track-fds=yes --leak-check=full mpirun -np 2 ex113".</p>
<p>This "Invalid read of size 4" will lead to the uncertain output. I can't figure out where the problem is. Could you give me some help? The used system is "Red Hat Enterprise Linux ES release 3". thanks.</p>
<p>"Finishing MatMatMult<br>Finishing MatMatMult<br>Finishing MatTranspose<br>Finishing MatTranspose<br>==23027== <br>==23027== Invalid read of size 4<br>==23027== at 0x4253F2C: MatGetSubMatrix_MPIDense(_p_Mat*, _p_IS*, _p_IS*, int, MatReuse, _p_Mat**) (mpidense.c:227)<br>
==23027== by 0x41D4F56: MatGetSubMatrix(_p_Mat*, _p_IS*, _p_IS*, int, MatReuse, _p_Mat**) (matrix.c:6162)<br>==23027== by 0x8049643: main (ex113.c:75)<br>==23027== Address 0x553de30 is 8 bytes after a block of size 46,952 alloc'd<br>
==23027== at 0x401AC01: malloc (vg_replace_malloc.c:207)<br>==23027== by 0x46992C1: PetscMallocAlign(unsigned int, int, char const*, char const*, char const*, void**) (mal.c:40)<br>==23027== by 0x46A45C3: PetscTrMallocDefault(unsigned int, int, char const*, char const*, char const*, void**) (mtr.c:194)<br>
==23027== by 0x413E56F: MatSeqDenseSetPreallocation_SeqDense (dense.c:1945)<br>==23027== by 0x413E26D: MatSeqDenseSetPreallocation(_p_Mat*, double*) (dense.c:1926)<br>==23027== by 0x425C193: MatMPIDenseSetPreallocation_MPIDense (mpidense.c:1549)<br>
==23027== by 0x425CE71: MatMPIDenseSetPreallocation(_p_Mat*, double*) (mpidense.c:1699)<br>==23027== by 0x425B4E5: MatTranspose_MPIDense(_p_Mat*, MatReuse, _p_Mat**) (mpidense.c:963)<br>==23027== by 0x41C3435: MatTranspose(_p_Mat*, MatReuse, _p_Mat**) (matrix.c:3843)<br>
==23027== by 0x8049482: main (ex113.c:62)<br>==23027== <br>==23027== Invalid read of size 4<br>==23027== at 0x4253F2E: MatGetSubMatrix_MPIDense(_p_Mat*, _p_IS*, _p_IS*, int, MatReuse, _p_Mat**) (mpidense.c:227)<br>
==23027== by 0x41D4F56: MatGetSubMatrix(_p_Mat*, _p_IS*, _p_IS*, int, MatReuse, _p_Mat**) (matrix.c:6162)<br>
==23027== by 0x8049643: main (ex113.c:75)<br>==23027== Address 0x553de34 is 12 bytes after a block of size 46,952 alloc'd<br>==23027== at 0x401AC01: malloc (vg_replace_malloc.c:207)<br>==23027== by 0x46992C1: PetscMallocAlign(unsigned int, int, char const*, char const*, char const*, void**) (mal.c:40)<br>
==23027== by 0x46A45C3: PetscTrMallocDefault(unsigned int, int, char const*, char const*, char const*, void**) (mtr.c:194)<br>==23027== by 0x413E56F: MatSeqDenseSetPreallocation_SeqDense (dense.c:1945)<br>==23027== by 0x413E26D: MatSeqDenseSetPreallocation(_p_Mat*, double*) (dense.c:1926)<br>
==23027== by 0x425C193: MatMPIDenseSetPreallocation_MPIDense (mpidense.c:1549)<br>==23027== by 0x425CE71: MatMPIDenseSetPreallocation(_p_Mat*, double*) (mpidense.c:1699)<br>==23027== by 0x425B4E5: MatTranspose_MPIDense(_p_Mat*, MatReuse, _p_Mat**) (mpidense.c:963)<br>
==23027== by 0x41C3435: MatTranspose(_p_Mat*, MatReuse, _p_Mat**) (matrix.c:3843)<br>==23027== by 0x8049482: main (ex113.c:62)<br>Finishing MatGetSubMatrix<br>Finishing MatGetSubMatrix<br>"<br></p><p>Regards,</p>
<p>Yujie</p>
</div><br>
</div></div></div><br>