博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Random number for GPU
阅读量:2439 次
发布时间:2019-05-10

本文共 1625 字,大约阅读时间需要 5 分钟。

Efficient random number generation and application using CUDA

http://http.developer.nvidia.com/GPUGems3/gpugems3_ch37.html

cuRAND: Nvidia random number generation library

https://developer.nvidia.com/cuRAND

Quick and easy gpu random numbers in D3D11:

http://www.reedbeta.com/blog/2013/01/12/quick-and-easy-gpu-random-numbers-in-d3d11/

A Fast high quality pseudo random number generator for nVidia CUDA

http://www0.cs.ucl.ac.uk/staff/ucacbbl/ftp/papers/langdon_2009_CIGPU.pdf

GPU pseudo random number: GPU TEA

http://www.csee.umbc.edu/~olano/papers/GPUTEA.pdf

/*

* Pseudo random number generator, based on "TEA, a tiny Encrytion Algorithm"
* http://citeseer.ist.psu.edu/viewdoc/download?doi=10.1.1.45.281&rep=rep1&type=pdf
* @param v - old seed (full 32bit range)
* @param IterationCount - >=1, bigger numbers cost more performance but improve quality
* @return new seed
*/
uint2 ScrambleTEA(uint2 v, uint IterationCount = 3)
{
    // Start with some random data (numbers can be arbitrary but those have been used by others and seem to work well)
    uint k[4] = { 0xA341316Cu, 0xC8013EA4u, 0xAD90777Du, 0x7E95761Eu };
    uint y = v[0];
    uint z = v[1];
    uint sum = 0;
    for (uint i = 0; i < IterationCount; ++i)
    {
        sum += 0x9e3779b9;
        y += (z << 4u) + k[0] ^ z + sum ^ (z >> 5u) + k[1];
        z += (y << 4u) + k[2] ^ y + sum ^ (y >> 5u) + k[3];
    }
    return uint2(y, z);
}

uint MortonCode(uint x)

{
    x = (x ^ (x << 2)) & 0x33333333;
    x = (x ^ (x << 1)) & 0x55555555;
    return x;
}
uint ReverseUIntBits(uint bits)
{
    bits = ((bits & 0x33333333) << 2) | ((bits & 0xcccccccc) >> 2);
    bits = ((bits & 0x55555555) << 1) | ((bits & 0xaaaaaaaa) >> 1);
    return bits;
}

转载地址:http://xhwqb.baihongyu.com/

你可能感兴趣的文章
postgresql 优化与维护
查看>>
mongodb replica sets 测试
查看>>
linux AS6.2 与 as5.4 的对比,性能提升明显
查看>>
FLASHCACHE 的是是非非
查看>>
length() between oracle and postgresql
查看>>
求无序数组总第n大的数
查看>>
99-lisp lisp 的99个问题 P1-10
查看>>
PG 函数的易变性(Function Volatility Categories)
查看>>
Lisp Quote 和Backquote分析
查看>>
PG psql 变彩色显示
查看>>
SICP 练习 1.3
查看>>
pg 数据库HA 启动脚本的两个假设
查看>>
PG9.2.3 发布
查看>>
sql_log_bin在GTID复制下的一个现象
查看>>
双主+haproxy手工切换的一个注意点
查看>>
利用binlog2sql实现闪回
查看>>
mongos分片集群下db数量过多导致服务不可用
查看>>
mysql唯一索引的一个小常识--Duplicate entry 'XXX' for key 'XXX'
查看>>
故障处理--mongos count不准
查看>>
大量短连接导致haproxy服务器端口耗尽
查看>>