use mpi to calculate the matrix