[petsc-users] MatSetSizes for MATMPIBAIJ

NovA av.nova at gmail.com
Fri Feb 5 18:46:07 CST 2010


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) ?

Here we need not specify noznzero pattern. Am I wrong?

Thanks!
  Andrey

>>
>> >>  MatSetType(A, MATMPIBAIJ);
>> >>  MatGetOwnershipRange(A, &rowS, &rowE);
>> >>  Then loop local rows from rowS/4 to rowE/4 to preallocate storage
>> >> using MatMPIBAIJSetPreallocation(A,4,...)
>> >
>> >   You cannot do it this way. You cannot call MatGetOwnershipRange()
>> > before
>> > setting the preallocation.
>>
>> Oh, ok. This applies to BAIJ, right? For AIJ this works, so I thought
>> it should for BAIJ either.
>
> This is not correct for AIJ either.
>
>    Matt
>
>>
>> >
>> >   You can either,
>> >
>> > 1) figure out yourself the local sizes you want to use, then just call
>> > MatCreateMPIBAIJ() with all the information (or call MatCreate(),
>> > MatSetType(), MatSetSizes(), MatMPIBAIJSetPreallocation()) or
>> > 2) Use PetscMap (see manual page for PetscMapInitialize) to see how
>> > PETSc
>> > would decompose the rows and then use that information to do 1).
>>
>> Thanks for the tip. I'll try to sort it out.
>>
>> Best wishes,
>>    Andrey
>
> --
> 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
>


More information about the petsc-users mailing list