四核和虚拟机上的并行编程?

发布于 2024-08-22 03:18:43 字数 126 浏览 8 评论 0原文

我正在考虑慢慢学习并行编程。我见过人们使用安装了 OpenMPI 的集群来学习这些东西。我无法访问集群,但有一台四核机器。我能在这里体验到任何好处吗?另外,如果我在虚拟机中运行 linux,那么在虚拟机中使用 OpenMPI 是否有意义?

I'm thinking of slowly picking up Parallel Programming. I've seen people use clusters with OpenMPI installed to learn this stuff. I do not have access to a cluster but have a Quad-Core machine. Will I be able to experience any benefit here? Also, if I'm running linux inside a Virtual machine, does it make sense in using OpenMPI inside a VM?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

孤独患者 2024-08-29 03:18:43

如果您的目标是学习,则根本不需要集群。您的四核(或任何双核甚至单核)计算机就足够了。要点是学习如何“并行”思考以及如何设计应用程序。

一些重要的要点是:

  • 利用不同的并行范例,例如分而治之、主从工作、SPMD……取决于您想要执行的数据和任务依赖性。
  • 选择不同的数据划分粒度来检查计算/通信比率(在消息传递的情况下),或者检查由于内存区域互斥而导致的串行执行量。

拥有四核后,您可以测量方法加速(由于并行化而获得的性能增益),这通常由非并行执行时间与并行执行时间之间的除法给出。
越接近 4(四个核心意味着执行时间的 1/4),您的并行化策略就越好(一旦您可以均匀地分配工作和数据)。

If your target is to learn, you don't need a cluster at all. Your quad-core (or any dual-core or even a single-cored) computer will be more than enough. The main point is to learn how to think "in parallel" and how to design your application.

Some important points are to:

  • Exploit different parallelism paradigms like divide-and-conquer, master-worker, SPMD, ... depending on data and tasks dependencies of what you want to do.
  • Chose different data division granularities to check the computation/communication ratio (in case of message passing), or to check the amount of serial execution because of mutual exclusion to memory regions.

Having a quad-core you can measure your approach speedup (the gain on performance attained because of the parallelization) which is normally given by the division between the time of the non parallelized execution and the time of the parallel execution.
The closer you get to 4 (four cores meaning 1/4th the execution time), the better your parallelization strategy was (once you could evenly distribute work and data).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文