[petsc-users] Some help for partitioning a vector

ehsan sadrfaridpour it.sadr at gmail.com
Tue Jun 28 09:14:37 CDT 2016


Hi,
Sorry for long email. My questions are in the bottom.

I try to use MatMult to multiply a vector to a matrix but I face below
problem.

> [0]PETSC ERROR: --------------------- Error Message
> --------------------------------------------------------------
> [0]PETSC ERROR: Nonconforming object sizes
> [0]PETSC ERROR: Incompatible partition of A (20) and xx (40)
> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
> for trouble shooting.
> [1]PETSC ERROR: --------------------- Error Message
> --------------------------------------------------------------
> [1]PETSC ERROR: Nonconforming object sizes
> [1]PETSC ERROR: Incompatible partition of A (20) and xx (40)
> [1]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
> for trouble shooting.
> [1]PETSC ERROR: Petsc Release Version 3.6.3, unknown
>

I use 2 process for this. I check the local ranges with
VecGetOwnershipRange and MatGetOwnershipRange commands and they reveal that
the matrix is distributed between processes while the vector is exist
completely on both processes.

> in rank:1, vector start:0, end:40, matrix start:20, end:40
> in rank:0, vector start:0, end:40, matrix start:0, end:20
>

I created the vector "vol_" using below commands.
   Vec vol_;
    VecCreateMPI(PETSC_COMM_SELF, PETSC_DECIDE, size_,&vol_);
    VecSet(vol_,val);           //Sets all components of a vector to a
single scalar value.
    VecAssemblyBegin(vol_);
    VecAssemblyEnd(vol_);

*My questions:*
A- What should I do differently to create a scattered vector in the first
place?
B- If my vector initialization is ok, what should I do now to scatter the
vector among the processes?
I saw the VecScatter function, but I am not sure how to use it, if it is
the right function.

Best,
Ehsan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160628/7c692f98/attachment.html>


More information about the petsc-users mailing list