[petsc-users] MatGetSubMatrices or VecCreateGhost
Barry Smith
bsmith at mcs.anl.gov
Fri Oct 16 10:48:55 CDT 2015
> On Oct 16, 2015, at 7:52 AM, Bikash Kanungo <bikash at umich.edu> wrote:
>
> Hi,
>
> I need to multiply a matrix A with several vectors v_i's and use the resultant vectors in my calculation which involves access to non-local nodes.
What percentage of the "non-local" results do you need in "your calculation", a few percent, all of them? How do you know which "non-local" results you will need for "your calculation"? Are they ghost points on a grid? Something else?
What is "several vectors"? 5? 100? 1000?
Barry
> I can think of two possible ways to do it:
>
> 1. Store the vectors v_i's into an MPIDENSE matrix and perform MatMatMult with A to get a resultant dense matrix B. I can now use MatGetSubMatrices on B to access the non-local part required in my subsequent calculations.
>
> 2. Use MatMult to evaluate A*v_i for each of the vectors and provide ghost padding through VecCreateGhost for the resultant vector.
>
> Which of the two is a more efficient way to perform the task? Also, if there is a better way possible to achieve the same, then kindly let me know.
>
> Thanks,
> Bikash
>
> --
> Bikash S. Kanungo
> PhD Student
> Computational Materials Physics Group
> Mechanical Engineering
> University of Michigan
>
More information about the petsc-users
mailing list