[petsc-users] Parallel matrix-vector product with Matrix Shell

Mario Rossi dfatiac at gmail.com
Fri Jun 17 10:21:03 CDT 2022

I need to find the largest eigenvalues (say the first three) of a very
large matrix and I am using
a combination of PetSc and SLEPc. In particular, I am using a shell matrix.
I wrote a "custom"
matrix-vector product and everything works fine in serial (one task) mode
for a "small" case.
For the real case, I need multiple (at least 128) tasks for memory reasons
so I need a parallel variant of the custom matrix-vector product. I know
exactly how to write the parallel variant
(in plain MPI) but I am, somehow, blocked because it is not clear to me
what each task receives
and what is expected to provide in the parallel matrix-vector product.
More in detail, with a single task, the function receives the full X vector
and is expected to provide the full Y vector resulting from Y=A*X.
What does it happen with multiple tasks? If I understand correctly
in the matrix shell definition, I can choose to split the matrix into
blocks of rows so that the matrix-vector function should compute a block of
elements of the vector Y but does it receive only the corresponding subset
of the X (input vector)? (this is what I guess happens) and in output, does
each task return its subset of elements of Y as if it were the whole array
and then PetSc manages all the subsets? Is there anyone who has a working
example of a parallel matrix-vector product for matrix shell?
Thanks in advance for any help you can provide!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220617/4ecd3a08/attachment.html>

More information about the petsc-users mailing list