2
$\begingroup$

In a traditional PDE solver on unstructured meshes, we know exactly the sparse pattern of the Jacobian matrix, and we know that the amount of data to communicate is far smaller than the amount of local data.

Then is it more efficient to use ghosted PETSC Vec (created with VecCreateGhost or VecCreateGhostWithArray) than the default Vec (creatd with VecCreateMPI)?

$\endgroup$
2
$\begingroup$

VecGhost can be useful if copying the interior values as part of a global-to-local (halo update) is expensive. The memory access pattern of a dedicated local vector can give better cache reuse, so perceived benefits of VecGhost are often erased in traversal. Also, since VecGhost contains storage for the ghost values, it typically increases the memory used by a Krylov space (relative to normal vectors, where there are a constant number of local vectors).

VecGhost is a dubious performance optimization; I don't recommend using it in new code unless you have done the profiling for your application and are sure that it is beneficial. It exists so that users who desire that particular optimization don't need to roll their own implementation.

$\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.