<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">Yaoyu :</div><div class="gmail_quote">Can you send me the code for calling MatGetSubMatrices()?</div><div class="gmail_quote">I want to check how did you create mpi ISs.</div><div class="gmail_quote"><br></div><div class="gmail_quote">Checking MatGetSubMatrices() for mpiaij matrix format, it seems duplicate IS indices would work. I guess duplicate rows might be ok, but duplicate columns might run into trouble from our implementation. </div><div class="gmail_quote"><br></div><div class="gmail_quote">By definition, a submatrix of A should not have duplicate row/column of A, isn't it? </div><div class="gmail_quote"><br></div><div class="gmail_quote">Hong</div><div class="gmail_quote"><br></div><div class="gmail_quote">Hi Hong,<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
I think what you said about the ISs for MatGetSubMatrices() are right.<br>
<br>
Today I tried to run my program to get submatrix by<br>
MatGetSubMatrices() twice. One time with ISs created with<br>
PETSC_COMM_WORLD and the other time with PETSC_COMM_SELF. I was<br>
creating a 6x3 submatrix on each processor from a 570x3 parallel dense<br>
matrix. There are only 2 processors in total. The results are as<br>
follows:<br>
<br>
======== submatrix with ISs created with PETSC_COMM_WORLD =========<br>
Processor 0<br>
Mat Object: 1 MPI processes<br>
type: seqdense<br>
2.7074996615625420e+10 6.8399452804377966e+11 -1.2730861976538324e+08<br>
2.7074996615625420e+10 6.8399452804377966e+11 -1.2730861976538324e+08<br>
2.7359996580000423e+10 8.2079343365253589e+11 6.3654303672968522e+06<br>
2.9639996295000458e+10 1.9151846785225828e+12 -1.0184686034752984e+08<br>
2.9924996259375465e+10 1.1947308948674746e+12 -3.8181422587255287e+08<br>
5.4149993231250839e+10 2.6675786593707410e+13 -4.9650360873402004e+09<br>
<br>
Processor 1<br>
Mat Object: 1 MPI processes<br>
type: seqdense<br>
5.4149993231250839e+10 1.9183199555758315e+12 5.9880080526417112e+08<br>
7.8374990203126236e+10 5.7441876402563477e+12 1.7367770705944958e+09<br>
8.0939989882501266e+10 5.7347670250898613e+12 1.7900992494213123e+09<br>
8.1509989811251282e+10 5.7751527083651416e+12 1.8027055821637158e+09<br>
8.4074989490626328e+10 6.1543675577970762e+12 1.8557943339637902e+09<br>
1.0829998646250171e+11 9.5915997778791719e+12 2.9940040263208551e+09<br>
<br>
==== end of submatrix with ISs created with PETSC_COMM_WORLD ======<br>
<br>
======== submatrix with ISs created with PETSC_COMM_SELF =========<br>
Processor 0<br>
Mat Object: 1 MPI processes<br>
type: seqdense<br>
2.7074996615625420e+10 6.8399452804377966e+11 -1.2730861976538324e+08<br>
2.7074996615625420e+10 6.8399452804377966e+11 -1.2730861976538324e+08<br>
2.7359996580000423e+10 8.2079343365253589e+11 6.3654303672968522e+06<br>
2.9639996295000458e+10 1.9151846785225828e+12 -1.0184686034752984e+08<br>
2.9924996259375465e+10 1.1947308948674746e+12 -3.8181422587255287e+08<br>
5.4149993231250839e+10 2.6675786593707410e+13 -4.9650360873402004e+09<br>
<br>
Processor 1<br>
Mat Object: 1 MPI processes<br>
type: seqdense<br>
5.4149993231250839e+10 1.9183199555758315e+12 5.9880080526417112e+08<br>
7.8374990203126236e+10 5.7441876402563477e+12 1.7367770705944958e+09<br>
8.0939989882501266e+10 5.7347670250898613e+12 1.7900992494213123e+09<br>
8.1509989811251282e+10 5.7751527083651416e+12 1.8027055821637158e+09<br>
8.4074989490626328e+10 6.1543675577970762e+12 1.8557943339637902e+09<br>
1.0829998646250171e+11 9.5915997778791719e+12 2.9940040263208551e+09<br>
<br>
==== end of submatrix with ISs created with PETSC_COMM_SELF ======<br>
<br>
The results are identical. I really agree with you that only<br>
sequential ISs should be used when creating submatrix by<br>
MatGetSubMatrices(). The above results may be just a coincidence.<br>
<br>
I take your suggestions and I am using only sequential ISs with<br>
MatGetSubMatrices() now.<br>
<br>
Yet another question: Can I use IS which have duplicate entries in it?<br>
The documentation of MatGetSubMatrices() says that "The index sets may<br>
not have duplicate entries", so I think no duplicated entries are<br>
allowed in the IS. But again, I just tried IS which have duplicated<br>
entries. And the resultant submatrices for each processor seemd to be<br>
correct. In fact, in the above sample submatrices I showed, the<br>
submatrix owned by Processor 0 has its row IS specified as [x, x, a,<br>
b, c, d]. Where 'x' means the duplicated entries in the IS. Then I got<br>
two identical rows in the submatrix owned by Processor 0.<br>
<br>
But I think I was doing this incorrectly.<br>
<br>
Thanks.<br>
<br>
HU Yaoyu<br>
<br>
><br>
> Yaoyu:<br>
><br>
> "MatGetSubMatrices() can extract ONLY sequential submatrices<br>
> (from both sequential and parallel matrices). Use MatGetSubMatrix()<br>
> to extract a parallel submatrix."<br>
><br>
> Using parallel IS for MatGetSubMatrices() definitely incorrect, unless you<br>
> only use one process.<br>
><br>
>><br>
>> And further. I checked the submatrices I obtained by<br>
>> MatGetSubMatrices() with both parallel ISs and sequential ISs. The<br>
>> submatrices are identical. Is it means that I could actually use<br>
>> parallel IS (created with PETSC_COMM_WORLD) ?<br>
>><br>
><br>
> What did you compare with? I do not understand what submatrices would<br>
> obtain with parallel IS using more than one process.<br>
><br>
> Hong<br>
<div><div class="h5">><br>
>><br>
>> > Yaoyu :<br>
>> > MatGetSubMatrices() returns sequential matrices.<br>
>> > IS must be sequential, created with PETSC_COMM_SELF.<br>
>> > See petsc/src/mat/examples/tests/ex42.c<br>
>> ><br>
>> > Check your submatrices.<br>
>> ><br>
>> > Hong<br>
>> ><br>
>> > Hi everyone,<br>
>> >><br>
>> >> I am trying to get values owned by other processors of a parallel<br>
>> matrix.<br>
>> >><br>
>> >> I tried to create a sub-matrix by using MatGetSubMatrices(), and then<br>
>> >> MatGetRow() on the sub-matrix. But MatGetRow() give me the following<br>
>> >> error message:<br>
>> >><br>
>> >> ===== Error message begins =====<br>
>> >><br>
>> >> No support for this operation for this object type<br>
>> >> only local rows<br>
>> >><br>
>> >> ===== Error message ends =====<br>
>> >><br>
>> >> The parallel matrix is a parallel dense matrix. The ISs for<br>
>> >> MatGetSubMatrices() are created using ISCreateGeneral() and<br>
>> >> PETSC_COMM_WORLD. The row IS is sorted by ISSort().<br>
>> >><br>
>> >> What did I mistake while using the above functions? Is there a better<br>
>> >> way to get access to matrix values owned by other processor?<br>
>> >><br>
>> >> Thanks!<br>
>> >><br>
>> >> HU Yaoyu<br>
>> >><br>
</div></div>>> > -------------- next part --------------<br>
>> > An HTML attachment was scrubbed...<br>
>> > URL: <<br>
>> <a href="http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160413/6be45909/attachment.html" rel="noreferrer" target="_blank">http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160413/6be45909/attachment.html</a><br>
>> ><br>
>> ><br>
>> > ------------------------------<br>
>> ><br>
>> > _______________________________________________<br>
>> > petsc-users mailing list<br>
>> > <a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a><br>
>> > <a href="https://lists.mcs.anl.gov/mailman/listinfo/petsc-users" rel="noreferrer" target="_blank">https://lists.mcs.anl.gov/mailman/listinfo/petsc-users</a><br>
>> ><br>
>> ><br>
>> > End of petsc-users Digest, Vol 88, Issue 41<br>
>> > *******************************************<br>
>><br>
</blockquote></div><br></div></div>