[petsc-users] MatSetSizes for MATMPIBAIJ

NovA av.nova at gmail.com
Sat Feb 6 03:56:39 CST 2010


2010/2/6 Barry Smith <bsmith at mcs.anl.gov>:
>
> On Feb 5, 2010, at 6:46 PM, NovA wrote:
>
>> 2010/2/6 Matthew Knepley <knepley at gmail.com>:
>>>
>>> On Fri, Feb 5, 2010 at 6:17 PM, NovA <av.nova at gmail.com> wrote:
>>>>
>>>> 2010/2/6 Barry Smith <bsmith at mcs.anl.gov>:
>>>>>
>>>>> On Feb 5, 2010, at 5:28 PM, NovA wrote:
>>>>>
>>>>>> Thanks for the quick response!
>>>>>>
>>>>>> 2010/2/6 Matthew Knepley <knepley at gmail.com>:
>>>>>>>
>>>>>>> 1) It will distribute block rows, so you will get 8 and 4 as you want
>>>>>>
>>>>>> How can it distribute in such a way, if it doesn't know block size
>>>>>> yet?
>>>>>> Let's continue the example:
>>>>>>  MatCreate(comm, &A);
>>>>>>  MatSetSizes(A, PETSC_DECIDE,12, 12,12);
>>>>>                                                               ^^^^^^
>>>>>                           This is wrong! Look at the manual page for
>>>>> MatCreateMPIBAIJ() for information on the meaning of this.
>>>>
>>>> Sorry, but I can't find any additional info on this at
>>>> http://www.mcs.anl.gov/petsc/petsc-as/snapshots/petsc-current/docs/manualpages/Mat/MatCreateMPIBAIJ.html
>>>> and around. I could just expect that those sizes mean number of blocks
>>>> not individual values, but can't find any confirmation...
>>>
>>> From the page: It says m,n,M,N are "rows" and the values in d_nz,o_nz are
>>> "blocks".
>>
>> Yep, sure. And how is this concerns the line
>>  MatSetSizes(A, /*m*/PETSC_DECIDE,/*n*/12, /*M*/12, /*N*/12) ?
>
> n is the number of "owned" columns it is NOT the same as the total number
> of columns. If you read the manual page for MatCreateMPIBAIJ you will see
> the example that discusses what n is.
>
> n - number of local columns (or PETSC_DECIDE to have calculated if N is given)
> This value should be the same as the local size used in creating the x
> vector for the matrix-vector product y = Ax.

Oh, I thought that you pointed me to wrong M & N values...
As for n value, this was always ambiguous for me. On the one hand, it
is said in the examples and manual that "all PETSc parallel matrix
formats are partitioned by contiguous chunks of rows across the
processors" and we use MatGetOwnershipRange returning just rows, i.e.
n = N. On the other hand n "is the local size used in creating the x
vector for y = Ax", i.e. n != N... For myself I decided to use first
assumption n = N as starting point in the hope to sort it out later.
As you see, I'm rather novice user yet. So sorry for stupid questions
:). I'll much appreciate any explanation.

Thanks!
  Andrey

> Barry
>


More information about the petsc-users mailing list