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 ?
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.
Random number generation is not so simple :-P
I have see several implementations in OpenCL, none is 'perfect' and 100% GPU !
I have see severals OpenCL random sequences generations like ;
- ... 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.
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.
in this post I've linked another alternative: Re: Random numbers in OpenCL
Retrieving data ...