Note this is sequential Eigen vs PETSc so naturally there is a speedup.

As to setup, one needs to install MPI and PETSc on his own, as well as set PETSC_DIR and PETSC_ARCH in bash. make/tests, make/petsc in the repo are tested on OSX, so that the above test problem can be built with

make test/unit/math/prim/mat/fun/dot_product_petsc_test

Petsc “is a suite of data structures and routines for the scalable (parallel) solution of scientific applications modeled by partial differential equations”. Essentially it provides an HPC infrastructure for numerical solvers on linear system solution, differential equations, and optimization. The motivation is to use it for some critical and large-scale numerical operations involving MPI/CUDA. One example of such operation is Cholesky factorization of a large matrix. One can also take advantage of the interfaces it provides on third-party numerical solvers. When comes to MPI, It relieves developers from implementing manually basic operations such as scattering/gathering a distributed matrix.