I am currently writing a code that solves a large tridiagonal matrix every iteration and runs for 1,000's of iterations. I am currently using a Thomas algorithm to solve the matrix serially. I found a parallel version of the Thomas algorithm in the book called "Parallel Scientific Computing in C++ and MPI" (which you can find a version pretty easily if you google it).
The thing is when I run the the parallel Thomas taken directly from the book, it actually has a slower run time than the serial algorithm. This seems baffling to me as the whole point of creating a parallel algorithm is to speed it up. I tested both by running the serial and parallel algorithms verbatim from the book and sending the same tridiagonal into the function for each. I am running MPI on a school cluster to run these and submitting a job for the parallel runs to ensure I am using the same processor type for each node. Could it just be the communication time from the layout of the cluster that is causing this? I feel like I must be doing something wrong so any help would be much appreciated. If posting each algorithm would be of use, let me know.