<p>First, I don't think anyone can give you a definitive answer, we can only give you different options and you will need to run performance measurements for your particular use case yourself to find a solution that's optimal for your specific requirements.</p>

<p>Some suggestions:</p>

<ul>
<li>The Box-Muller transform is certainly a decent way to generate gaussian-distributed values, but requires <code>sin</code>, <code>cos</code>, logarithm, and square root computations. You can remove the need for sine and cosine by switching to the <a href="https://en.wikipedia.org/wiki/Marsaglia_polar_method" rel="nofollow noreferrer">Marsaglia polar method</a>. This does come at the cost of requiring you to generate a larger quantity of uniformly distributed values. Depending on how your RNG performs on your GPU, this may still work to your advantage, however.</li>
<li>Be careful with linear congruencial RNGs (LCG), they exhibit patterns that sometimes interact badly with transformation algorithms such as Box-Muller. The one you linked is an MWC generator, which is a technique related to linear congruence, so might have similar issues. I would probably try exploring other generators. I haven't had a chance to try it myself yet, but there exists a <a href="https://arxiv.org/abs/1005.4973v3" rel="nofollow noreferrer">Mersenne Twister variant for GPUs</a> which I would imagine working well for many applications. One advantage of Mersenne Twister is that it mostly uses bitwise manipulation instructions, which tend to be very fast on GPUs, unlike integer multiplication and division.</li>
</ul>

<p>There are definitely plenty of libraries out there, but I'll point out that for best performance you'll probably want to keep the random number generating code running in the same OpenCL work-item as the code that uses the samples. Writing out to a memory buffer will put a strain on memory bandwidth, although if your subsequent processing code is heavily ALU/FPU bound this might not matter.</p>

<p>As with any random number generation, testing is key - at the very least, plot a histogram of the samples your code generates and overlay it with the theoretical distribution function you're trying to obtain and visually inspect it to make sure it looks reasonable.</p>
how to generate Gaussian distributed random numbers in OpenCL?
<p>Are there some other way to get the Gaussian distributed random numbers or are there any libraries for this today?</p>

<p>I have seen the question about <a href="https://stackoverflow.com/questions/21703439/gaussian-distributed-random-numbers-in-opencl">Gaussian distributed random numbers in OpenCL</a></p>

<p>I want to generate many Gaussian distributed random numbers in OpenCL like above url question.</p>

<p>It may do that by two step:</p>

<p><a href="http://cas.ee.ic.ac.uk/people/dt10/research/rngs-gpu-mwc64x.html#source_code" rel="nofollow noreferrer">http://cas.ee.ic.ac.uk/people/dt10/research/rngs-gpu-mwc64x.html#source_code</a>
it may generate many  random uniform number instead of Gaussian distributed random numbers .</p>

<p>And then I can  transform uniform random variants into normally distributed ones using <a href="https://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform</a>.</p>

<p>It may be time expensive,so are there some other way to get the Gaussian distributed random numbers(it is better using kernel to generate a array random number like cuda function:curandGenerateNormal(....)) or are there any libraries for this today?</p>