VMT19937: 一种基于梅森扭蛋19937的SIMD友好伪随机数生成器
VMT19937: A SIMD-Friendly Pseudo Random Number Generator based on Mersenne Twister 19937
AI总结:
本文提出VMT19937,一种基于MT19937的SIMD友好伪随机数生成器,通过并行处理提升效率,保持统计性质和周期,适用于模拟应用。
摘要:
许多模拟应用需要生成长序列的伪随机数。线性递归模2常用于构建具有长周期和优良统计性质的伪随机数生成器。这些生成器包含一个长二进制状态向量,通过线性变换迭代演变。此类生成器中广泛接受的是梅森扭蛋19937(MT19937),由Matsumoto和Nishimura提出,已被广泛实现。MT19937的流行源于其优良的分布属性和算法的简单性与速度。负责演变二进制状态向量的线性变换可以表示为一组简洁的位操作。然而,这种变换未能充分利用现代硬件中通过SIMD指令可用的并行化潜力,限制了进一步的速度提升。本文介绍了一种新的SIMD友好随机数生成器,保持与MT19937相同的统计属性和周期。它结合多个MT19937实例的随机流,通过跳步变换将状态向量去相位,然后按轮换方式轮询每个实例。通过同时演变其向量状态,新生成器实现了完美的向量化,充分利用SIMD硬件能力。全面的测试结果表明,新生成器的吞吐量与所用SIMD寄存器宽度成近似线性关系。这提供了显著的速度提升,尤其是在具有更大SIMD寄存器的现代CPU上,并允许为各种模拟应用高效生成随机数。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。