I've been studying the efficiency of parallelizing Dijkstra Algorithm using both OpenMPI
and OpenMP
. In fact, when I use OpenMP, the execution time appears to be higher than using OpenMPI which is a bit strange to me since as far as I know threads are supposed to be faster than processes. OpenMPI creates a process for each execution while OpenMP creates threads under each process execution. My question is: Is my finding implementation dependent? In other word, can we always say parallelizing with OpenMP cannot be always faster than OpenMPI since it is an implementation dependent?
Thank you.
As always, it all depends on your current circumstances. OpenMP works only on your local CPU, whereas OpenMPI connects to several nodes over a network. As long as you can only split your work over as many threads as your have local CPU cores, OpenMP should be faster, because there is less messaging overhead. In lager scaling appliances, OpenMPI is superior, because it can be distributed across several systems, which also may have a better individual computation speed.