[petsc-users] MatSetSizes with blocked matrix

Steena Monteiro steena.hpc at gmail.com
Mon Mar 14 22:05:38 CDT 2016


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,

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160314/cbc646b7/attachment.html>


More information about the petsc-users mailing list