3
$\begingroup$

I'm writing a petsc code using a sequential matrix type. Since I want it to be easy to parallelize, I put some stuff in the code that is useless now, but will make it easier to parallelize later.

One of the things I added was MatGetOwnershipRange() to define the range of iterators that I'm using to build a matrix. The matrix is of type MatSeqAIJ, and has not had any values assigned to it, though memory has been allocated with MatSeqAIJSetPreallocation().

When I run MatGetOwnershipRange(), though, the two PetscInts I get for the beginning and end of the range are both 0.

Does MatGetOwnershipRange() only work for MPI matrices?

Does it only work for matrices that have had their values assigned with MatSetValues()?

$\endgroup$
3
$\begingroup$

It works for any matrix that has had its size set, returning the ownership range of a Vec that can be the result of a matrix-vector product. For most matrix types, this matches the row-based storage, though that is not strictly necessary. For sequential matrices, the ownership range is all the rows.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.