We introduce OpenRAND, a C++17 library aimed at facilitating reproducible scientific research through the generation of statistically robust and yet replicable random numbers. OpenRAND accommodates single and multi-threaded applications on CPUs and GPUs and offers a simplified, user-friendly API that complies with the C++ standard's random number engine interface. It is portable: it functions seamlessly as a lightweight, header-only library, making it adaptable to a wide spectrum of software and hardware platforms. It is statistically robust: a suite of built-in tests ensures no pattern exists within single or multiple streams. Despite the simplicity and portability, it is remarkably performant-matching and sometimes even outperforming native libraries by a significant margin. Our tests, including a Brownian walk simulation, affirm its reproducibility and highlight its computational efficiency, outperforming CUDA's cuRAND by up to 1.8 times.
翻译:我们提出OpenRAND——一个C++17库,旨在通过生成统计稳健且可复现的随机数,促进可重复的科学研究。OpenRAND支持CPU和GPU上的单线程与多线程应用,并提供符合C++标准随机数引擎接口的简化易用API。它具有可移植性:作为轻量级纯头文件库无缝运行,能够适应广泛的软硬件平台。它具有统计稳健性:内置测试套件确保单流或多流中不存在模式。尽管设计简洁且可移植,其性能仍极为出色——可匹配甚至显著超越原生库。我们的测试(包括布朗运动模拟)验证了其可复现性,并凸显其计算效率,最高可达CUDA cuRAND性能的1.8倍。