[petsc-users] MatSetSizes with blocked matrix

Dave May dave.mayhem23 at gmail.com
Tue Mar 15 02:12:41 CDT 2016


On 15 March 2016 at 04:46, Matthew Knepley <knepley at gmail.com> wrote:

> 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.
>


To be honest, I don't think the error message being thrown clearly
indicates what the actual problem is (hence the email from Steena). What
about

"Cannot change/reset row sizes to 400000 local 1139906 global after
previously setting them to 400000 local 1139905 global. Local and global
sizes must be 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/20160315/3a7b40ec/attachment-0001.html>


More information about the petsc-users mailing list