Hi,
I would like to know if there is a way to get the time in an OpenCL kernel ?
What I need is one or several good 'random number' to use in my kernel. So, if you have some proposals ?
hi viewon01,
There are no built-in random number generator functions in OpenCL. Although you can create one for you if it is necessary.As a seed i would suggest you to take the times returned by clGetProfilingInfo.You can use any of the 4 timestamps.The value is represented in nanoseconds so i think it would be quite random and suitable as seed.
Thanks
Random number generation is not so simple 😛
I have see several implementations in OpenCL, none is 'perfect' and 100% GPU !
I have see severals OpenCL random sequences generations like ;
- Mersenne
- Tausworthe
- ... other ...
Each method procude different quality of sequences !
I posted some code that I made for my own use here, which I believe is one of the simpler ones to start using in your own code.
Thanks,
It looks very interesting, I have to do some tests too.
I have also find this page : http://inst.cs.berkeley.edu/~ianh/proj1.html
Where he has a 'simple' random generator... code is provided too.