Hi Hong, Thank you for your rapid response.
I figured out that it was my mistake. I did not use the last argument of MatGetSubMatrices() in the right way. It turns out that, just like VecGetArray(), there is no need to explicitly allocate memory for the last argument passed to MatGetSubMatrices(). Now I can get the right submatrices and the rows of the submatrices. But the reason for the original error message is unclear, and I haven't debug it. And further. I checked the submatrices I obtained by MatGetSubMatrices() with both parallel ISs and sequential ISs. The submatrices are identical. Is it means that I could actually use parallel IS (created with PETSC_COMM_WORLD) ? > Yaoyu : > MatGetSubMatrices() returns sequential matrices. > IS must be sequential, created with PETSC_COMM_SELF. > See petsc/src/mat/examples/tests/ex42.c > > Check your submatrices. > > Hong > > Hi everyone, >> >> I am trying to get values owned by other processors of a parallel matrix. >> >> I tried to create a sub-matrix by using MatGetSubMatrices(), and then >> MatGetRow() on the sub-matrix. But MatGetRow() give me the following >> error message: >> >> ===== Error message begins ===== >> >> No support for this operation for this object type >> only local rows >> >> ===== Error message ends ===== >> >> The parallel matrix is a parallel dense matrix. The ISs for >> MatGetSubMatrices() are created using ISCreateGeneral() and >> PETSC_COMM_WORLD. The row IS is sorted by ISSort(). >> >> What did I mistake while using the above functions? Is there a better >> way to get access to matrix values owned by other processor? >> >> Thanks! >> >> HU Yaoyu >> > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: > <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160413/6be45909/attachment.html> > > ------------------------------ > > _______________________________________________ > petsc-users mailing list > [email protected] > https://lists.mcs.anl.gov/mailman/listinfo/petsc-users > > > End of petsc-users Digest, Vol 88, Issue 41 > *******************************************
