使用fork和MPI进行多进程编程之间的区别 [英] Difference between multi-process programming with fork and MPI

查看:460
本文介绍了使用fork和MPI进行多进程编程之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用linux"fork"创建多进程程序与MPI库中可用的功能之间,性能或其他方面是否存在差异? 还是因为可以使用功能而在MPI中执行起来更容易?

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?

推荐答案

他们不能解决相同的问题.请注意并行编程和分布式内存并行编程之间的区别.

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

使用您通常提到的fork/join模型是在同一台物理计算机上进行 parallel 编程.通常,您不将您的工作分发到其他连接的计算机上(注释中的某些模型除外).

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用于分布式内存并行编程.您可以使用一组计算机(甚至数十万个处理器)来解决问题,而不是使用单个处理器.尽管有时将它们视为一台大型逻辑机,但它们通常由许多处理器组成. MPI功能可简化分布式计算机上这些进程之间的通信,从而避免执行诸如在所有进程之间手动打开TCP套接字之类的事情.

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.

因此,除非您仅在单台计算机上运行MPI程序,否则实际上没有办法比较它们的性能,这并不是它的设计目的.是的,您可以在一台机器上运行MPI,并且人们一直在为小型测试代码或小型项目运行MPI,但这并不是最大的用例.

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.

这篇关于使用fork和MPI进行多进程编程之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆