用于集群环境的伪随机数生成器 [英] Pseudo-random number generator for cluster environment

查看:216
本文介绍了用于集群环境的伪随机数生成器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在群集上生成独立的伪随机数,例如进行蒙特卡洛模拟?我可以有许多计算节点(例如100个),并且我需要在每个节点上生成数百万个数字.我需要保证一个节点上的PRN序列不会与另一节点上的PRN序列重叠.

How can I generate independent pseudo-random numbers on a cluster, for Monte Carlo simulation for example? I can have many compute nodes (e.g. 100), and I need to generate millions of numbers on each node. I need a warranty that a PRN sequence on one node will not overlap the PRN sequence on another node.

  • 我可以在根节点上生成所有PRN,然后将它们发送到其他节点.但这太慢了.
  • 我可以在每个节点上按顺序跳到一个已知的距离.但是,对于Mersenne-Twister或其他任何良好的PRNG,是否有这样的算法,可以在合理的时间和内存范围内完成?
  • 我可以在每个节点上使用不同的生成器.但是,像梅森-特格尔(Mersenne-Twister)这样的优质发电机有可能吗?怎么办?
  • 还有其他人吗?

推荐答案

永远不要使用从同一原始流中获得的可能重叠的随机流.如果您尚未测试生成的交错流,就不会知道其统计质量.

You should never use potentially overlapping random streams obtained from the same original stream. If you have not tested the resulting interleaved stream, you have no idea of its statistic quality.

幸运的是, Merenne Twister(MT)将帮助您完成分发任务.使用其称为 Dynamic Creator (此后称为DC)的专用算法,您可以创建独立随机数生成器,以生成高度独立的随机流.

Fortunately, Mersenne Twister (MT) will help you in your distribution task. Using its dedicated algorithm, called Dynamic Creator (DC hereafter), you can create independent random number generators that will produce highly independent random streams.

每个流将在将使用它的节点上创建.基本上,将DC视为创建MT的不同实例的面向对象范例中的构造函数.每个不同的实例都旨在产生高度独立的随机序列.

Each stream will be created on the node that will be using it. Basically, think of DC as a constructor in object oriented paradigm that creates different instances of MT. Each different instance is designed to produce highly independent random sequences.

您可以在此处找到DC: http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/DC/dc.html
使用起来非常简单,您将能够修复不同的参数,例如要获取的不同MT实例的数量或这些MT的期限.根据其输入参数,DC的运行时间将发生变化.

You can find DC here: http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/DC/dc.html
It's quite straightforward to use and you'll be able to fix different parameters such as the number of different MT instances you want to obtain or the period of these MTs. Depending on its input parameter, DC will runtime will change.

除了随DC提供的自述文件外,还请查看DC归档文件中的文件example/new_example2.c.它显示了使用不同的输入标识符来获取独立序列的调用示例,这基本上就是您识别集群作业所必需的.

In addition of the README coming along with DC, take a look at the file example/new_example2.c in the DC archive. It shows example of calls to get independent sequences given a different input identifier, which is basically what you have to identify cluster jobs.

最后,如果您想了解有关如何在并行或分布式环境中使用PRNG的更多信息,建议您阅读以下科学文章:

Finally, if you intend to learn more about how to use PRNGs in parallel or distributed environments, I suggest you read this scientific articles:

用于随机高性能计算的随机流的实用分布 ,David RC Hill,在国际高性能计算与仿真(HPCS)会议上 >,2010年

这篇关于用于集群环境的伪随机数生成器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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