[petsc-users] Matrix Decomposition

Eda Oktay eda.oktay at metu.edu.tr
Wed May 15 08:06:02 CDT 2019


Dear Matt,

I am trying to distribute the matrix after loading it. So I tried something
like this:

  Mat B;
  PetscInt bm,bn;
  MatSetSizes(B,kk,kk,PETSC_DETERMINE,PETSC_DETERMINE);
  MatDuplicate(A,MAT_COPY_VALUES,&B);
  MatGetLocalSize(B,&bm,&bn);

where A is the original matrix (10*10) and kk is one the local sizes of A
(kk=4 so I want to divide A into 4*4 and 6*6). However, I get error in
MatSetSizes part and when I printed bm and bn, I get 5. In other words, B
is divided equally even though I tried to divide it unequally. Am I using
MatSetSizes wrong?

Thanks,

Eda

Matthew Knepley <knepley at gmail.com>, 15 May 2019 Çar, 14:51 tarihinde şunu
yazdı:

> On Wed, May 15, 2019 at 7:35 AM Eda Oktay via petsc-users <
> petsc-users at mcs.anl.gov> wrote:
>
>> Hello,
>>
>> I am trying to divide a matrix into unequal sized parts into different
>> processors (for example I want to divide 10*10 matrix into 4*4 and 6*6
>> submatrix in two processors). When my program reads a matrix from file, it
>> automatically divides it into equal parts and then I can't change local
>> sizes.
>>
>> How can I decompose a matrix that is read from a file?
>>
>
> MatLoad() takes a matrix argument. I believe you can use MatSetSizes()
> before loading to get the distribution you want.
>
>    Matt
>
>
>> Thanks,
>>
>> Eda
>>
>
>
> --
> 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
>
> https://www.cse.buffalo.edu/~knepley/
> <http://www.cse.buffalo.edu/~knepley/>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20190515/54f08b48/attachment-0001.html>


More information about the petsc-users mailing list