Many simulation applications require the generation of long sequences of pseudo-random numbers. Linear recurrences modulo 2 are commonly used as the fundamental building block for constructing pseudo-random number generators with extended periods and excellent statistical properties. These generators consist of a lengthy binary state vector that evolves iteratively through linear transformations. One widely accepted pseudo-random generator in this category is the Mersenne twister 19937 (MT19937), proposed by Matsumoto and Nishimura, which has been implemented in numerous software libraries and numerical packages. The MT19937's popularity stems from its favorable distribution properties and the simplicity and speed of its algorithm. The linear transformation responsible for evolving the binary state vector can be expressed as a concise set of elementary bit manipulations. However, this transformation does not fully utilize the potential for parallelization through SIMD instructions available on modern hardware, limiting further speed enhancements. This paper introduces a new SIMD-friendly random number generator, which maintains the same statistical properties and period as the MT19937. It combines the random streams of multiple MT19937 instances with state vectors de-phased via jump-ahead transformations, then polls each instance in a round-robin fashion. By evolving their vector states simultaneously, the new generator achieves perfect vectorization, fully leveraging on SIMD hardware capabilities. Comprehensive test results demonstrate that the throughput of the new generator scales approximately linearly with the width of the SIMD registers used. This provides significant speed improvements, especially on modern CPUs equipped with larger SIMD registers, and allows for efficient generation of random numbers for various simulation applications.


翻译:许多仿真应用需要生成长序列的伪随机数。模2线性递归通常被用作构建具有长周期和优异统计特性的伪随机数生成器的基本模块。此类生成器包含一个通过线性变换迭代演化的长二进制状态向量。其中一种被广泛接受的伪随机生成器是Matsumoto和Nishimura提出的梅森旋转算法19937(MT19937),该算法已应用于众多软件库和数值计算包中。MT19937的流行源于其良好的分布特性以及算法的简洁性和速度。负责演化二进制状态向量的线性变换可以表示为一组简洁的基础位操作。然而,该变换并未充分利用现代硬件上SIMD指令的并行化潜力,限制了进一步的提速。本文提出一种新的SIMD友好型随机数生成器,其保持与MT19937相同的统计特性和周期。该生成器通过跳跃变换将多个MT19937实例的随机流与失相状态向量相结合,然后以轮询方式依次访问每个实例。通过同步演化其向量状态,新生成器实现了完美向量化,充分利用了SIMD硬件能力。综合测试结果表明,新生成器的吞吐量约与所用SIMD寄存器宽度呈线性关系。这提供了显著的速度提升,尤其是在配备较大SIMD寄存器的现代CPU上,从而能够为各类仿真应用高效生成随机数。

0
下载
关闭预览

相关内容

【2023新书】随机模型基础,815页pdf
专知会员服务
105+阅读 · 2023年5月10日
【港科大博士论文】生成模型的统计和结构特性,338页pdf
专知会员服务
48+阅读 · 2022年12月20日
专知会员服务
49+阅读 · 2021年4月24日
斯坦福CS236-深度生成模型2019-全套课程资料分享
深度学习与NLP
20+阅读 · 2019年8月20日
变分自编码器VAE:一步到位的聚类方案
PaperWeekly
25+阅读 · 2018年9月18日
数据分析师应该知道的16种回归方法:泊松回归
数萃大数据
35+阅读 · 2018年9月13日
【干货】一文读懂什么是变分自编码器
专知
12+阅读 · 2018年2月11日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
最新内容
学习数据的几何:形状空间分析数学综述
专知会员服务
5+阅读 · 6月17日
定向能反无人机系统最新发展动态
专知会员服务
7+阅读 · 6月17日
从燃煤战舰到算法战争:水面指挥的永恒要求
专知会员服务
4+阅读 · 6月17日
相关基金
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员