MPI 遗传蒙特卡罗算法资源?
我一直在与一些朋友合作将 Matlab 遗传算法转换为 C++,目前它按顺序运行。 Matlab 不再是我们当前代码的一部分。
我们希望在集群上使用它,但资源有点枯竭。 我们在大学有一个可用的集群,它配备了 Rocks 和 OpenMPI,但我不太确定从哪里开始使用它。
我们目前有 2D 和 3D 阵列设置,其中包含数据,当系统在模型之间进行交叉或交换时,它只是尝试交换 2D 和 3D 阵列的部分。 有哪些好方法可以将这些结构跨多个节点分开?
I have been working with some friends to convert a Matlab Genetic Algorithm to C++ and it works in a sequential order currently. Matlab is no longer a portion of our current code.
We are looking to use it on a cluster, but have been a little dry on resources. We have a cluster available at the University and it is equipped with Rocks and OpenMPI, but I'm not really sure where to begin working with it.
We currently have 2D and 3D Arrays setup with the data in them and when the system is doing crossover or exchanging between the models it just tries swapping parts of the 2D and 3D array. What are some good ways to separate these structures across multiple nodes?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您正在进行矩阵计算,那么是否有一种好的方法来划分计算在很大程度上取决于计算本身。
我强烈推荐 Golub 和 van Loan 的书“矩阵计算,第三版”。 其中有一整章专门讨论并行计算(第 6 章)。
OpenMPI 是解决这个问题的一个很好的中间件。 由于您是在 C++ 中执行此操作,因此您还可以查看 Zeromq。 两者具有不同的语义,其中一种可能比另一种更适合您的问题空间或您的技能。
另外,您应该知道并行矩阵计算(通常是信号处理,但还有许多其他应用)是一个非常非常活跃的研究领域。
If you're doing matrix computations, then whether there's even a good way to partition the calculations is highly dependent upon the calculation itself.
I'd highly recommend the Golub and van Loan book, "Matrix Computations, 3rd Ed.". In it there is an entire chapter devoted to parallel computations (Ch. 6).
OpenMPI is a fine middleware to use for this problem. Since you're doing this in C++, you might also take a look at zeromq. The two have different semantics, and one might favor your problem space or your skillset more than the other.
Also, you should know that parallel matrix computations (typically signal processing, but there are lots of other applications) is a very, very active area of research.
适应度计算:
您通常只需要了解一个个体即可计算其适应度,因此您可以通过将个体分配给每个核心来处理总体。 当计算出个体的适应度后,将其核心交给一个新个体。
交叉:
分而治之的方法可能非常适合解决这个问题。 将数组分成由每个 CPU 核心处理的块,然后添加全局交叉步骤(配对子集)以确保您能够适当地在多维空间中移动。
Fitness Calculation:
You typically just need to know about one individual to calculate its fitness, so you can just work through the population by doling out individuals to each core. When an individual's fitness has been calculated, hand that core a new individual.
Crossover:
A divide and conquer approach might be well suited to this problem. Break your arrays into blocks that are processed by each CPU core, then perhaps add a global crossover step (mating a subset of pairs) to ensure you have the ability to move through the multidimensional space appropriately.