[petsc-users] Using MatGetColumnVector() on multiprocess

Matthew Knepley knepley at gmail.com
Mon Nov 9 08:53:47 CST 2020


On Mon, Nov 9, 2020 at 9:44 AM Antoine Côté <Antoine.Cote3 at usherbrooke.ca>
wrote:

> Hi,
>
> I would like to retrieve the values of a column in a sparse Mat created
> with DMCreateMatrix(). I currently use MatGetColumnVector() to store values
> in a Vec "A". A computation is later made on each value in "A", and the
> results are stored in another Vec "B" (that was initialized at "0.0" using
> VecSet()).
>
> Code works fine on a single process. When I try multiple processes, some
> values are ignored i.e. Vec "B" contains the right results for some
> positions, while others stay at "0.0". I suspect it is
> because MatGetColumnVector() is "Not Collective".
>

I do not think that is it. It looks like GetColumnVector() works in
parallel, but it is just not optimal:


https://www.mcs.anl.gov/petsc/petsc-current/src/mat/utils/getcolv.c.html#MatGetColumnVector

I would

  1) Check that the column vector you get back is the one you expect

  2) Check that your computation on A is parallelized

  Thanks,

     Matt


> What would be the best workaround?
>
> Thank you very much,
>
> Antoine Côté
>


-- 
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/20201109/6d768d76/attachment.html>


More information about the petsc-users mailing list