-1

I have question about testing MPI program. I wrote FW algorithm with Open MPI. The program works fine and correct, but problem is that it takes more time than my sequential program (I have tried to test it on only one computer). Does someone have idea why that happens ? Thanks

NightDev
  • 35
  • 6

1 Answers1

2

It is a common misconception that a parallel implementation of a program will always be quicker than its sequential version.

The trouble with parallelizing a program is it introduces a fairly large overhead with the use of multiple threads, which a sequential program running from a single thread does not suffer from. Not only do we have to initially set up these threads, there is also communication taking place which wasn't necessary with the sequential program.

For relatively small problems, you will find that a sequential solution will almost always out perform the parallel program. As the size of your problem scales, the cost of managing multiple processes gradually becomes negligible with respect to the computational cost of the problem itself. As a result, your parallel version will begin to outperform your sequential program.

Nicholas Betsworth
  • 1,707
  • 19
  • 24
  • But, I also wrote FW with multiple threads and it is faster for big data. But with Open MPI, it is very slower. Moreover, it seems that processes are not parallelized. – NightDev Mar 01 '15 at 00:04
  • I wrote FW using multiple threads (without MPI) and it runs faster. Same algorithm written with MPI is slower. – NightDev Mar 01 '15 at 11:03