further about MatGetSubMatrix_MPIDense(), and MatTranspose() and MatGetSubMatrix()

Yujie recrusader at gmail.com
Sat Jan 31 18:44:39 CST 2009


Petsc Version is 3.0.0-p2.

---------- Forwarded message ----------
From: Yujie <recrusader at gmail.com>
Date: Sat, Jan 31, 2009 at 4:33 PM
Subject: further about MatGetSubMatrix_MPIDense(), and MatTranspose() and
MatGetSubMatrix()
To: PETSc users list <petsc-users at mcs.anl.gov>


Hi, PETSc Developers

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.

Regards,

Yujie

---------- Forwarded message ----------
From: Yujie <recrusader at gmail.com>
Date: Sat, Jan 31, 2009 at 4:25 PM
Subject: further about MatGetSubMatrix_MPIDense(), and MatTranspose() and
MatGetSubMatrix()
To: PETSc users list <petsc-users at mcs.anl.gov>


Hi, PETSc Developers:

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.

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.

224: for (i=0; i<ncols; i++) {
225: av = v + ((Mat_SeqDense *)newmatd->A->data)->lda*icol[i];
226: for (j=0; j<nrows; j++) {
227: *bv++ = av[irow[j] - rstart];
228: }
229: }

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".

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.

"Finishing MatMatMult
Finishing MatMatMult
Finishing MatTranspose
Finishing MatTranspose
==23027==
==23027== Invalid read of size 4
==23027== at 0x4253F2C: MatGetSubMatrix_MPIDense(_p_Mat*, _p_IS*, _p_IS*,
int, MatReuse, _p_Mat**) (mpidense.c:227)
==23027== by 0x41D4F56: MatGetSubMatrix(_p_Mat*, _p_IS*, _p_IS*, int,
MatReuse, _p_Mat**) (matrix.c:6162)
==23027== by 0x8049643: main (ex113.c:75)
==23027== Address 0x553de30 is 8 bytes after a block of size 46,952 alloc'd
==23027== at 0x401AC01: malloc (vg_replace_malloc.c:207)
==23027== by 0x46992C1: PetscMallocAlign(unsigned int, int, char const*,
char const*, char const*, void**) (mal.c:40)
==23027== by 0x46A45C3: PetscTrMallocDefault(unsigned int, int, char const*,
char const*, char const*, void**) (mtr.c:194)
==23027== by 0x413E56F: MatSeqDenseSetPreallocation_SeqDense (dense.c:1945)
==23027== by 0x413E26D: MatSeqDenseSetPreallocation(_p_Mat*, double*)
(dense.c:1926)
==23027== by 0x425C193: MatMPIDenseSetPreallocation_MPIDense
(mpidense.c:1549)
==23027== by 0x425CE71: MatMPIDenseSetPreallocation(_p_Mat*, double*)
(mpidense.c:1699)
==23027== by 0x425B4E5: MatTranspose_MPIDense(_p_Mat*, MatReuse, _p_Mat**)
(mpidense.c:963)
==23027== by 0x41C3435: MatTranspose(_p_Mat*, MatReuse, _p_Mat**)
(matrix.c:3843)
==23027== by 0x8049482: main (ex113.c:62)
==23027==
==23027== Invalid read of size 4
==23027== at 0x4253F2E: MatGetSubMatrix_MPIDense(_p_Mat*, _p_IS*, _p_IS*,
int, MatReuse, _p_Mat**) (mpidense.c:227)
==23027== by 0x41D4F56: MatGetSubMatrix(_p_Mat*, _p_IS*, _p_IS*, int,
MatReuse, _p_Mat**) (matrix.c:6162)
==23027== by 0x8049643: main (ex113.c:75)
==23027== Address 0x553de34 is 12 bytes after a block of size 46,952 alloc'd
==23027== at 0x401AC01: malloc (vg_replace_malloc.c:207)
==23027== by 0x46992C1: PetscMallocAlign(unsigned int, int, char const*,
char const*, char const*, void**) (mal.c:40)
==23027== by 0x46A45C3: PetscTrMallocDefault(unsigned int, int, char const*,
char const*, char const*, void**) (mtr.c:194)
==23027== by 0x413E56F: MatSeqDenseSetPreallocation_SeqDense (dense.c:1945)
==23027== by 0x413E26D: MatSeqDenseSetPreallocation(_p_Mat*, double*)
(dense.c:1926)
==23027== by 0x425C193: MatMPIDenseSetPreallocation_MPIDense
(mpidense.c:1549)
==23027== by 0x425CE71: MatMPIDenseSetPreallocation(_p_Mat*, double*)
(mpidense.c:1699)
==23027== by 0x425B4E5: MatTranspose_MPIDense(_p_Mat*, MatReuse, _p_Mat**)
(mpidense.c:963)
==23027== by 0x41C3435: MatTranspose(_p_Mat*, MatReuse, _p_Mat**)
(matrix.c:3843)
==23027== by 0x8049482: main (ex113.c:62)
Finishing MatGetSubMatrix
Finishing MatGetSubMatrix
"

Regards,

Yujie
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20090131/2ead2304/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ex113.c
Type: application/octet-stream
Size: 2865 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20090131/2ead2304/attachment.obj>


More information about the petsc-users mailing list