[petsc-users] Odp: Re: Doubts regarding MatGetSubMatrices

Łukasz Kasza rpgwars at wp.pl
Tue Mar 28 14:33:50 CDT 2017


Yes but it will have reduced number of rows. Thank you Barry Smith it works very well :)

Dnia Wtorek, 28 Marca 2017 01:56 Barry Smith <bsmith at mcs.anl.gov> napisał(a) 
> 
>    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