[petsc-users] MatSetSizes with blocked matrix
Matthew Knepley
knepley at gmail.com
Mon Mar 14 22:46:57 CDT 2016
On Mon, Mar 14, 2016 at 10:05 PM, Steena Monteiro <steena.hpc at gmail.com>
wrote:
> Hello,
>
> I am having difficulty getting MatSetSize to work prior to using MatMult.
>
> For matrix A with rows=cols=1,139,905 and block size = 2,
>
It is inconsistent to have a row/col size that is not divisible by the
block size.
Matt
> rank 0 gets 400000 rows and rank 1 739905 rows, like so:
>
> /*Matrix setup*/
>
> ierr=PetscViewerBinaryOpen(PETSC_COMM_WORLD,file,FILE_MODE_READ,&fd);
> ierr = MatCreate(PETSC_COMM_WORLD,&A);
> ierr = MatSetFromOptions(A);
> ierr = MatSetType(A,MATBAIJ);
> ierr = MatSetBlockSize(A,2);
>
> /*Unequal row assignment*/
>
> if (!rank) {
> ierr = MatSetSizes(A, 400000, PETSC_DECIDE,
> 1139905,1139905);CHKERRQ(ierr);
> }
> else {
> ierr = MatSetSizes(A, 739905, PETSC_DECIDE,
> 1139905,1139905);CHKERRQ(ierr);
> }
>
> MatMult (A,x,y);
>
> /************************************/
>
> Error message:
>
> 1]PETSC ERROR: [0]PETSC ERROR: No support for this operation for this
> object type
> Cannot change/reset row sizes to 400000 local 1139906 global after
> previously setting them to 400000 local 1139905 global
>
> [1]PETSC ERROR: [0]PETSC ERROR: Cannot change/reset row sizes to 739905
> local 1139906 global after previously setting them to 739905 local 1139905
> global
>
> -Without messing with row assignment, MatMult works fine on this matrix
> for block size = 2, presumably because an extra padded row is automatically
> added to facilitate blocking.
>
> -The above code snippet works well for block size = 1.
>
> Is it possible to do unequal row distribution *while using blocking*?
>
> Thank you for any advice.
>
> -Steena
>
>
>
>
>
>
>
>
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160314/f28e616b/attachment.html>
More information about the petsc-users
mailing list