使用随机数与GPU [英] Using random numbers with GPUs

查看:217
本文介绍了使用随机数与GPU的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调查使用nvidia GPU进行蒙特卡罗模拟。然而,我想使用gsl随机数发生器和一个并行随机数发生器如SP​​RNG。有人知道这是否可能?

I'm investigating using nvidia GPUs for Monte-Carlo simulations. However, I would like to use the gsl random number generators and also a parallel random number generator such as SPRNG. Does anyone know if this is possible?

更新

关于使用GPU的RNG。目前还没有一个很好的解决方案。随SDK提供的Mersenne Twister不适合(我的)蒙特卡罗模拟,因为它需要花费非常长的时间来生成种子。

I've played about with RNG using GPUs. At present there isn't a nice solution. The Mersenne Twister that comes with the SDK isn't really suitable for (my) Monte-Carlo simulations since it takes an incredibly long time to generate seeds.

NAG库更有前途。您可以批量或单个线程生成RN。但是,目前只支持几个分布 - 均匀,指数和正常。

The NAG libraries are more promising. You can generate RNs either in batches or in individual threads. However, only a few distributions are currently supported - Uniform, exponential and Normal.

推荐答案

GSL手册推荐Mersenne Twister

Mersenne Twister的作者有版本的Nvidia GPU 。我查看移植到R包的 gputools ,但发现我需要过大的数的绘图(数百万,我想)之前的'生成GPU和提供给R'的速度比仅绘制R(只使用CPU)更快。

The Mersenne Twister authors have a version for Nvidia GPUs. I looked into porting this to the R package gputools but found that I needed excessively large number of draws (millions, I think) before the combination of 'generate of GPU and make available to R' was faster than just drawing in R (using only the CPU).

这是一个计算/通信权衡。

It really is a computation / communication tradeoff.

这篇关于使用随机数与GPU的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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