[petsc-users] Doubts regarding MatGetSubMatrices
Barry Smith
bsmith at mcs.anl.gov
Mon Mar 27 18:56:07 CDT 2017
Use ISCreateStride() to indicate all the columns; MatGetSubMatrices_MPIAIJ handles this as a special case and never generates the integer list of all columns.
Note that the resulting matrix will have the same number of columns as the original matrix. What do you want to do with this matrix?
Barry
So make the start of the stride 0, the step 1 and the length be the same as the number of columns in the original matrix.
> On Mar 27, 2017, at 4:21 PM, Łukasz Kasza <rpgwars at wp.pl> wrote:
>
>
>
>
> Dear PETSC users,
>
> Lets say that I want to use MatGetSubMatrices(Mat mat,PetscInt n,const IS irow[],const IS icol[],MatReuse scall,Mat *submat[]) and I want to get every column of the specified rows. However initially I dont know which column indexes to pass in icol, I just know that I need everything.
>
> My question is, how to implement this efficiently in parallel aij format? I could for instance pass a range of indexes from 0 to the size of the matrix, but my concern is that this way the communication cost will increase for large matrices as the request will be sent for all columns for every row in irow. Other solution would be to exchange between the processes info regarding indexes of nonzero columns and then call MatGetSubmatrices with indexes in icol only of nonzero columns.
>
> Any help much appreciated,
> Best Regards
>
>
More information about the petsc-users
mailing list