Difference between multi-process programming with fork and MPI

隐身守侯 提交于 2020-01-04 11:10:13

问题


Is there a difference in performance or other between creating a multi-process program using the linux "fork" and the functions available in the MPI library? Or is it just easier to do it in MPI because of the ready to use functions?


回答1:


They don't solve the same problem. Note the difference between parallel programming and distributed-memory parallel programming.

Using the fork/join model you mentioned usually is for parallel programming on the same physical machine. You generally don't distribute your work to other connected machines (with the exceptions of some of the models in the comments).

MPI is for distributed-memory parallel programming. Instead of using a single processor, you use a group of machines (even hundreds of thousands of processors) to solve a problem. While these are sometimes considered one large logical machine, they are usually made up of lots of processors. The MPI functions are there to simplify communication between these processes on distributed machines to avoid having to do things like manually open TCP sockets between all of your processes.

So there's not really a way to compare their performance unless you're only running your MPI program on a single machine, which isn't really what it's designed to do. Yes, you can run MPI on a single machine and people do that all the time for small test codes or small projects, but that's not the biggest use case.



来源:https://stackoverflow.com/questions/26421492/difference-between-multi-process-programming-with-fork-and-mpi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!